Re: Modifying A Pixel in a Picture's color
- From: "Mike Williams" <Mike@xxxxxxxxxxxxxxxxx>
- Date: Sun, 15 Jan 2006 12:54:58 -0000
<PulsarSL@xxxxxxxxx> wrote in message news:1137303921.209476.245110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Actually, the picturebox's pset method is perfect.
Well, I wouldn't say "perfect", but it does the job reasonably well. The two main problems with the Pset method is that it is slow and that it doesn't always set the pixel to the colour you have asked it to. The slowness may or may not be aproblem to you, depending on exactly what you are doing, but if it is a problem then you can speed it up by using the SetPixel API instead, as MikeD has already suggested. If you to manipulate individual pixels and you want a really fast method you'd be better off using the API to get your picture data into a standard array (of Longs or RGBQuads or whatever suits you best) and working on that data.
Also if you want your code to work so that the colours are exactly what you want on all computers, including computers that are running at less than full colour depth, then you won't be able to use the VB picture box anyway and you'll have to use the various API methods. This is because when you load a picture into a VB picture box on a computer running at 16 bit colour depth (or less) then the pixel colours will not be exactly the same as the pixel colours of the original picture. Also, when you set a pixel to a specific colour (using either the VB Pset method or the alternative API SetPixel method) you will not always get exactly the colour you asked for. Windows does all this stuff very well though, so that to the naked eye the picture looks virtually the same as the original - but it isnt exactly the same.
Mike
.
- Follow-Ups:
- Re: Modifying A Pixel in a Picture's color
- From: Mike D Sutton
- Re: Modifying A Pixel in a Picture's color
- References:
- Modifying A Pixel in a Picture's color
- From: PulsarSL
- Re: Modifying A Pixel in a Picture's color
- From: MikeD
- Re: Modifying A Pixel in a Picture's color
- From: PulsarSL
- Modifying A Pixel in a Picture's color
- Prev by Date: Re: Machine control from vb 6.0
- Next by Date: Strange behavior of a textbox
- Previous by thread: Re: Modifying A Pixel in a Picture's color
- Next by thread: Re: Modifying A Pixel in a Picture's color
- Index(es):
Relevant Pages
|