Dirk Geppert wrote: ↑Mon Sep 11, 2023 10:54 amBut how can I load that svg with my prefered size?
I'm not sure if I understand you correctly, but you can run ResizeImage().
Code: Select all
Procedure Loaded(Type, Filename$, ObjectId)
; Display the image in a new window
OpenWindow(0, 10, 10, 400, 400, "Image", #PB_Window_SizeGadget)
ResizeImage(0, 300, 300)
ImageGadget(0, 10, 10, ImageWidth(0), ImageHeight(0), ImageID(0))
EndProcedure
Procedure LoadingError(Type, Filename$, ObjectId)
Debug Filename$ + ": loading error"
EndProcedure
; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loaded())
BindEvent(#PB_Event_LoadingError, @LoadingError())
LoadImage(0, "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg")
Code: Select all
Enumeration
#Window
EndEnumeration
Enumeration
#ImageGadget
#ButtonGadget
EndEnumeration
Enumeration
#Image
EndEnumeration
Procedure ButtonGadgetEvent()
If GetGadgetText(#ButtonGadget)="Bigger"
ResizeImage(#Image, 300, 300)
SetGadgetText(#ButtonGadget, "Smaller")
Else
ResizeImage(#Image, 150, 150)
SetGadgetText(#ButtonGadget, "Bigger")
EndIf
SetGadgetState(#ImageGadget, ImageID(#Image))
EndProcedure
Procedure Loaded(Type, Filename$, ObjectId)
; Display the image in a new window
OpenWindow(#Window, 10, 10, 400, 400, "Image", #PB_Window_SizeGadget)
ImageGadget(#ImageGadget, 10, 10, ImageWidth(#Image), ImageHeight(#Image), ImageID(#Image))
ButtonGadget(#ButtonGadget, 10, WindowHeight(#Window) - 40, 100, 30, "Bigger")
BindGadgetEvent(#ButtonGadget, @ButtonGadgetEvent())
EndProcedure
Procedure LoadingError(Type, Filename$, ObjectId)
Debug Filename$ + ": loading error"
EndProcedure
; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loaded())
BindEvent(#PB_Event_LoadingError, @LoadingError())
LoadImage(#Image, "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg")