Ignore:
Timestamp:
Aug 3, 2021, 11:20:41 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Used explicit types where possible for better error reporting.
  • Modified: Updated Common packaged to newer version.
  • Modified: Simplified pages title.
  • Added: Simple keyword based spam filter for meet items.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 nbproject
        2 Config.php
        31.settings
        42.project
        53.buildpath
         4.htaccess
  • trunk/Packages/Common/Image.php

    r56 r63  
    99class Font
    1010{
    11   var $Size;
    12   var $FileName;
    13   var $Color;
     11  public int $Size;
     12  public string $FileName;
     13  public int $Color;
    1414
    1515  function __construct()
     
    2323class Pen
    2424{
    25   var $Color;
    26   var $X;
    27   var $Y;
     25  public int $Color;
     26  public int $X;
     27  public int $Y;
    2828
    2929  function __construct()
     
    3838class Brush
    3939{
    40   var $Color;
     40  public int $Color;
    4141
    4242  function __construct()
     
    4949class Image
    5050{
    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;
    5556
    5657  function __construct()
     
    6364  }
    6465
    65   function SaveToFile($FileName)
     66  function SaveToFile(string $FileName): void
    6667  {
    6768    if ($this->Type == IMAGETYPE_JPEG)
     
    7980  }
    8081
    81   function LoadFromFile($FileName)
     82  function LoadFromFile(string $FileName): void
    8283  {
    8384    $ImageInfo = getimagesize($FileName);
     
    8990    if ($this->Type == IMAGETYPE_GIF)
    9091    {
    91       $this->Image = imagecreatefromgif($FileName);
     92      $this->Image = imagecreatefromgif ($FileName);
    9293    } else
    9394    if ( $this->Type == IMAGETYPE_PNG)
     
    9798  }
    9899
    99   function Output()
     100  function Output(): void
    100101  {
    101102    $this->SaveToFile(NULL);
    102103  }
    103104
    104   function SetSize($Width, $Height)
     105  function SetSize(int $Width, int $Height): void
    105106  {
    106107    $NewImage = imagecreatetruecolor($Width, $Height);
     
    110111  }
    111112
    112   function GetWidth()
     113  function GetWidth(): int
    113114  {
    114115    return imagesx($this->Image);
    115116  }
    116117
    117   function GetHeight()
     118  function GetHeight(): int
    118119  {
    119120    return imagesy($this->Image);
    120121  }
    121122
    122   function TextOut($X, $Y, $Text)
     123  function TextOut(int $X, int $Y, string $Text): void
    123124  {
    124125    imagettftext($this->Image, $this->Font->Size, 0, $X, $Y, $this->ConvertColor($this->Font->Color), $this->Font->FileName, $Text);
    125126  }
    126127
    127   function ConvertColor($Color)
     128  function ConvertColor(int $Color): int
    128129  {
    129130    return imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff);
    130131  }
    131132
    132   function FillRect($X1, $Y1, $X2, $Y2)
     133  function FillRect(int $X1, int $Y1, int $X2, int $Y2): void
    133134  {
    134135    imagefilledrectangle($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Brush->Color));
    135136  }
    136137
    137   function Line($X1, $Y1, $X2, $Y2)
     138  function Line(int $X1, int $Y1, int $X2, int $Y2): void
    138139  {
    139140    imageline($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Pen->Color));
Note: See TracChangeset for help on using the changeset viewer.