I have an image with some power-pink pixels that i'm blitting onto another bitmap with dsb_bitmap_blit.
The power pink stays pink and is not made transparent. Also, alpha images don't retain their transparency either, the trans bits are rendered white.
Is this a bug or am I doing something wrong?
Transparency with dsb_bitmap_blit?
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Sophia
- Concise and Honest
- Posts: 4239
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Transparency with dsb_bitmap_blit?
This is intended; dsb_bitmap_blit is "dumb" and is solely for copying bitmaps.
If you want to actually have these features, dsb_bitmap_draw is the command you want.
If you want to actually have these features, dsb_bitmap_draw is the command you want.
- Gambit37
- Should eat more pies
- Posts: 13714
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Transparency with dsb_bitmap_blit?
Ah, but I want to draw only part of the bitmap (width based on a dynamic value) and dsb_bitmap_draw doesn't seem to support all those extra parameters found in dsb_bitmap_blit?
- Sophia
- Concise and Honest
- Posts: 4239
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Transparency with dsb_bitmap_blit?
This is actually a limitation of Allegro 4; for some reason it only lets you apply the vast majority of effects (like alpha blending etc.) to bitmaps if you draw the whole thing. Of course, there are ways around that (you could do it yourself, even, by using these two drawing functions in combination) but it would be faster and simpler to just have DSB do it automatically. So, I can add the extra parameters as optional ones.
- Gambit37
- Should eat more pies
- Posts: 13714
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Transparency with dsb_bitmap_blit?
Ooh, that would be great, thanks.
Out of interest, what would be the way of doing it using current functions? I can't quite get my head around it. Would I create a new bitmap, render the full width, then use that as the source for the blit function? Do I have to do the first part off screen or something?
EDIT: I sort of got it to work, but the transparent parts flicker:
Out of interest, what would be the way of doing it using current functions? I can't quite get my head around it. Would I create a new bitmap, render the full width, then use that as the source for the blit function? Do I have to do the first part off screen or something?
EDIT: I sort of got it to work, but the transparent parts flicker:
Code: Select all
b_width = (max_bar_width / xp_levels) * level
bmp_bar = dsb_new_bitmap(b_width, 11)
dsb_bitmap_draw(gfx.selector_statbar1, bmp_bar, 0, 0, false)
dsb_bitmap_blit(bmp_bar, bmp, 0, 0, 350, y, (150/xp_levels) * level , 11)
- Sophia
- Concise and Honest
- Posts: 4239
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Transparency with dsb_bitmap_blit?
You had the right idea, you just got the order wrong.
You dsb_bitmap_blit (i.e., make a dumb copy) of the wanted part onto your temporary bitmap. This will also blindly copy all power pink, alpha channels, and so on. Then you dsb_bitmap_draw your temporary bitmap onto your target, where it will render alpha and so on properly.
You dsb_bitmap_blit (i.e., make a dumb copy) of the wanted part onto your temporary bitmap. This will also blindly copy all power pink, alpha channels, and so on. Then you dsb_bitmap_draw your temporary bitmap onto your target, where it will render alpha and so on properly.
- Gambit37
- Should eat more pies
- Posts: 13714
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Transparency with dsb_bitmap_blit?
Woo hoo, thanks for the pointers, I got it to work
I'm rather enjoying this coding malarkey. I know I'm only doing basic stuff, but it's satisfying getting stuff to work
Code: Select all
bar_width = (max_bar_width / xp_levels) * level
bmp_bar = dsb_new_bitmap(bar_width, 11)
dsb_bitmap_blit(gfx.selector_statbar1, bmp_bar, 0, 0, 0, 0, bar_width, 11)
dsb_bitmap_draw(bmp_bar, bmp, 350, y, false)
- Sophia
- Concise and Honest
- Posts: 4239
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Transparency with dsb_bitmap_blit?
It is satisfying getting stuff to work!
I'll still implement the optional parameters for dsb_bitmap_draw, though, so you don't have to mess with this all the time.
I'll still implement the optional parameters for dsb_bitmap_draw, though, so you don't have to mess with this all the time.