Re: Question regarding VB6



"J French" <erewhon@xxxxxxxxxx> wrote in message
news:43e5cf78.342534649@xxxxxxxxxxxxxxxxxxxxxxx

Having thought about it a bit more, I suspect that the answer
is to set an Array of bytes (or integers), and repeatedly use
SetDiBits and GetDiBits to determine which pixels have been
affected by the printing, then push the appropriate 'real' colour
number into the background Array.

If you mean what I think you mean (creating complex "clickable regions" from
your drawings without going into the complexity of using the various region
APIs) then a neat way would be to duplicate all of your drawings into a
similarly sized invisible picture box, but using a "single solid colour" in
the invisible box regardless of the actual colour used in the main drawing.
In that way you could create (say) a complex multicoloured drawing at one
point in the main picture box and you would have an identically shaped
"single solid colour" drawing in the invisible picture box. If you chose a
different solid colour for each of your individual drawings then you could
have as many different separate "clickable drawings" as you want in the one
picture box. In use you would detect the user's click in the main picture
box (as normal) but instead of checking the "clicked pixel" in the main
picture box you would check it in the hidden picture box at the same
location. Also, each of the drawings would automatically have its own "Z
order", depending on the order in which they were drawn.

By the way, as far as machines running at 16 bit colour depth are concerned
the individual bits of the 16 bit "colour" number are usually split up in
the order 5, 6, 5 (which is 5 bits for red, 6 bits for green and 5 bits for
blue). This gives 32 different possible values of red, 64 different possible
values of green and 32 different possible values of blue (a total of 65536
possible colours). The reason they chose to allot the otherwise "extra bit"
to the green component is because of the three, green is the colour that
looks the brightest to the human eye and so it made sense to split that into
more available colours than the other two.

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 (or a dither pattern of a number of different colours if you choose a fill or block of colour), 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. On almost every 16 bit system I have come across the actual colour you get is calculated by Windows in accordance with the following formula (where c1 is the colour you "ask for" and c2 is the colour you get) . . .

For the red and the blue components . . .

c2 = (c1 \ 8) * 8 + c1 \ 32

And for the green component it is . . .

c2 = (c1 \ 4) * 4 + c1 \ 64

Mind you, it's probably better to simply set a pixel to the colour you are after and then read the resultant pixel colour to see what colour you actually got.

I was going to carry on with a lot more info on this colour business Jerry, but my daughter and her partner came round a couple of hours ago and I'm afraid we all got drunk! They have gone now, so I might start sobering up later, but I doubt it, because Maureen and I are off to Scotland in the morning (Gretna Green) to get married, so it could be a long night tonight! You'd think we would know better at our age ;-)

We'll be back in a week or so.

Mike









.



Relevant Pages

  • 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 ... on 16 bit systems the red and blue components will ... normally be one of 32 possible values, and the green component will be one ...
    (comp.lang.basic.visual.misc)
  • Re: Normalized Sue Testing
    ... If you build a picture with X size 10, and then in the picture X is = ... Except with drawings I get a "it's a lifelike drawing of a person" ... Ok, computergenerated graphics. ... Yes, sir, your Enlightedness! ...
    (rec.arts.sf.composition)
  • Re: Normalized Sue Testing
    ... etc. -- you'd find there was a closer ... That's just the parameters the computers get told, so naturally they spit out something that matches the parameters. ... If you build a picture with X size 10, and then in the picture X is = 10, you can't say it's closer to the real thing, it's only matching the parameters you picked. ... while with actual drawings you get a ...
    (rec.arts.sf.composition)
  • 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)