Click to See Complete Forum and Search --> : Inverting colors
shaba
Jun 8th, 2000, 01:01 AM
i posted a similar question under graphics, but i suspect the solution will come from an API call, so here goes. I want to be able to load a picture into a picturebox and then pixel by pixel, reverse the RGB values and generate the inverted image into a second picturebox. so if a pixel is 5,55,100, it will be reversed to 250,200,155. i want to develop an application that simulates a photographic enlarger. i am looking for an efficient solution to accomplish this.
thans for your help,
Shaheeb
To get a certian pixel, use the GetPixel method. To Set the pixel, you use the SetPixel method. Then when you get the pixel, convert it into RGB and Invert the numbers.
Say, for example, if the picture is 50x100...
For i = 1 to 50
For o = 1 to 100
Retval = GetPixel(Picture1.hDC, i, o)
SetPixel pictur1.hdc, i, o, RGB(red, green, blue)
Next o
Next i
kedaman
Jun 10th, 2000, 04:21 PM
Use Bitblt api with this ROP: vbSrcInvert
I found another way. You can draw a box using the Line method. (Make sure the draw mode is Invert)
kedaman
Jun 11th, 2000, 02:31 AM
Meg, it's slower
Fox
Jun 11th, 2000, 04:12 AM
Does that matter?
I said that as a Joke. Now that computer's are 600Mhz, I can't event notice the difference.
kedaman
Jun 11th, 2000, 06:02 AM
µµµµµµµµµ Yes it matters µµµµµµµµ ok, depending on what you're doing, but i haven't done any tests yet, so i can't say how much
Well, for me it doesn't matter.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.