Graphics w/Transparent Backgrounds

Just starting out? Need help? Post your questions and find answers here.
Gnome
New User
New User
Posts: 4
Joined: Tue Feb 21, 2006 5:24 am
Location: St. Louis, Missouri, United States

Graphics w/Transparent Backgrounds

Post by Gnome »

:roll: I'm a complete newbie and am trying to learn PureBasic. I've searched the forums but cannot find an answer (much less a simple one) that will tell me how to do the following ... please help:

I'm using the "Image Gadget" in the Visual Designer to get a graphic. If the image done in Photoshop has a transparent background, why wouldn't it in in designer?

What do I need to get rid of any background colors on images? :oops:

Many thanks to all in this great forum!
Kevin.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Hello, Gnome:

If you use a .png image or a .tiff image, alpha transparency will be displayed correctly when you use the command DrawAlphaImage() to display the graphic. You will have to use the appropriate decoder as well:

Code: Select all

UsePNGImageDecoder()
CatchImage(0, ?pic)
OpenWindow(0,0,0,320,240,#PB_Window_SystemMenu,"My Window")
StartDrawing(WindowOutput(0))
  DrawAlphaImage(ImageID(0),0,0)
StopDrawing()
Repeat
  EventID=WaitWindowEvent(1)
Until EventID=#PB_Event_CloseWindow

DataSection
  pic: IncludeBinary "MyImage.png"
EndDataSection
afaik the ImageGadget doesn't manage alpha transparency for now (I think)
BERESHEIT
Gnome
New User
New User
Posts: 4
Joined: Tue Feb 21, 2006 5:24 am
Location: St. Louis, Missouri, United States

Post by Gnome »

Thank you for your fantastic help ... I shall try it out as soon as possible!

May I ask what you mean by 'alpha transparency?' :oops:

And, say I use a .TIF or .PNG image ... what do I do with these graphics? (i.e., make a clipping path?, remove the background in Photoshop so that it's transparent?, save it any particular way?)

:wink: Thank you again for your most appreciated help!

Regards,
Kevin.
Straker
Enthusiast
Enthusiast
Posts: 701
Joined: Wed Apr 13, 2005 10:45 pm
Location: Idaho, USA

Post by Straker »

Gnome wrote:May I ask what you mean by 'alpha transparency?' :oops:
http://en.wikipedia.org/wiki/Alpha_transparency
Gnome wrote:remove the background in Photoshop so that it's transparent?, save it any particular way?
Yes
Gnome
New User
New User
Posts: 4
Joined: Tue Feb 21, 2006 5:24 am
Location: St. Louis, Missouri, United States

THANKS!

Post by Gnome »

:D I'm humbled by the great support that everyone provides within this forum. Thank you!
Keep away from people who try to belittle your ambitions. Small people always do that, but the really great make you feel that you, too, can become great.
~ Mark Twain
garretthylltun
Enthusiast
Enthusiast
Posts: 346
Joined: Wed Oct 26, 2005 2:46 am
Contact:

Post by garretthylltun »

What about for toolbar images and image buttons?

-Garrett
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
· Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
· http://www.freewarehome.com/ <-- Freeware listings since 1996
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

For those use 32-bit icons.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

You can allways use transparent background icons to make them look professiional ;).
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Post Reply