123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- {
- Free Pascal port of the Hermes C library.
- Copyright (C) 2001-2003 Nikolay Nikolov ([email protected])
- Original C version by Christian Nentwich ([email protected])
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- }
- {Function Hermes_FormatNewEmpty : PHermesFormat;
- Function Hermes_FormatNew(bits : Integer; r, g, b, a : int32;
- indexed : Boolean) : PHermesFormat;
- Procedure Hermes_FormatFree(fmt : PHermesFormat);
- Function Hermes_FormatNewEx(bits : Integer; r, g, b, a : int32;
- indexed, has_colorkey : Boolean;
- colorkey : int32) : PHermesFormat;
- Function Hermes_FormatEquals(op1, op2 : PHermesFormat) : Boolean;
- Procedure Hermes_FormatCopy(source, dest : PHermesFormat);}
- Function Hermes_FormatNewEmpty : PHermesFormat;
- Var
- tmp : PHermesFormat;
- Begin
- tmp := malloc(SizeOf(THermesFormat));
- If tmp = Nil Then
- Begin
- Hermes_FormatNewEmpty := Nil;
- Exit;
- End;
- tmp^.bits := 0;
- tmp^.indexed := False;
- tmp^.r := 0;
- tmp^.g := 0;
- tmp^.b := 0;
- tmp^.a := 0;
- tmp^.has_colorkey := False;
- tmp^.colorkey := 0;
- Hermes_FormatNewEmpty := tmp;
- End;
- Function Hermes_FormatNew(bits : Integer; r, g, b, a : int32;
- indexed : Boolean) : PHermesFormat;
- Var
- tmp : PHermesFormat;
- Begin
- If indexed And (bits <> 8) Then
- Begin
- Hermes_FormatNew := Nil;
- Exit;
- End;
- tmp := malloc(SizeOf(THermesFormat));
- If tmp = Nil Then
- Begin
- Hermes_FormatNew := Nil;
- Exit;
- End;
- tmp^.bits := bits;
- tmp^.r := r;
- tmp^.g := g;
- tmp^.b := b;
- tmp^.a := a;
- tmp^.indexed := indexed;
- tmp^.has_colorkey := False;
- tmp^.colorkey := 0;
- Hermes_FormatNew := tmp;
- End;
- Procedure Hermes_FormatFree(fmt : PHermesFormat);
- Begin
- If fmt <> Nil Then
- free(fmt);
- End;
- Function Hermes_FormatNewEx(bits : Integer; r, g, b, a : int32;
- indexed, has_colorkey : Boolean;
- colorkey : int32) : PHermesFormat;
- Var
- tmp : PHermesFormat;
- Begin
- If indexed And (bits <> 8) Then
- Begin
- Hermes_FormatNewEx := Nil;
- Exit;
- End;
- tmp := malloc(SizeOf(THermesFormat));
- If tmp = Nil Then
- Begin
- Hermes_FormatNewEx := Nil;
- Exit;
- End;
- tmp^.bits := bits;
- tmp^.r := r;
- tmp^.g := g;
- tmp^.b := b;
- tmp^.a := a;
- tmp^.indexed := indexed;
- tmp^.has_colorkey := has_colorkey;
- tmp^.colorkey := colorkey;
- Hermes_FormatNewEx := tmp;
- End;
- Function Hermes_FormatEquals(op1, op2 : PHermesFormat) : Boolean;
- Begin
- Hermes_FormatEquals := ((op1^.indexed = op2^.indexed) And
- (op1^.bits = op2^.bits) And
- (op1^.r = op2^.r) And
- (op1^.g = op2^.g) And
- (op1^.b = op2^.b) And
- (op1^.a = op2^.a) And
- (op1^.has_colorkey = op2^.has_colorkey) And
- ((op1^.has_colorkey = False) Or
- (op1^.colorkey = op2^.colorkey)));
- End;
- Procedure Hermes_FormatCopy(source, dest : PHermesFormat);
- Begin
- Move(source^, dest^, SizeOf(THermesFormat));
- End;
|