Re: Modifying A Pixel in a Picture's color



<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








.



Relevant Pages

  • Re: Forcing a form to perfectly fit its background image
    ... assuming the picture is always smaller than the screen. ... If the resolution of the camera when you took the picture was 1600 x 1200 for example and you display that picture at its full "pixel size" on a typical monitor running at a typical 96 pixels per logical inch then the picture will have a "size" of 16.7 x 12.5 logical inches. ... So, as you can see, displaying or printing a picture "pixel for pixel" will produce a picture whose size depends on the size of each pixel in the output device. ...
    (comp.lang.basic.visual.misc)
  • Re: Question regarding VB6
    ... your drawings without going into the complexity of using the various region ... point in the main picture box and you would have an identically shaped ... In Windows of course you still specify the values 0 to 255 for each of the rgb components regardless of the colour depth of the system, and Windows will use the nearest colour it can, but on 16 bit colour depth systems every pixel will be one of the 65536 colours that it can actually display. ... As I mentioned earlier, on 16 bit systems the red and blue components will normally be one of 32 possible values, and the green component will be one of 64 possible values. ...
    (comp.lang.basic.visual.misc)
  • Re: Question regarding VB6
    ... your drawings without going into the complexity of using the various region ... point in the main picture box and you would have an identically shaped ... In Windows of course you still specify the values 0 to 255 for each of the rgb components regardless of the colour depth of the system, and Windows will use the nearest colour it can, but on 16 bit colour depth systems every pixel will be one of the 65536 colours that it can actually display. ... As I mentioned earlier, on 16 bit systems the red and blue components will normally be one of 32 possible values, and the green component will be one of 64 possible values. ...
    (comp.lang.basic.visual.misc)
  • Re: Different resizing behaviour on 120 dpi screen
    ... Firstly, you haven't told us whether these picture boxes have borders or not, and whether or not you want all four borders on both picture boxes to be fully displayed. ... The OS cannot actually display a window of any sort on the screen that is anything other than a whole pixel value, whereas VB will calculate and store a window's Width property using whatever value you assign to it, which may or may not be a whole pixel value. ... Dim wide As Long, high As Long, pwide As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: Will F1 be on BBC HD?
    ... much sharper picture than a lower-resolution one. ... good quality HD display fed a good quality HD signal is far ... sharper than a good quality SD display fed a good quality SD ... they think you get a 1:1 pixel mapping, ...
    (rec.autos.sport.f1)