Fair enough, here is a snippet that will let you use the PNG version without problem:
Code: Select all
Procedure StringToBStr (string$) ; By Zapman Inspired by Fr34k
Protected Unicode$ = Space(Len(String$)* 2 + 2)
Protected bstr_string.l
PokeS(@Unicode$, String$, -1, #PB_Unicode)
bstr_string = SysAllocString_(@Unicode$)
ProcedureReturn bstr_string
EndProcedure
ProcedureDLL LoadDecodedImage(Filename$)
CompilerIf Defined(GdiplusStartupInput, #PB_Structure) = 0
Structure GdiplusStartupInput
GdiPlusVersion.l
*DebugEventCallback.Debug_Event
SuppressBackgroundThread.l
SuppressExternalCodecs.l
EndStructure
CompilerEndIf
OpenLibrary(0, "gdiplus.dll")
input.GdiplusStartupInput
input\GdiPlusVersion = 1
CallFunction(0, "GdiplusStartup", @*token, @input, #Null)
CallFunction(0, "GdipCreateBitmapFromFile", StringToBStr(Filename$), @*image)
CallFunction(0, "GdipGetImageWidth", *image, @Width.l)
CallFunction(0, "GdipGetImageHeight", *image, @Height.l)
CallFunction(0, "GdipCreateHBITMAPFromBitmap", *image, @imageid.l, -1)
CallFunction(0, "GdipDisposeImage", *image)
CallFunction(0, "GdiplusShutdown", *token)
CloseLibrary(0)
return_imagenumber = CreateImage(#PB_Any, width, height, 32)
StartDrawing(ImageOutput(return_imagenumber))
DrawAlphaImage(imageid,0,0)
StopDrawing()
ProcedureReturn return_imagenumber
EndProcedure
img = LoadDecodedImage("ssqt6.png")
OpenWindow(0,0,0,300,300,"",#PB_Window_ScreenCentered|#PB_Window_BorderLess|#PB_Window_Invisible)
SetWindowLong_(WindowID(0),#GWL_EXSTYLE,GetWindowLong_(WindowID(0),#GWL_EXSTYLE)|#WS_EX_LAYERED)
CreateGadgetList(WindowID(0))
hDC = StartDrawing(ImageOutput(img))
sz.SIZE
sz\cx = ImageWidth(img)
sz\cy = ImageHeight(img)
ContextOffset.POINT
BlendMode.BLENDFUNCTION
BlendMode\SourceConstantAlpha = 255
BlendMode\AlphaFormat = 1
UpdateLayeredWindow_(WindowID(0), 0, 0, @sz, hDC, @ContextOffset, 0, @BlendMode, 2)
StopDrawing()
ImageGadget(0,0,0,0,0,ImageID(img))
HideWindow(0,0)
Repeat:E=WaitWindowEvent():Delay(5):Until(E=#PB_Event_CloseWindow):End