 |
 |

02-19-2004, 05:40 AM
|
|
Newcomer
|
|
Join Date: Feb 2004
Posts: 3
|
|
how to change colors in graphic in VB 6 ???
|
hello,
iīve got a problem in my vb6 control with a graphic and really donīt know how to do this.
i would like to implement a car driver graphic (pixel or vector, it depends whatīs easier) where i would like to change dynamically the color of the head, chest, left leg,...
a sample graphic you can find here:
http://www.euroncap.com/assets/graph...ont_driver.gif
i tired to do it with alpha channels and masks, but couldnīt find out how to do it.
an other way i was thinking if itīs easier to use a vektor graphic? but how would this work?
i need to have about 3-4 graphics like this to implement, so it would be nice if the solution would be quite simple.
has anybody experience or an idee with this?
thanks a lot,
patxi
|
|

02-19-2004, 07:37 AM
|
 |
Coder of Fortune
Retired Leader * Expert *
|
|
Join Date: Dec 2002
Location: Troy, NY USA
Posts: 3,120
|
|
If you create mask images for each region of the image that you want to color seperately, you can use normal and/or masking techniques. The basic idea is to lay down a block of color on a scratch surface, and AND it with a mask that has white where you want the color. You AND the target with the inverse of this mask, and then OR the scratch surface to the image. Best method is usually BitBlt using the appropriate RasterOp constant.
|
__________________
-- The Gavster
Like to IRC? Try irc.randomirc.com
GavServer
|

02-19-2004, 12:59 PM
|
|
Newcomer
|
|
Join Date: Feb 2004
Posts: 3
|
|
Quote: Originally Posted by GavinO If you create mask images for each region of the image that you want to color seperately, you can use normal and/or masking techniques. The basic idea is to lay down a block of color on a scratch surface, and AND it with a mask that has white where you want the color. You AND the target with the inverse of this mask, and then OR the scratch surface to the image. Best method is usually BitBlt using the appropriate RasterOp constant.
hey thanks,
now i know, why iīm called a "Newcomer" and GavinO is called an "Expert" !
sound quite interesting what you have written. but sounds quite complicated as well (for me).
i think i have to play around with the link you gave & read and read your message again...
thanks, but iīm not sure if i will get this...
at the link you gave, the say something about a rectangle:
"The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context."
does it mean that i will have problems if i have oval mask (head ...)?
thx,
Patxi
|
|

02-19-2004, 01:30 PM
|
 |
Coder of Fortune
Retired Leader * Expert *
|
|
Join Date: Dec 2002
Location: Troy, NY USA
Posts: 3,120
|
|
|
The reason that you create the mask is to allow you to fill any shape using a rectangular blit area. Only the pixels on the mask that are white will be filled with the color, while the black ones will be left as they are (I am refering to the mask applied to the colored rectangle; the process is opposite for the one applied to the destination image). I've attached an image that sort of explains the process.
|
__________________
-- The Gavster
Like to IRC? Try irc.randomirc.com
GavServer
Last edited by GavinO; 02-19-2004 at 01:56 PM.
Reason: Corrected error in image
|

02-20-2004, 01:15 PM
|
|
Newcomer
|
|
Join Date: Feb 2004
Posts: 3
|
|
Hello GavinO,
thanks for all. i understood what you meant now.
i found some classes at vbAccelerator and used a sample from there ( http://www.vbaccelerator.com/home/VB...ng/article.asp ).
itīs a bit easier for me to write the code. the prinziples are based on the stuff you tried to explain me.
thx,
Patxi
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|