1 define <export> {
2 IMAGE_DEPTH_AS_DESKTOP = 128
3 IMAGE_FORMAT_BMP = 0
4 IMAGE_FORMAT_JPG = 1195724874
5 }
6
7 type Image <inherit = GAPI_Object>:
8
9 operator Image = (Image left right){
10 left.id = right.id
11 return left
12 }
13
14 method int Image.Catch(int Mem){
15 this.id = Image_Catch(Mem)
16 return this.id
17 }
18 method int Image.Catch(int Mem Length){
19 this.id = Image_CatchEx(Mem,Length)
20 return this.id
21 }
22 method Image Image.Dublicate(){
23 Image i
24 i.id = Image_Copy(this.id)
25 return i
26 }
27 method int Image.Create(int Width Height){
28 this.id = Image_Create(Width, Height, $IMAGE_DEPTH_AS_DESKTOP)
29 return this.id
30 }
31 method int Image.Create(int Width Height Depth){
32 this.id = Image_Create(Width, Height, Depth)
33 return this.id
34 }
35 method Image.Free(){
36 Image_Free(this.id)
37 }
38 property int Image.Depth{
39 return Image_GetDepth(this.id)
40 }
41 property int Image.Width{
42 return Image_GetWidth(this.id)
43 }
44 property Image.Width(int width){
45 Image_Resize(this.id,width,Image_GetHeight(this.id))
46 }
47 property int Image.Height{
48 return Image_GetHeight(this.id)
49 }
50 property Image.Height(int height){
51 Image_Resize(this.id,Image_GetWidth(this.id),height)
52 }
53 property int Image.Exist{
54 return Image_Exist(this.id)
55 }
56 method Image.Grab(Image Source, int x y){
57 if this.Exist : this.Free() :
58 this.id = Image_Grab(Source.id,x,y,Source.Width,Source.Height)
59 }
60 method Image.Grab(Image Source, int x y width){
61 if this.Exist : this.Free() :
62 this.id = Image_Grab(Source.id,x,y,width,Source.Height)
63 }
64 method Image.Grab(Image Source, int x y width height){
65 if this.Exist : this.Free() :
66 this.id = Image_Grab(Source.id,x,y,width,height)
67 }
68 property int Image.Handle{
69 return Image_GetHandle(this.id)
70 }
71 property int Image.Canvas{
72 return Image_GetOutput(this.id)
73 }
74 method Image.Load(str FileName){
75 this.id = Image_Load(FileName.ptr())
76 }
77 method Image.Load(str FileName,int Flags){
78 this.id = Image_LoadEx(FileName.ptr(),Flags)
79 }
80 method Image.Resize(int width height){
81 Image_Resize(this.id,width,height)
82 }
83 method int Image.Save(str FileName, int Format){
84 return Image_Save(this.id,FileName.ptr(),Format,10)
85 }
86 method int Image.SaveBMP(str FileName){
87 return Image_Save(this.id,FileName.ptr(),$IMAGE_FORMAT_BMP,0)
88 }
89 method int Image.SaveJPG(str FileName){
90 return Image_Save(this.id,FileName.ptr(),$IMAGE_FORMAT_JPG,10)
91 }
92 method int Image.SaveJPG(str FileName, int Quality){
93 return Image_Save(this.id,FileName.ptr(),$IMAGE_FORMAT_JPG,Quality)
94 }
95 method Image.DrawAlpha(int x y){
96 g2d_DrawAlphaImage(this.Handle,x,y)
97 }
98 method Image.Draw(int x y){
99 g2d_DrawImage(this.Handle,x,y,this.Width,this.Height)
100 }
101 method Image.Draw(int x y width height){
102 g2d_DrawImage(this.Handle,x,y,width,height)
103 }
104