Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Getting an intersect of a color

Getting an intersect of a color

Scheduled Pinned Locked Moved C#
tutorial
15 Posts 5 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Ista

    Yes but since green is 0,128,0 and green yellow is 0,173,28 and yellow is 255,255,0 a simple matter of adding 1 to red does not get me any closer to the intersection since its not a linear equation. I was hoping someone would know a math formula to calculate the intersection of the three planes basically. nick I'm not an expert yet, but I play one at work. Yeah and here too.

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #6

    How can green be 0, 128, 0 ? It is green, as is any value with 0 red and 0 blue, but hard green is 255, surely ? In any case, the system works the same way, forget greenyellow, it's obviously not the point halfway between the other two. Instead, add 2 to your red value for every 1 you add to your green value. Write up a program that does that and draws a gradient and see how it looks. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

    I 1 Reply Last reply
    0
    • C Christian Graus

      How can green be 0, 128, 0 ? It is green, as is any value with 0 red and 0 blue, but hard green is 255, surely ? In any case, the system works the same way, forget greenyellow, it's obviously not the point halfway between the other two. Instead, add 2 to your red value for every 1 you add to your green value. Write up a program that does that and draws a gradient and see how it looks. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #7

      thanks By the way those are colors from the color namepsace. so obviously thier not dark colors I'm not an expert yet, but I play one at work. Yeah and here too.

      C 1 Reply Last reply
      0
      • I Ista

        thanks By the way those are colors from the color namepsace. so obviously thier not dark colors I'm not an expert yet, but I play one at work. Yeah and here too.

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #8

        Yeah, I guessed where they were from. I guess they have a dark green or something... Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

        1 Reply Last reply
        0
        • I Ista

          I need to get the intersection of Green and Yellow in ARGB format Is there a function for this. And yes I know Color.GreenYellow exists but I need to know how to get intersections to achieve other mid way points. nick I'm not an expert yet, but I play one at work. Yeah and here too.

          P Offline
          P Offline
          Philip Fitzsimons
          wrote on last edited by
          #9

          use hue-saturation-brightness...


          "When the only tool you have is a hammer, a sore thumb you will have."

          I 1 Reply Last reply
          0
          • P Philip Fitzsimons

            use hue-saturation-brightness...


            "When the only tool you have is a hammer, a sore thumb you will have."

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #10

            do you have a link or some help for explanation I'm not an expert yet, but I play one at work. Yeah and here too.

            P 1 Reply Last reply
            0
            • I Ista

              do you have a link or some help for explanation I'm not an expert yet, but I play one at work. Yeah and here too.

              P Offline
              P Offline
              Philip Fitzsimons
              wrote on last edited by
              #11

              Color.GetHue http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?hue,+saturation,+brightness[^]


              "When the only tool you have is a hammer, a sore thumb you will have."

              1 Reply Last reply
              0
              • I Ista

                I need to get the intersection of Green and Yellow in ARGB format Is there a function for this. And yes I know Color.GreenYellow exists but I need to know how to get intersections to achieve other mid way points. nick I'm not an expert yet, but I play one at work. Yeah and here too.

                R Offline
                R Offline
                Rein Hillmann
                wrote on last edited by
                #12

                Treat each color value as a percentage 0=0%, 255=100% So, a certain color might be (20%, 30%, 90%) in RGB if you want to intersect that with another color (100%, 60%, 0%) the intersection will be the averages: (60%, 45%, 45%) Make sense?

                I 1 Reply Last reply
                0
                • R Rein Hillmann

                  Treat each color value as a percentage 0=0%, 255=100% So, a certain color might be (20%, 30%, 90%) in RGB if you want to intersect that with another color (100%, 60%, 0%) the intersection will be the averages: (60%, 45%, 45%) Make sense?

                  I Offline
                  I Offline
                  Ista
                  wrote on last edited by
                  #13

                  heres a rough equation i got from my friend: average the "Reds" - aa+11= bb bb/2 = 5D bb+22 = DD dd/2 = 6e cc+33 = ff ff/2 = 7f so the average =c #aabbcc and #112233 = #5D6E7F I'm not an expert yet, but I play one at work. Yeah and here too.

                  R 1 Reply Last reply
                  0
                  • I Ista

                    heres a rough equation i got from my friend: average the "Reds" - aa+11= bb bb/2 = 5D bb+22 = DD dd/2 = 6e cc+33 = ff ff/2 = 7f so the average =c #aabbcc and #112233 = #5D6E7F I'm not an expert yet, but I play one at work. Yeah and here too.

                    R Offline
                    R Offline
                    Rein Hillmann
                    wrote on last edited by
                    #14

                    Yeah, it's pretty much the same thing. (Ra + Rb)/2 = Ri (Ba + Bb)/2 = Bi (Ga + Gb)/2 = Gi It makes sense since if you intersect a red line (255,0,0) with a black line (0,0,0) then the result should be a darker red line (128,0,0)

                    1 Reply Last reply
                    0
                    • I Ista

                      I need to get the intersection of Green and Yellow in ARGB format Is there a function for this. And yes I know Color.GreenYellow exists but I need to know how to get intersections to achieve other mid way points. nick I'm not an expert yet, but I play one at work. Yeah and here too.

                      R Offline
                      R Offline
                      Roger Alsing 0
                      wrote on last edited by
                      #15

                      just mix them Color c1=Color.Green; Color c2=Color.Yellow; Color mix=Color.FromArgb( (c1.r+c2.r)/2,(c1.g+c2.g)/2,(c1.b+c2.b)/2); //Roger

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups