1 { Copyright (C) 2003 Mattias Gaertner
2
3 This library is free software; you can redistribute it and/or modify it
4 under the terms of the GNU Library General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or (at your
6 option) any later version.
7
8 This program is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
11 for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; if not, write to the Free Software Foundation,
15 Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
16 }
17 unit LazTGA;
18
19 {$mode objfpc}{$H+}
20
21 interface
22
23 uses
24 SysUtils, Classes, FPImage, IntfGraphics, Graphics,
25 FPReadTGA, FPWriteTGA,
26 ClipBrd;
27
28 type
29
30 { TSharedTGAImage }
31
32 TSharedTGAImage = class(TSharedCustomBitmap)
33 end;
34
35 { TTGAImage }
36
37 TTGAImage = class(TFPImageBitmap)
38 protected
GetReaderClassnull39 class function GetReaderClass: TFPCustomImageReaderClass; override;
GetWriterClassnull40 class function GetWriterClass: TFPCustomImageWriterClass; override;
GetSharedImageClassnull41 class function GetSharedImageClass: TSharedRasterImageClass; override;
42 public
GetFileExtensionsnull43 class function GetFileExtensions: string; override;
44 end;
45
46 const
47 DefaultTGAMimeType = 'image/tga';
48
49 procedure Register;
50 procedure UnRegister;
51
52 implementation
53
54 { TTGAImage }
55
TTGAImage.GetReaderClassnull56 class function TTGAImage.GetReaderClass: TFPCustomImageReaderClass;
57 begin
58 Result:=TFPReaderTarga;
59 end;
60
TTGAImage.GetWriterClassnull61 class function TTGAImage.GetWriterClass: TFPCustomImageWriterClass;
62 begin
63 Result:=TFPWriterTarga;
64 end;
65
TTGAImage.GetSharedImageClassnull66 class function TTGAImage.GetSharedImageClass: TSharedRasterImageClass;
67 begin
68 Result:=TSharedTGAImage;
69 end;
70
TTGAImage.GetFileExtensionsnull71 class function TTGAImage.GetFileExtensions: string;
72 begin
73 Result:='tga';
74 end;
75
76 procedure Register;
77 begin
78 TPicture.RegisterFileFormat('tga', 'TGA Image File', TTGAImage);
79 TPicture.RegisterClipboardFormat(RegisterClipboardFormat(DefaultTGAMimeType),
80 TTGAImage);
81 end;
82
83 procedure UnRegister;
84 begin
85 TPicture.UnregisterGraphicClass(TTGAImage);
86 end;
87
88 end.
89
90