Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do do HSV with a Brush

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do do HSV with a Brush

    I have some code that works in HSL space. It relies on Color.GetSaturation(), Color.GetHue(), and Color.GetBrightness().
    • The Color class is not available in NT8
    • I do not see similar functions on Brush
    • I have Googled and all examples I find use those Color functions during their calculations

    So how do I make that work with just a Brush? I need either that, or else to have access to Color restored so I can use that in my internal calculations.

    --EV

    #2
    Originally posted by ETFVoyageur View Post
    I have some code that works in HSL space. It relies on Color.GetSaturation(), Color.GetHue(), and Color.GetBrightness().
    • The Color class is not available in NT8
    • I do not see similar functions on Brush
    • I have Googled and all examples I find use those Color functions during their calculations

    So how do I make that work with just a Brush? I need either that, or else to have access to Color restored so I can use that in my internal calculations.

    --EV
    One can certainly use the System.Drawing namespace if one wanted, but to me, mixing Winforms and WPF is a code smell. You might have to write some converter methods instead, so that you stay in WPF.

    Comment


      #3
      Originally posted by koganam View Post
      One can certainly use the System.Drawing namespace if one wanted, but to me, mixing Winforms and WPF is a code smell.
      I tried that, but the compiler objected. Intellisense does not even admit that System.Drawing exists. I did not look deeply into what it would take to fix that -- I just assumed that Color was deliberately excluded.

      You might have to write some converter methods instead, so that you stay in WPF.
      I guess you are correct -- I need to write my own to and from code for Hue, Saturation, Luminance. Things like that sure seem like library matters that should already be there, though. I'm disappointed if the new order does not provide that, so I thought I must just be missing something obvious.

      --EV

      Comment


        #4
        Originally posted by ETFVoyageur View Post
        I tried that, but the compiler objected. Intellisense does not even admit that System.Drawing exists. I did not look deeply into what it would take to fix that -- I just assumed that Color was deliberately excluded.

        I guess you are correct -- I need to write my own to and from code for Hue, Saturation, Luminance. Things like that sure seem like library matters that should already be there, though. I'm disappointed if the new order does not provide that, so I thought I must just be missing something obvious.

        --EV
        Nope. definitely a WPF issue.

        Comment


          #5
          Originally posted by ETFVoyageur View Post
          I tried that, but the compiler objected. Intellisense does not even admit that System.Drawing exists. I did not look deeply into what it would take to fix that
          Add the system.drawing.dll as a reference...


          -=Edge=-
          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

          Comment


            #6
            Originally posted by -=Edge=- View Post
            Add the system.drawing.dll as a reference...


            I thought of that, and am willing to do so. Is that a problem for others if I were to provide them with my indicator? (That's why I was cautious about doing so.)

            --EV

            Comment


              #7
              Originally posted by ETFVoyageur View Post
              I thought of that, and am willing to do so. Is that a problem for others if I were to provide them with my indicator? (That's why I was cautious about doing so.)
              Yes.. anyone using an indy with that would also have to add that reference as well.. Which is why I've tried to stay away from the system.drawing all together now..


              -=Edge=-
              NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

              Comment


                #8
                Originally posted by -=Edge=- View Post
                Yes.. anyone using an indy with that would also have to add that reference as well.. Which is why I've tried to stay away from the system.drawing all together now..


                That's what I figured. I guess the best thing is to look into writing my own conversion routines.

                --EV

                Comment


                  #9
                  Originally posted by -=Edge=- View Post
                  Yes.. anyone using an indy with that would also have to add that reference as well.. Which is why I've tried to stay away from the system.drawing all together now..


                  Well, if they used the NT import facility, the reference would get automatically added by AdditionalFiles.txt.

                  I still do not think it is elegant to mix WinForms and WPF code, but hey, that is just me.

                  Comment


                    #10
                    Originally posted by koganam View Post
                    Well, if they used the NT import facility, the reference would get automatically added by AdditionalFiles.txt.

                    I still do not think it is elegant to mix WinForms and WPF code, but hey, that is just me.
                    I agree with you -- I'll Google for some conversion routines. This is a common enough issue that there must be some publicly available code.

                    --EV

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Christopher_R, Today, 12:29 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post Christopher_R  
                    Started by sidlercom80, 10-28-2023, 08:49 AM
                    166 responses
                    2,235 views
                    0 likes
                    Last Post sidlercom80  
                    Started by thread, Yesterday, 11:58 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post thread
                    by thread
                     
                    Started by jclose, Yesterday, 09:37 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post jclose
                    by jclose
                     
                    Started by WeyldFalcon, 08-07-2020, 06:13 AM
                    10 responses
                    1,415 views
                    0 likes
                    Last Post Traderontheroad  
                    Working...
                    X