All this works for me
Regards,



Code: Select all
imageid = X2D_ExtracAlphaChannel( #ID, PNGfilename.s )
Code: Select all
;===========================================================================
;-CONSTANTS
;===========================================================================
#APP_NAME = "Window Template"
Enumeration
#WINDOW_ROOT
EndEnumeration
;===========================================================================
;-GLOBAL FLAGS / VARIABLES / STRUCTURES / ARRAYS
;===========================================================================
;Get the background colour of the windows
BackgroundColour = GetSysColor_(#COLOR_3DFACE)
;===========================================================================
;-PROCEDURES
;===========================================================================
;Handle an error
Procedure HandleError(Result, Text.s)
If Result = 0 : MessageRequester("Error", Text, #PB_MessageRequester_Ok) : End : EndIf
EndProcedure
;===========================================================================
;-MEDIA
;===========================================================================
LoadImage(2, "Passport.bmp")
LoadImage(3, "AlphaChannel.bmp")
;Set the alpha channel to the image
X2D_SetAlphaChannel(UseImage(2), UseImage(3))
;===========================================================================
;-GEOMETRY
;===========================================================================
HandleError(OpenWindow(#WINDOW_ROOT, 0, 0, 400, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, #APP_NAME), "Main window could not be created.")
;Create an image to draw the transparent sprite onto
CreateImage(1, 400, 300)
;Display the image on a gadget
CreateGadgetList(WindowID(#WINDOW_ROOT))
ImageGadget(1, 0, 0, 400, 300, UseImage(1))
;===========================================================================
;-MAIN LOOP
;===========================================================================
Repeat
UseImage(1)
StartDrawing(ImageOutput())
;Fill that image with the correct colour to make it look like part of the window
Box(0, 0, 400, 300, BackgroundColour)
;Draw the image containing the alpha channel
X2D_DrawAlphaImage(UseImage(2), WindowMouseX(), WindowMouseY(), 255, #X2D_AlphaMask)
StopDrawing()
SetGadgetState(1, UseImage(1))
EventID.l = WindowEvent()
Select EventID
EndSelect
Delay(1)
Until EventID = #PB_Event_CloseWindow
End
;===========================================================================
;-BINARY INCLUDES
;===========================================================================
You mean reading in a PNG and extracting the information of the Alpha-Channel? Could be done, though I don't know how complicated the PNG format is. Have to read the specifications about that.eddy wrote:a aplha extractor would be cool.
It's such a pity that PB can't read alpha information :roll:
Anymore news on this im still getting the TB_INCLUDEFONT error.El_Choni wrote:Hmm... weird problem (about TB_INCLUDEFONT),I ll check it when I m back. Having a great time, right now in Budapest, conmemorating their 1000 annyversary with fireworks, beer, and what not. It s a pity they speak such an odd language Cya