Here is code that rotates image.
It works but it cuts away piece of image, no matter the rotation.
`=======================
`=Commandes de réglages=
`=======================
Set Display Mode 800,600,32
Disable EscapeKey
Hide Mouse : Sync On : Sync Rate 0
Color BackDrop RGB(0,0,0)
`=======================
`=Commandes de démarage=
`=======================
Load Image "F:\GTA2Sprites\dummy\Sprite10082.bmp",1
Set Current Bitmap 0
Dim coord(1)
repeat
rotate_image(1,270,2)
Cls 15*56*6
Paste Image 2,400-coord(0),300-coord(1)
Print "FPS : ",Screen FPS()
Sync
until escapekey()=1
delete image 1
end
Function rotate_image(image,angle,rotated)
Dim memblock(1) : Dim position(1) : y=0
For x=1 to 255
If MemBlock Exist(x)=0
memblock(y)=x
Inc y
EndIf
If y=2 Then x=256
Next x
If y<2 Then ExitFunction
Make MemBlock From Image memblock(0),image
angle=WrapValue(angle)
cos_angle#=cos(angle) : cos_90_angle#=cos(90+angle)
sin_angle#=sin(angle) : sin_90_angle#=sin(90+angle)
If angle<90
box_x#=MemBlock DWord(memblock(0),0)*cos_angle#-MemBlock DWord(memblock(0),4)*cos_90_angle#
box_y#=MemBlock DWord(memblock(0),4)*cos_angle#-MemBlock DWord(memblock(0),0)*cos_90_angle#
offset_x#=MemBlock DWord(memblock(0),4)*cos(270+angle) : offset_y#=0
EndIf
If angle>=90 and angle<180
box_x#=MemBlock DWord(memblock(0),0)*cos(180+angle)-MemBlock DWord(memblock(0),4)*cos_90_angle#
box_y#=MemBlock DWord(memblock(0),0)*sin_angle#-MemBlock DWord(memblock(0),4)*sin_90_angle#
offset_x#=box_x# : offset_y#=MemBlock DWord(memblock(0),4)*sin(270+angle)
EndIf
If angle>=180 and angle<270
box_x#=MemBlock DWord(memblock(0),4)*cos_90_angle#-MemBlock DWord(memblock(0),0)*cos_angle#
box_y#=0-MemBlock DWord(memblock(0),0)*sin_angle#-MemBlock DWord(memblock(0),4)*sin_90_angle#
offset_x#=0-MemBlock DWord(memblock(0),0)*cos_angle# : offset_y#=box_y#
EndIf
If angle>=270
box_x#=MemBlock DWord(memblock(0),0)*cos_angle#+MemBlock DWord(memblock(0),4)*cos_90_angle#
box_y#=MemBlock DWord(memblock(0),4)*sin_90_angle#-MemBlock DWord(memblock(0),0)*sin_angle#
offset_x#=0 : offset_y#=0-MemBlock DWord(memblock(0),0)*sin_angle#
EndIf
box_x=box_x# : box_y=box_y#
If (box_x#-box_x)>=.5 Then Inc box_x
If (box_y#-box_y)>=.5 Then Inc box_y
coord(0)=box_x/2 : coord(1)=box_y/2
Make MemBlock memblock(1),12 + box_x * box_y * MemBlock DWord(memblock(0),8)/8
Write MemBlock DWord memblock(1),0,box_x
Write MemBlock DWord memblock(1),4,box_y
Write MemBlock DWord memblock(1),8,MemBlock DWord(memblock(0),8)
mem_step=MemBlock DWord(memblock(0),8)/8
cos_90_angle#=cos(90-angle) : sin_90_angle#=sin(90-angle)
For y=0 To MemBlock DWord(memblock(1),4)-1 : For x=0 To MemBlock DWord(memblock(1),0)-1
rx#=(y-offset_y#)*cos_90_angle#+(x-offset_x#)*cos_angle#
ry#=(y-offset_y#)*sin_90_angle#-(x-offset_x#)*sin_angle#
rx=rx# : ry=ry#
If (rx#-rx)>=.5 Then Inc rx
If (ry#-ry)>=.5 Then Inc ry
If rx>-1 and rx<MemBlock DWord(memblock(0),0) and ry>-1 and ry<MemBlock DWord(memblock(0),4)
position(0)=12+mem_step*(ry*MemBlock DWord(memblock(0),0)+rx)
position(1)=12+mem_step*(y*MemBlock DWord(memblock(1),0)+x)
For octet=0 To mem_step-1
Write MemBlock Byte memblock(1),position(1)+octet,MemBlock Byte(memblock(0),position(0)+octet)
Next octet
EndIf
Next x : Next y
Make Image From MemBlock rotated,memblock(1)
Delete MemBlock memblock(0)
Delete MemBlock memblock(1)
UnDim memblock()
EndFunction
Can somebody look at the function. Maybe there is some error?
I got the code from forum here:
http://forum.thegamecreators.com/?m=forum_view&t=12583&b=4
I attached screenshot. See that black part? It must be bigger.
Piece of it is cut away. Left hand of ped is gone.
Like offset bug or something.
But code works in DBC. But i need this in DBPro