|
-
Apr 19th, 2002, 07:33 AM
#1
Thread Starter
Fanatic Member
certain color to background?
I was just wondering how you can make a bitmap image not cover the background. umm.. like.. if u had a picture of a circle, you wouldn't have the square of color around it, to make the game look better, and to LET ME USE A BACKGROUND (argh!!!)
Don't pay attention to this signature, it's contradictory.
-
Apr 19th, 2002, 07:39 AM
#2
Hyperactive Member
Use a gif instead of a bitmap. Not only will this allow you to have transparent backgrounds, it will also take up much less space file size.
-Show me on the doll where the music touched you.
-
Apr 19th, 2002, 08:01 AM
#3
Thread Starter
Fanatic Member
movie file?
a .gif is a movie-like file isn't it?? (and uh, what do I use to make em). I've also seen programs that used bitmaps where a certain color didn't go, to allow to see background.
Don't pay attention to this signature, it's contradictory.
-
Apr 19th, 2002, 08:04 AM
#4
Hyperactive Member
1: A .gif is not a movie file. It's another type of picture
2: Use Ms Paint or any imaging program to make them
-Show me on the doll where the music touched you.
-
Apr 19th, 2002, 10:10 AM
#5
Fanatic Member
To create "transperant" bitmaps, read the next two paragraphs.
If your using directx, use an alpha mask. If your using bitblt, use a mask.
For bitblt, the mask would be gray-scale (most commonly b&w). The darker it is, the less visiable the background. Use srcAnd to paint the mask, and srcPaint to paint the main image (sprit).
If you are using image boxs, use gifs. If you happen to have photoshop, it can create gifs. Gifs can be animated, but it is not required.
Hope this helps.
-
Apr 19th, 2002, 12:35 PM
#6
Thread Starter
Fanatic Member
mask?
ok... so I paint back of the bitmap with srcand and the front with srccopy, but... how does vb know what's back and what's front?
Don't pay attention to this signature, it's contradictory.
-
Apr 19th, 2002, 03:38 PM
#7
Fanatic Member
You need two differnt images (or differnt parts of the image). With bitblt (it may work with paintpicture too), you speicify the locations, and area to copy. One of the images is the actual image to display (with a white background), and the other is the mask (lighter = more transpartent). You then use srcAnd on the mask, and srcCopy on the image.
-
Apr 19th, 2002, 05:32 PM
#8
Good Ol' Platypus
Mmm, no. You use vbSrcAnd on the mask source, and vbSrcPaint on the sprite source. If you have a non-black background this will not work unless you blit the mask on with vbMergePaint and the Sprite with vbSrcAnd. However the partial transparency will not work with this second method.
If you ever need a resource, I had a "BitBlt Case Studies" a while ago, that nobody ever used. Maybe I could get it stickied
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Apr 19th, 2002, 05:44 PM
#9
Fanatic Member
Oops, I wrote it wrong the second time
-
Apr 22nd, 2002, 10:13 AM
#10
Junior Member
If you have Adobe it is a great program for converting any tipe of picture to gif. and making it transparent..
e=2.718281828459045235360287471352662497757247093699959574
-
Apr 22nd, 2002, 11:00 AM
#11
Thread Starter
Fanatic Member
hurrah! (white flicker?)
I used paint.picture to do it
I never realied u guys meant make a white area over where the image would be and black for the back (i did all white/black for awhile ) but I got it, only prob is there's a white flicker when I place the image because of the mask, any ideas?
Don't pay attention to this signature, it's contradictory.
-
Apr 22nd, 2002, 11:13 AM
#12
Fanatic Member
One of two ways that I have heard work:
1) paint them on to a back buffer, then copy them to the visable image. Make sure that the back buffer has autoredraw on.
2) turn on auto redraw, then use picture1.refresh to make the image visable.
Make sure to only do the copy/refresh after the whole frame has been drawn.
-
Apr 22nd, 2002, 11:42 AM
#13
Thread Starter
Fanatic Member
back buffer?
back buffer? and wont that kinda cause the background to go solid again? Making it a big pointless circle.... hmm...
Don't pay attention to this signature, it's contradictory.
-
Apr 22nd, 2002, 11:54 AM
#14
Fanatic Member
You paint the whole frame to the back buffer, then copy it to the front buffer. The other way is to turn autoredraw on the front/only buffer, then refresh that picture box. In this way, the new frame woun't be visable until it is intirely drawn.
-
Apr 22nd, 2002, 12:06 PM
#15
Thread Starter
Fanatic Member
Allow me to repeat...
back buffer? what's the back buffer?
Don't pay attention to this signature, it's contradictory.
-
Apr 22nd, 2002, 12:21 PM
#16
Fanatic Member
Two ways, both with code below:
1) To use that way, you need 2 picture boxes. One is the front buffer (no autoredraw), and the other is the back buffer (with autoredraw). You draw everything to the back buffer (in order: background [srccopy], mask [srcand], then sprite [srcpaint]), then copy the backbuffer to the frontbuffer [srccopy].
2) You can also turn autoredraw on the frontbuffer (you woun't need a backbuffer this way), then refresh the picture box after you finish drawing the frame (in order: background [srccopy], mask [srcand], then sprite [srcpaint]).
The following code assumes that the backbuffer is named backbuffer, the mask is named mask, the sprite is named image, and the frontbuffer is named frontbuffer. it also asumes that all the images are in differnt picture boxes. All the images need to be in picture boxes, you may combine the image and mask, changing the source xs, ys, and hdcs. The declation can be found in the API viewer (as it is not installed on the computer I am currently using).
1) This code requires a back buffer.
VB Code:
bitblt backbuffer.hdc, 0,0,backbuffer.scalewidth, backbuffer.scaleheight, background.hdc,0,0, srccopy
bitblt backbuffer.hdc, X,Y,mask.scalewidth, mask.scaleheight, mask.hdc,0,0, srcand
bitblt backbuffer.hdc, 0,0,image.scalewidth, image.scaleheight, image.hdc,0,0, srcpaint
bitblt frontbuffer.hdc, 0,0,backbuffer.scalewidth, backbuffer.scaleheight, backbuffer.hdc,0,0, srccopy
2) This code doesn't need a backbuffer.
VB Code:
bitblt frontbuffer.hdc, 0,0,frontbuffer.scalewidth, frontbuffer.scaleheight, background.hdc, srccopy
bitblt frontbuffer.hdc, X,Y,mask.scalewidth, mask.scaleheight, mask.hdc, srcand
bitblt frontbuffer.hdc, 0,0,image.scalewidth, image.scaleheight, image.hdc, srcpaint
frontbuffer.refresh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|