Click to See Complete Forum and Search --> : what color that pixel?


phil m
March 20th, 2001, 09:11 PM
Hi

I'd like to click on a point on a photo and for the computer to tell me what value the color of that point is - that cell.

I'm currently without my books so I'm lost a bit at the moment.

I'd also like to change the color of a point.

Any words of wisdom - many thanks. Many, many.

Phil

mabrin
March 21st, 2001, 02:57 AM
Hi,

solutions to get the color could be:

Private Sub Form_Click ()
Dim MidColor ' Color of the form center
MidColor = Point(Width / 2, Height / 2)
end sub

and to set the color use object.PSet:

object.PSet [Step] (x, y), [color]

Hope that fits,

mabrin

shree
March 21st, 2001, 06:12 AM
Say the photo is in Picture1. Then, in its MouseDown event, write


private sub picture1_mousedown(......, X as Single, Y as Single)
dim col as long, newcol as long
dim red as byte, green as byte, blue as byte
'get the pixel value at that point
col=picture1.point(x,y)
'Separate them into Red Green and Blue Components
red=col and &hff
green=(col and &hff00&)/&h100&
blue=(col and &hff0000&)/&h10000&
'Modify the values -- Add a constant to increase the brightness
red=red+10
green=green+10
blue=blue+10
'Use RGB() to determine the new pixel value
newcol=RGB(red, green, blue)
'Write this new pixel with the PSet method
picture1.pset(x,y),newcol
end sub

phil m
March 21st, 2001, 07:44 PM
Thanks to all

I'll try these ideas out

Again MANY THANKS

Phil