@@ -21,7 +21,7 @@ Type Utility
21
21
22
22
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
23
23
24
- Function DrawTextWithShadow (text:String , pos:Svec2I , color:Int [] )
24
+ Function DrawTextWithShadow (text:String , pos:SVec2I , color:Int [] )
25
25
SetColor(0 , 0 , 80 )
26
26
DrawText(text, pos[ 0 ] + 1 , pos[ 1 ] + 1 )
27
27
SetColor(color[ 0 ] , color[ 1 ] , color[ 2 ] )
@@ -53,4 +53,38 @@ Type Utility
53
53
Function PointIsWithinBox :Int (point:SVec2I , boxPos:SVec2I , boxSize:SVec2I )
54
54
Return point[ 0 ] >= boxPos[ 0 ] And point[ 0 ] < (boxPos[ 0 ] + boxSize[ 0 ] ) And point[ 1 ] >= boxPos[ 1 ] And point[ 1 ] < (boxPos[ 1 ] + boxSize[ 1 ] )
55
55
EndFunction
56
+
57
+ '////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
58
+
59
+ Function RotatePixmap :TPixmap (sourcePixmap:TPixmap , angle:Int )
60
+ Local outputPixmap:TPixmap
61
+
62
+ 'This is pretty garbage but BlitzMax life is hard
63
+ Select angle
64
+ Case 90
65
+ outputPixmap = CreatePixmap(sourcePixmap.Height, sourcePixmap.Width, sourcePixmap.Format)
66
+ For Local x:Int = 0 Until sourcePixmap.Width
67
+ For Local y:Int = 0 Until sourcePixmap.Height
68
+ WritePixel(outputPixmap, sourcePixmap.Height - y - 1 , x, ReadPixel(sourcePixmap, x, y))
69
+ Next
70
+ Next
71
+ Case 180
72
+ outputPixmap = CreatePixmap(sourcePixmap.Width, sourcePixmap.Height, sourcePixmap.Format)
73
+ For Local x:Int = 0 Until sourcePixmap.Width
74
+ For Local y:Int = 0 Until sourcePixmap.Height
75
+ WritePixel(outputPixmap, sourcePixmap.Width - x - 1 , sourcePixmap.Height - y - 1 , ReadPixel(sourcePixmap, x, y))
76
+ Next
77
+ Next
78
+ Case 270 , - 90
79
+ outputPixmap = CreatePixmap(sourcePixmap.Height, sourcePixmap.Width, sourcePixmap.Format)
80
+ For Local x:Int = 0 Until sourcePixmap.Width
81
+ For Local y:Int = 0 Until sourcePixmap.Height
82
+ WritePixel(outputPixmap, y, sourcePixmap.Width - x - 1 , ReadPixel(sourcePixmap, x, y))
83
+ Next
84
+ Next
85
+ Default
86
+ outputPixmap = sourcePixmap
87
+ EndSelect
88
+ Return outputPixmap
89
+ EndFunction
56
90
EndType
0 commit comments