iNET Interactive - Online Advertising Agency
          
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Game Programming > Transparency color


Reply
 
Thread Tools Display Modes
  #1  
Old 10-14-2003, 04:44 PM
samus535's Avatar
samus535 samus535 is offline
Regular
 
Join Date: Aug 2003
Location: Canada
Posts: 93
Default Transparency color

I everyone.
I would like to know how to set the transparency of an image with BitBlt if it's possible. If it's not, I would like to know how to do it.


Thanks
__________________
Samus535
Reply With Quote
  #2  
Old 10-14-2003, 05:10 PM
chibishmoo chibishmoo is offline
Junior Contributor
 
Join Date: Jun 2003
Posts: 225
Default

You need to look into vbSrcAnd , and vbSrcPaint.

Do a search for transparency.
Reply With Quote
  #3  
Old 10-14-2003, 05:55 PM
rpgnewbie's Avatar
rpgnewbie rpgnewbie is offline
Contributor
 
Join Date: Sep 2003
Location: Portland OR
Posts: 581
Default Bitblt Transparency...

"chibishmoo" is right, but the process is a little more complicated than was indicated. The most important (and most tedious) part is you have to create a mask. That's where my handy-dandy "AutoSpriteMaskCreator" comes in. There is version 2 which has 2 modes.

Mode one ("Demo Mode") shows how the biblt-ing is accomplishing using some existing graphics. If you study the code (look under "Private Sub ComposeImages()" on the frmMakCreator form) you'll see the Bitblt commands involved. In this same sub I also included some commented lines showing how to use PaintPicture (a VB friendly "wrapper" for Bitblt) to accomplish the same thing.

Mode two ("Quik Production Mode") allows you to create masks for your own graphics and shows you a sample result against a checkerboard background. Use the enclosed "Rose_medium.bmp" to test if you don't have any graphics files prepared.

In preparation to make a mask for a "sprite" (a picture with a transparent background), make sure the background of your picture is a single, uniform color. I usually use Magenta (RGB 255,0,255), but you can use any color that it not found in the picture itself. My program will use the color of the pixel found in the far upper right corner of your picture as the "transparent" color.

Addtional note the mask file created is the same name as the chosen graphics file with "_mask" appended (this string is stored in a config file and is changeable (customizable) via the Edit menu on the main form).

If you have any questions let me know...
Attached Files
File Type: zip AutoSpriteMaskCreator2.zip (132.7 KB, 40 views)
Reply With Quote
  #4  
Old 10-15-2003, 03:16 PM
chibishmoo chibishmoo is offline
Junior Contributor
 
Join Date: Jun 2003
Posts: 225
Default

Yeh sorry for the short reply, but I had to go.

Im going to look into this auto sprite maker thing. Its always the most tedious part.

Thanks man
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color keys, Transparency works in 32bpp, not in 16bpp Commodore DirectX 4 01-04-2003 08:55 AM
Problems with steganography and color depth dprofancik General 0 11-04-2002 08:47 AM
MSFlex Grid color settings Habi General 9 01-14-2002 11:31 AM
RGB Color from Hex Color? grashopper General 2 06-08-2001 10:29 AM
List of color codes? CornMaster General 5 03-14-2001 10:04 AM

Advertisement: