I tried a code for rotating an image which I found
here in the German Forum.
Is it true, that the used API routine PlgBlt_() has
a limit in size which it can handle or did I do some-
thing wrong?
In my observations it looks like the boundary is a
size of 2^23 pixel. On MSDN is no limit mentionend.
PlgBlt_() does not return an error.
I modified the original code a little bit to demonstrate
the limit.
There are now 2 images: one just below 2^23 and
a second just above this limit. The first image has
a square, the second a circle in the upper left corner.
The button in the middle switches between these
two images.
Code: Select all
Procedure Bilddrehen(image,rl)
hh = ImageHeight(image)
br = ImageWidth(image)
If hh > br
tmp = CreateImage(#PB_Any,hh,hh)
Else
tmp = CreateImage(#PB_Any,br,br)
EndIf
Dim p.point(2)
If rl
p(0)\x=hh
p(0)\y=0
p(1)\x=hh
p(1)\y=br
p(2)\x=0
p(2)\y=0
Else
p(0)\x=0
p(0)\y=br
p(1)\x=0
p(1)\y=0
p(2)\x=hh
p(2)\y=br
EndIf
dc = StartDrawing(ImageOutput(tmp))
DrawImage(ImageID(image),0,0)
debug PlgBlt_(dc,p(),dc,0,0,br,hh,0,0,0)
StopDrawing()
imgnr = GrabImage(tmp,#PB_Any,0,0,hh,br)
FreeImage(tmp)
ProcedureReturn imgnr
EndProcedure
; CreateImage(1, 3257, 2575)
; CreateImage(2, 3258, 2576)
CreateImage(1, 2896, 2896)
CreateImage(2, 2897, 2897)
StartDrawing(ImageOutput(1))
Box( 10,10,100,100, $ffffff)
StopDrawing()
StartDrawing(ImageOutput(2))
Circle( 60,60,50, $ffffff)
StopDrawing()
imgnr=1
OpenWindow(0,0,0,600,500,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ww = WindowWidth(0)
butL = ButtonGadget(#PB_Any, 20, 10, 80, 25, "left")
butR = ButtonGadget(#PB_Any, ww-100, 10, 80, 25, "right")
butS = ButtonGadget(#PB_Any, ww/2-40, 10, 80, 25, "Switch",#PB_Button_Toggle)
butI = ImageGadget(#PB_Any,10,45,0,0,ImageID(imgnr))
DisableGadget(butI,1)
Repeat
event = WaitWindowEvent()
If event = #PB_Event_Gadget Or Event = #PB_Event_Menu
welcherButton = EventGadget()
Select welcherButton
Case butL
imgnr = Bilddrehen(imgnr,0)
SetGadgetState(butI, ImageID(imgnr))
Case butR
imgnr = Bilddrehen(imgnr,1)
SetGadgetState(butI, ImageID(imgnr))
Case butS
imgnr=GetGadgetState(butS)+1
SetGadgetState(butI, ImageID(imgnr))
EndSelect
EndIf
Until event = #PB_Event_CloseWindow
End