Page 1 of 1

PB supports bmp transparency!!!

Posted: Sat Mar 29, 2008 11:29 am
by Num3
Well i didn't even know bmp could have transparency !
I've found it by accident actually, and it works under pb natively!

Here's the code!

Code: Select all

If InitSprite() And InitSprite3D() And InitKeyboard()
  
  OpenScreen(800,600,32,"bmp transparency!")
  For a=0 To 20
    LoadSprite(a+1,GetCurrentDirectory()+"gfx\p"+RSet(Str(a+1),4,"0")+".bmp",#PB_Sprite_Texture | #PB_Sprite_AlphaBlending)
    CreateSprite3D(a+1,a+1)
  Next
  a=0
  Repeat
    
    ClearScreen(back)
    ;ClearScreen(0)
    
    Start3D() 
      DisplaySprite3D(a+1,200,200,255)
    Stop3D()
    
    FlipBuffers(2)
    
    
    ExamineKeyboard()
    
    If KeyboardReleased(#PB_Key_All)
      End
    EndIf
    
    If ElapsedMilliseconds() - last > 50
      last=ElapsedMilliseconds()
    a+1
    If a>=20
      a=2
      back=RGB(Random(255),Random(255),Random(255))
    EndIf
  EndIf
  ForEver 
  
  
EndIf
Here's a sample package with graphics!

File: 138kb->battle.zip
Image

Posted: Sat Mar 29, 2008 11:44 am
by Dare
Neat. Thanks

Posted: Sat Mar 29, 2008 11:47 am
by Edwin Knoppert
Must be a Vista thing?
I see only plain colors switching

Posted: Sat Mar 29, 2008 11:56 am
by Num3
Edwin Knoppert wrote:Must be a Vista thing?
I see only plain colors switching
Hmmm... That might be so... Going to check that!

Works with alpha here :S (under vista)

Image


--Edit--
Did you download the package with graphics!?

Posted: Sat Mar 29, 2008 12:09 pm
by Num3
After digging around i've discovered bmp alpha transparency exists for quite some time, and that GDI supports it!

It's called Format32bppArgb. It's present in GDI+...

Tech Article here (from 2003)

Posted: Sat Mar 29, 2008 1:34 pm
by Kaeru Gaman
with Sprite3D, Alpha Transparency also works with PNGs
it's a capability of your grafix card when using Sprite3D.

I didn't know that BMP can hold an Alpha channel,
only knew that there is a special BMP format with a designated transparent color.
you could use them in imagegadgets to have a transparent color,
with the VB6 examples such bitmaps were included, but I didn't find a way to create those BMPs.

Posted: Sat Mar 29, 2008 6:54 pm
by Violet
Nice to know, but I do not recommend to use Bitmaps with Alpha Channel. :? That is very special (already read in wiki some time ago), just very few applications can handle it (Photoshop of corse, with GIMP I am not sure).

Posted: Sat Mar 29, 2008 8:27 pm
by Derek
Num3 wrote:
Edwin Knoppert wrote:Must be a Vista thing?
I see only plain colors switching
Hmmm... That might be so... Going to check that!

Works with alpha here :S (under vista)
Yep, works here under Vista Business.

planetary explosion!!! XD

Posted: Fri Jun 20, 2008 3:56 am
by zefiro_flashparty
:shock:
woaa nice effect =)

epileptic kids, not see the example :P

Posted: Fri Jun 20, 2008 2:08 pm
by bobobo
bmp (v4/5) can hold alphachannel und are usable as container for
png / jpeg(fif) formats

look @ http://msdn.microsoft.com/en-us/library/ms532301.aspx

Posted: Fri Jun 20, 2008 3:39 pm
by ricardo
Does IE supports bmp with alpha transparency?

Posted: Mon Jul 07, 2008 7:12 pm
by Violet
I know that Internet Explorer 7 is supporting PNG Images with Transparency (I tested it).