Picture1.Point RGB Value

Picture1.Point RGB Value

Post by James Marquett » Wed, 27 May 1998 04:00:00



How do I extract the R, G, B, values separately from a Picture in a picture
box.

 
 
 

Picture1.Point RGB Value

Post by Gerrie Have » Wed, 27 May 1998 04:00:00


Function GetRGB(ByVal RGBval, ByVal Num) As Integer
    If Num > 0 And Num < 4 And RGBval > -1 And RGBval < 16777216 Then
        GetRGB = RGBval \ 256 ^ (Num - 1) And 255
    Else
        'Num or RGBval invalid
        GetRGB = True
    End If
End Function

Sub foo
    'sample code retrieving rgb value for pixel in position 10, 10 of
Picture1
    Dim r%, g%, b%, color&
    color = Picture1.Point(10, 10)
    r = GetRGB(color, 1)
    g = GetRGB(color, 2)
    b = GetRGB(color, 3)
    Msgbox "RGB values are " & cstr(r) & ", " & cstr(g) & ", " & cstr(b) &
". "
    'Haven't actually tested this(written in outlook express, so expect some
    'minor syntax errors
    'The GetRGB should work fine
End Sub


>How do I extract the R, G, B, values separately from a Picture in a picture
>box.


 
 
 

Picture1.Point RGB Value

Post by Michaela Meie » Thu, 28 May 1998 04:00:00



> How do I extract the R, G, B, values separately from a Picture in a picture
> box.

Hi,
This is a 'non-mathematical' approach :-)

 c&=picture1.point(x,y) 'color

 blue=val("&H"+mid$(n$,1,2))
 green=val("&H"+mid$(n$,3,2))
 red=val("&H"+mid$(n$,5,2))

Michaela

 
 
 

1. resistent Picture (Picture1.Picture = Picture1.Image)

Hello,

I coded long time in VisualBasic and want to switch
now to Borland Bulider 6.

I paint an picture using "SetDIBitsToDevice(..)"
this works great but

*) when I move the form out of Screen the picture
   is deleted

*) I can't save the picture into an bmp file

in vb the solution of this Problem was:

Picture1.AutoRedraw=True
SetDIBitsToDevice(..)
Set Picture1.Picture = Picture1.Image

how can I do this in BorlandBuilder 6?

And an secound question:
is GetDC(Image1->Picture->Bitmap->Handle) the right
handel to an picture? The Data is not printed in the
picture box but on the screen.
I have to use Form1->Left + Image1->Left as an x-offset
and Form1->Top + Image1->Top as an y-offset. Is this
correct?

best regards,
Philipp Arndt

2. Shadows from Opacity map: Is it possible?

3. How to cinvert RGB values into a single grayscale value

4. Announce: SIGGRAPH96 SIG on Motion Capture and Character Animation

5. any information on convert RGB color value to HSI value

6. Looking for some sort of jigsaw fx

7. 16-bit color value to RGB-value converting

8. any information on convert RGB color value to HSI value

9. How transform a rgb value to tsl value

10. Interpolating RGB levels from camera to RGB pixel values