Changeset 887 for trunk/Packages/Common/Image.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Image.php
r874 r887 9 9 class Font 10 10 { 11 var$Size;12 var$FileName;13 var$Color;11 public int $Size; 12 public string $FileName; 13 public int $Color; 14 14 15 15 function __construct() … … 23 23 class Pen 24 24 { 25 var$Color;26 var$X;27 var$Y;25 public int $Color; 26 public int $X; 27 public int $Y; 28 28 29 29 function __construct() … … 38 38 class Brush 39 39 { 40 var$Color;40 public int $Color; 41 41 42 42 function __construct() … … 49 49 class Image 50 50 { 51 var $Image; 52 var $Type; 53 var $Font; 54 var $Pen; 51 public $Image; 52 public int $Type; 53 public Font $Font; 54 public Pen $Pen; 55 public Brush $Brush; 55 56 56 57 function __construct() … … 63 64 } 64 65 65 function SaveToFile( $FileName)66 function SaveToFile(string $FileName): void 66 67 { 67 68 if ($this->Type == IMAGETYPE_JPEG) … … 79 80 } 80 81 81 function LoadFromFile( $FileName)82 function LoadFromFile(string $FileName): void 82 83 { 83 84 $ImageInfo = getimagesize($FileName); … … 97 98 } 98 99 99 function Output() 100 function Output(): void 100 101 { 101 102 $this->SaveToFile(NULL); 102 103 } 103 104 104 function SetSize( $Width, $Height)105 function SetSize(int $Width, int $Height): void 105 106 { 106 107 $NewImage = imagecreatetruecolor($Width, $Height); … … 110 111 } 111 112 112 function GetWidth() 113 function GetWidth(): int 113 114 { 114 115 return imagesx($this->Image); 115 116 } 116 117 117 function GetHeight() 118 function GetHeight(): int 118 119 { 119 120 return imagesy($this->Image); 120 121 } 121 122 122 function TextOut( $X, $Y, $Text)123 function TextOut(int $X, int $Y, string $Text): void 123 124 { 124 125 imagettftext($this->Image, $this->Font->Size, 0, $X, $Y, $this->ConvertColor($this->Font->Color), $this->Font->FileName, $Text); 125 126 } 126 127 127 function ConvertColor( $Color)128 function ConvertColor(int $Color): int 128 129 { 129 130 return imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff); 130 131 } 131 132 132 function FillRect( $X1, $Y1, $X2, $Y2)133 function FillRect(int $X1, int $Y1, int $X2, int $Y2): void 133 134 { 134 135 imagefilledrectangle($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Brush->Color)); 135 136 } 136 137 137 function Line( $X1, $Y1, $X2, $Y2)138 function Line(int $X1, int $Y1, int $X2, int $Y2): void 138 139 { 139 140 imageline($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Pen->Color));
Note:
See TracChangeset
for help on using the changeset viewer.