Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Need help in "Masking" or whatever its called.  (Read 2120 times)
Magnum357jhp
Community Member
*
Posts: 124


« on: December 15, 2009, 06:03:16 PM »

I was hoping someone could help me out here.  What I want to do in a project (with VB6) is to setup certain opjects in a 2D enviroment (no 3D) where the object displays in certain regions on a map (looking down).  What I'm having a problem with is that the .bmp files for the opbjects have "spaces" that I don't want to display in the project.  For example, a .bmp of a planet where it is placed in a nebular or some cloud background, but the edges of the .bmp (say white in this instance) still show up when displayed on the nebula background. 

Does anyone have any suggestions on how to "mask" the white part of the .bmp object so it doesn't show up (transperent) when displayed?  I'm at a lose on how to do this.
Logged

"There is no such thing as the ultimate programming language.  Every language has its weaknesses."
uncasid
Community Member
*
Posts: 109


« Reply #1 on: December 15, 2009, 06:26:46 PM »

use a transparent type of image (ie, DDS / PNG)... or set the key.

http://www.truevision3d.com/forums/tv3d_sdk_65/how_can_i_draw_a_texture_with_alpa_transparency-t19075.0.html

http://wiki.truevision3d.com/tutorialsarticlesandexamples/making_dds_textures_for_use_with_truevision

Above all, use the search function on the site  Wink
Logged
Magnum357jhp
Community Member
*
Posts: 124


« Reply #2 on: December 16, 2009, 04:30:55 AM »

Ok, Ill look into using some sort of transparent image file (never really messed with one before).  I forgot to mention that this project is using ONLY VB6, there is no truevision3d involved.  Does anyone have an examples of just VB6 with transparent image files?
Logged

"There is no such thing as the ultimate programming language.  Every language has its weaknesses."
nicolas
Community Member
*
Posts: 157


« Reply #3 on: January 25, 2010, 05:31:03 AM »

Easiest way in pure vb6:

-use an imagebox (no picturebox!)
-make a GIF with fully transparent part where you want it to be transparent

You can make this gif using the free paint.net. Select the part you want to be transparent (the magic wand selector is handy for this) and press delete to make transparent, next save as gif.

Using an imagebox, you can optionally even use the stretch property (just set to true in properties) of the imagebox and your transparent image will resize with the size of the imagebox.
Logged
Mithrandir
Community Member
*
Posts: 325


« Reply #4 on: January 25, 2010, 07:13:06 AM »

Google BitBlt function for VB6.
It allows you to blend images.
Logged
Raul
Customers
Community Member
*****
Posts: 550

I like games.


WWW
« Reply #5 on: January 25, 2010, 07:57:30 AM »

old VB6 :X
BitBlt is the fastest and usefull way for anything regarding painting..

Code:
Public Declare Function BitBlt Lib"gdi32" (ByVal hDestDC As Long, ByVal X As Long,_
       ByVal Y As Long, ByVal nWidth As Long, _
       ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc _
       As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

and to Draw:
Code:
BitBlt frmBitBlt.Picture, 50, 50, 300, 300, frmBitBlt.Land.Picture, 0, 0, vbSrcCopy

More details here:
Code:
http://www.vbforums.com/showthread.php?t=271014
Logged

nicolas
Community Member
*
Posts: 157


« Reply #6 on: January 26, 2010, 01:59:34 PM »

Bilblt is a bit more "hardcore" Wink ; my method of using a pure and simple gif in an imagebox is the easiest way to accomplish the effect. Don't use it for a moving 2D player or something though, as you'll get an epileptic attack from the screen flickering. But for more static functions, it's fine.

Not as good as BitBlt, but not as complicated eiither. Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks