Results 1 to 5 of 5

Thread: Extracting Red, Green, and Blue

  1. #1

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    I have a color returned from GetPixel, how to i extract the Red, Green, and Blue. Again, i have seen this before, but because search is disabled, i must post again.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    92
    Here it goes!

    Code:
    put this in a module:
    
    Public Type MyRGBColor
      Red As Byte
      Green As Byte
      Blue As Byte
    End Type
    
    Public Type MyColor
      RGB As Long
    End Type
    
    Form General declarations!
    
    Dim mycol As MyColor
    Dim RGBCol As MyRGBColor
    Dim d As Long
    
    
    
    Then in a sub:
    
    d = GetPixel ...blah , blah
    mycol.RGB = d
    LSet RGBCol = mycol
    Dim d1
    d1 = (RGBCol.Red & "," & RGBCol.Green & "," & RGBCol.Blue)
    
    MsgBox d1

    Cheers

  3. #3

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    that's an interesting way to do it, i was originally looking for the arithmatic way, but this will do just fine, thanks alot!
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  4. #4

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    i am getting unpredicable results with this method. does anyone have the arithmatic method. not to put you down, iScanning, but i'm only getting correct results rarely. i'm getting some inverted results and also some completly inaccurate results.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  5. #5

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    oops, my fault, it was a bug in my software, anyway, thanks, your method works fine!
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width