-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xojo_code
More file actions
43 lines (33 loc) · 1.46 KB
/
Copy pathApp.xojo_code
File metadata and controls
43 lines (33 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#tag Class
Protected Class App
Inherits Application
#tag Method, Flags = &h0
Function ProportionalScale(Pic as Picture, Width as integer, Height as Integer) As Picture
// Calculate scale factor
Dim factor As Double = Min( Height / Pic.Height, Width / Pic.Width )
// Calculate New Size
Dim w As Integer = pic.Width * factor
Dim h As Integer = pic.Height * factor
// Create New Picture
Dim NewPic As New Picture( w, h )
// Draw picture in the new size
NewPic.Graphics.DrawPicture( Pic, 0, 0, w, h, 0, 0, Pic.Width, Pic.Height )
// Return Scaled Image
Return NewPic
End Function
#tag EndMethod
#tag Constant, Name = kEditClear, Type = String, Dynamic = False, Default = \"&Delete", Scope = Public
#Tag Instance, Platform = Windows, Language = Default, Definition = \"&Delete"
#Tag Instance, Platform = Linux, Language = Default, Definition = \"&Delete"
#tag EndConstant
#tag Constant, Name = kFileQuit, Type = String, Dynamic = False, Default = \"&Quit", Scope = Public
#Tag Instance, Platform = Windows, Language = Default, Definition = \"E&xit"
#tag EndConstant
#tag Constant, Name = kFileQuitShortcut, Type = String, Dynamic = False, Default = \"", Scope = Public
#Tag Instance, Platform = Mac OS, Language = Default, Definition = \"Cmd+Q"
#Tag Instance, Platform = Linux, Language = Default, Definition = \"Ctrl+Q"
#tag EndConstant
#tag ViewBehavior
#tag EndViewBehavior
End Class
#tag EndClass