RE: Alpha Blending with EuAllegro
- Posted by Brian Broker <bkb at cnw.com> Jul 09, 2004
- 517 views
I wrote: > > Lewis Townsend wrote: > > > > > > Howdy Brian Broker > > > > >.. transparency in a percentage or something. > > > I'll check it out and get back > > > to you (likely after the holiday). > > > > Ok, its after the 4th of July. or was that not the holiday you were > > talking about ;-P > > > > > I lost interest because it didn't seem like many others had much > > > interest > > > (and I think that's also why Ray lost interest...). > > > > Well, I'm interested since Euallegro seems to be the best solution to my > > > > > > graphics needs. > > > > > I'll swing my focus back that way and see what I can do to help. >Maybe > > > > > > > > > you can help me revive this nice platform for Eu. > > > > I'll try. > > Do you think I should release demos of my game every time I make a major > > > > > > advancement? > > It might help with public awareness of the Euallegro library. :) > > > > later, > > LewyT > > My bad, I got caught up in some Win32Lib testing again. As far as > releasing demos... I wouldn't mind a preview to see if I can easily > convert it to my version of the lib. It might also help me to figure > out the best solution for what you want to do. > > Thanks, > -- Brian > Well, since I haven't heard back from you, I'll assume your program isn't ready for consumption. Playing with my Allegro wrapper I came up with the following. There might be a better way but this seemed to at least work:
-- note: alpha is a value between 0 and 255 -- procedure stretch_trans_sprite( atom bmp, atom sprite, integer x, integer y, integer size, integer alpha ) integer nx, ny atom newsprite nx = bitmap_w(sprite)*size ny = bitmap_h(sprite)*size newsprite = create_bitmap( nx, ny ) clear_to_color( newsprite, getpixel(sprite,0,0) ) stretch_sprite( newsprite, sprite, 0, 0, nx, ny ) set_trans_blender(0,0,0,alpha) draw_trans_sprite( bmp, newsprite, x, y ) destroy_bitmap( newsprite ) end procedure
Let me know if this suits your needs... -- Brian