mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 03:19:29 +01:00
+ added support for XPM, BMP, TGA
* Fix units names * Fix example program git-svn-id: trunk@5859 -
This commit is contained in:
parent
42be336413
commit
b5be98d22b
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -87,9 +87,12 @@ components/images/examples/mainform.lrs svneol=native#text/pascal
|
||||
components/images/examples/mainform.pas svneol=native#text/pascal
|
||||
components/images/imagesforlazarus.lpk svneol=native#text/pascal
|
||||
components/images/imagesforlazarus.pas svneol=native#text/pascal
|
||||
components/images/lazbmp.pas svneol=native#text/pascal
|
||||
components/images/lazjpg.pas svneol=native#text/pascal
|
||||
components/images/lazpng.pas svneol=native#text/pascal
|
||||
components/images/lazpnm.pas svneol=native#text/pascal
|
||||
components/images/laztga.pas svneol=native#text/pascal
|
||||
components/images/lazxpm.pas svneol=native#text/pascal
|
||||
components/images/readme.txt svneol=native#text/plain
|
||||
components/interbase/interbaselaz.lpk svneol=native#text/pascal
|
||||
components/interbase/interbaselaz.pas svneol=native#text/pascal
|
||||
|
||||
@ -5,21 +5,45 @@
|
||||
<General>
|
||||
<ProjectType Value="Application"/>
|
||||
<MainUnit Value="0"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="jpegexample"/>
|
||||
<Title Value="Images Example"/>
|
||||
</General>
|
||||
<JumpHistory Count="1" HistoryIndex="0">
|
||||
<JumpHistory Count="7" HistoryIndex="6">
|
||||
<Position1>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="38" Column="21" TopLine="38"/>
|
||||
<Caret Line="35" Column="29" TopLine="24"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="61" Column="45" TopLine="51"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="67" Column="14" TopLine="56"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="61" Column="1" TopLine="35"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="62" Column="10" TopLine="54"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="146" Column="12" TopLine="120"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="131" Column="14" TopLine="118"/>
|
||||
</Position7>
|
||||
</JumpHistory>
|
||||
<Units Count="24">
|
||||
<Unit0>
|
||||
<CursorPos X="65" Y="11"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<CursorPos X="39" Y="10"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<Filename Value="imagesexample.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -28,14 +52,14 @@
|
||||
<UsageCount Value="33"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<CursorPos X="21" Y="38"/>
|
||||
<CursorPos X="81" Y="6"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<ComponentName Value="ImagesExampleForm"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
<ResourceFilename Value="mainform.lrs"/>
|
||||
<TopLine Value="38"/>
|
||||
<TopLine Value="1"/>
|
||||
<UnitName Value="MainForm"/>
|
||||
<UsageCount Value="33"/>
|
||||
</Unit1>
|
||||
@ -175,7 +199,7 @@
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<CursorPos X="2" Y="4"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<Filename Value="README.txt"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -185,10 +209,8 @@
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<CursorPos X="1" Y="468"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<Filename Value="/home/neifer/FPC/Demo/src/lazarus/lcl/include/picture.inc"/>
|
||||
<Loaded Value="True"/>
|
||||
<TopLine Value="454"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit23>
|
||||
</Units>
|
||||
@ -206,11 +228,11 @@
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
<PackageName Value="ImagesForLazarus"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="JPEGForLazarus"/>
|
||||
<PackageName Value="LCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
</ProjectOptions>
|
||||
|
||||
@ -7,6 +7,7 @@ uses
|
||||
Forms, MainForm;
|
||||
|
||||
begin
|
||||
Application.Title:='Images Example';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TImagesExampleForm, ImagesExampleForm);
|
||||
Application.Run;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
{ Copyright (C) 2004 Mattias Gaertner
|
||||
|
||||
Example for loading and saving jpeg images.
|
||||
Example for loading and saving images.
|
||||
|
||||
Important:
|
||||
This example uses the JPEGForLazarusPackage (see in the directory above).
|
||||
This example uses the ImagesForLazarus Package (see in the directory above).
|
||||
You must first open once this package so that the IDE knows, where to find
|
||||
the lpk file.
|
||||
|
||||
@ -32,7 +32,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
ExtCtrls, Buttons, ExtDlgs, LazJPEG;
|
||||
ExtCtrls, Buttons, ExtDlgs;
|
||||
|
||||
type
|
||||
TImagesExampleForm = class(TForm)
|
||||
@ -57,11 +57,17 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
{Load for all package units : LazPNG, LazPNM, LazJPG, LazBMP, LazTGA, LazXPM}
|
||||
ImagesForLazarus,
|
||||
{Need LazJPG to use TJPGImage class}
|
||||
LazJPG;
|
||||
|
||||
{ TImagesExampleForm }
|
||||
|
||||
procedure TImagesExampleForm.LoadJPEGButtonClick(Sender: TObject);
|
||||
var
|
||||
JPEG: TJPEGImage;
|
||||
JPEG: TJPGImage;
|
||||
begin
|
||||
OpenPictureDialog1.Options:=OpenPictureDialog1.Options+[ofFileMustExist];
|
||||
if not OpenPictureDialog1.Execute then exit;
|
||||
@ -69,7 +75,7 @@ begin
|
||||
//--------------------------------------------------------------------------
|
||||
// Create a TJPEGImage and load the file, then copy it to the TImage.
|
||||
// A TJPEGImage can only load jpeg images.
|
||||
JPEG:=TJPEGImage.Create;
|
||||
JPEG:=TJPGImage.Create;
|
||||
try
|
||||
JPEG.LoadFromFile(OpenPictureDialog1.Filename);
|
||||
// copy jpeg content to a TImage
|
||||
@ -88,7 +94,7 @@ end;
|
||||
|
||||
procedure TImagesExampleForm.LoadImageButtonClick(Sender: TObject);
|
||||
var
|
||||
JPEG: TJPEGImage;
|
||||
JPEG: TJPGImage;
|
||||
begin
|
||||
OpenPictureDialog1.Options:=OpenPictureDialog1.Options+[ofFileMustExist];
|
||||
if not OpenPictureDialog1.Execute then exit;
|
||||
@ -110,7 +116,7 @@ end;
|
||||
|
||||
procedure TImagesExampleForm.SaveJPEGButtonClick(Sender: TObject);
|
||||
var
|
||||
JPEG: TJPEGImage;
|
||||
JPEG: TJPGImage;
|
||||
begin
|
||||
if Image1.Picture.Graphic=nil then begin
|
||||
MessageDlg('No image','Please open an image, before save',mtError,
|
||||
@ -124,7 +130,7 @@ begin
|
||||
//--------------------------------------------------------------------------
|
||||
// Create a TImage1 and copy the TImage into it. Then save to file.
|
||||
// This will ignore the file extension. TImage1 will always save as jpeg.
|
||||
JPEG:=TJPEGImage.Create;
|
||||
JPEG:=TJPGImage.Create;
|
||||
try
|
||||
// copy content of the TImage to jpeg
|
||||
JPEG.Assign(Image1.Picture.Graphic);
|
||||
@ -145,7 +151,7 @@ end;
|
||||
|
||||
procedure TImagesExampleForm.SaveImageButtonClick(Sender: TObject);
|
||||
var
|
||||
JPEG: TJPEGImage;
|
||||
JPEG: TJPGImage;
|
||||
begin
|
||||
if Image1.Picture.Graphic=nil then begin
|
||||
MessageDlg('No image','Please open an image, before save',mtError,
|
||||
|
||||
@ -20,10 +20,10 @@
|
||||
"/>
|
||||
<License Value="LGPL"/>
|
||||
<Version Major="1" Release="1"/>
|
||||
<Files Count="4">
|
||||
<Files Count="7">
|
||||
<Item1>
|
||||
<Filename Value="lazpng.pas"/>
|
||||
<UnitName Value="lazpng"/>
|
||||
<UnitName Value="Lazpng"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="readme.txt"/>
|
||||
@ -37,6 +37,18 @@
|
||||
<Filename Value="lazjpg.pas"/>
|
||||
<UnitName Value="Lazjpg"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Filename Value="lazbmp.pas"/>
|
||||
<UnitName Value="LazBMP"/>
|
||||
</Item5>
|
||||
<Item6>
|
||||
<Filename Value="laztga.pas"/>
|
||||
<UnitName Value="LazTGA"/>
|
||||
</Item6>
|
||||
<Item7>
|
||||
<Filename Value="lazxpm.pas"/>
|
||||
<UnitName Value="LazXPM"/>
|
||||
</Item7>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="1">
|
||||
|
||||
@ -8,7 +8,7 @@ unit ImagesForLazarus;
|
||||
interface
|
||||
|
||||
uses
|
||||
Lazpng, Lazpnm, Lazjpg, LazarusPackageIntf;
|
||||
Lazpng, Lazpnm, Lazjpg, LazBMP, LazTGA, LazXPM, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
107
components/images/lazbmp.pas
Normal file
107
components/images/lazbmp.pas
Normal file
@ -0,0 +1,107 @@
|
||||
{ Copyright (C) 2003 Mattias Gaertner
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program 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 Library General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU Library 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.
|
||||
}
|
||||
unit LazBMP;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, FPImage, IntfGraphics, Graphics,
|
||||
FPReadBMP, FPWriteBMP,
|
||||
ClipBrd;
|
||||
|
||||
type
|
||||
|
||||
TBMPImage = class(TFPImageBitmap)
|
||||
protected
|
||||
procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override;
|
||||
public
|
||||
constructor Create; override;
|
||||
class function GetFileExtensions: string; override;
|
||||
class function GetDefaultFPReader: TFPCustomImageReaderClass; override;
|
||||
class function GetDefaultFPWriter: TFPCustomImageWriterClass; override;
|
||||
end;
|
||||
|
||||
const
|
||||
DefaultBMPMimeType = 'image/bmp';
|
||||
|
||||
implementation
|
||||
|
||||
{ TBMPImage }
|
||||
|
||||
procedure TBMPImage.InitFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
BMPReader: TFPReaderBMP;
|
||||
begin
|
||||
if ImgReader is TFPReaderBMP then begin
|
||||
end;
|
||||
inherited InitFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TBMPImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
BMPReader: TFPReaderBMP;
|
||||
begin
|
||||
if ImgReader is TFPReaderBMP then begin
|
||||
end;
|
||||
inherited FinalizeFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TBMPImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter);
|
||||
var
|
||||
BMPWriter: TFPWriterBMP;
|
||||
begin
|
||||
if ImgWriter is TFPWriterBMP then begin
|
||||
BMPWriter:=TFPWriterBMP(ImgWriter);
|
||||
if BMPWriter<>nil then ;
|
||||
end;
|
||||
inherited InitFPImageWriter(ImgWriter);
|
||||
end;
|
||||
|
||||
function TBMPImage.GetDefaultFPReader: TFPCustomImageReaderClass;
|
||||
begin
|
||||
Result:=TFPReaderBMP;
|
||||
end;
|
||||
|
||||
function TBMPImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
||||
begin
|
||||
Result:=TFPWriterBMP;
|
||||
end;
|
||||
|
||||
constructor TBMPImage.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
function TBMPImage.GetFileExtensions: string;
|
||||
begin
|
||||
Result:='bmp';
|
||||
end;
|
||||
|
||||
initialization
|
||||
TPicture.RegisterFileFormat('bmp', 'BMP Image File', TBMPImage);
|
||||
TPicture.RegisterClipboardFormat(RegisterClipboardFormat(DefaultBMPMimeType),
|
||||
TBMPImage);
|
||||
|
||||
finalization
|
||||
TPicture.UnregisterGraphicClass(TBMPImage);
|
||||
|
||||
end.
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
}
|
||||
unit Lazjpg;
|
||||
unit LazJPG;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -26,14 +26,14 @@ uses
|
||||
ClipBrd;
|
||||
|
||||
type
|
||||
TJPEGQualityRange = TFPJPEGCompressionQuality;
|
||||
TJPEGPerformance = TJPEGReadPerformance;
|
||||
TJPGQualityRange = TFPJPEGCompressionQuality;
|
||||
TJPGPerformance = TJPEGReadPerformance;
|
||||
|
||||
TJPEGImage = class(TFPImageBitmap)
|
||||
TJPGImage = class(TFPImageBitmap)
|
||||
private
|
||||
FPerformance: TJPEGPerformance;
|
||||
FPerformance: TJPGPerformance;
|
||||
FProgressiveEncoding: boolean;
|
||||
FQuality: TJPEGQualityRange;
|
||||
FQuality: TJPGQualityRange;
|
||||
protected
|
||||
procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
@ -44,64 +44,64 @@ type
|
||||
class function GetDefaultFPReader: TFPCustomImageReaderClass; override;
|
||||
class function GetDefaultFPWriter: TFPCustomImageWriterClass; override;
|
||||
public
|
||||
property CompressionQuality: TJPEGQualityRange read FQuality write FQuality;
|
||||
property CompressionQuality: TJPGQualityRange read FQuality write FQuality;
|
||||
property ProgressiveEncoding: boolean read FProgressiveEncoding;
|
||||
property Performance: TJPEGPerformance read FPerformance write FPerformance;
|
||||
property Performance: TJPGPerformance read FPerformance write FPerformance;
|
||||
end;
|
||||
|
||||
const
|
||||
DefaultJPEGMimeType = 'image/jpeg';
|
||||
DefaultJPGMimeType = 'image/jpeg';
|
||||
|
||||
implementation
|
||||
|
||||
{ TJPEGImage }
|
||||
{ TJPGImage }
|
||||
|
||||
procedure TJPEGImage.InitFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
procedure TJPGImage.InitFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
JPEGReader: TFPReaderJPEG;
|
||||
JPGReader: TFPReaderJPEG;
|
||||
begin
|
||||
if ImgReader is TFPReaderJPEG then begin
|
||||
JPEGReader:=TFPReaderJPEG(ImgReader);
|
||||
JPEGReader.Performance:=Performance;
|
||||
JPGReader:=TFPReaderJPEG(ImgReader);
|
||||
JPGReader.Performance:=Performance;
|
||||
end;
|
||||
inherited InitFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
procedure TJPGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
JPEGReader: TFPReaderJPEG;
|
||||
JPGReader: TFPReaderJPEG;
|
||||
begin
|
||||
if ImgReader is TFPReaderJPEG then begin
|
||||
JPEGReader:=TFPReaderJPEG(ImgReader);
|
||||
FProgressiveEncoding:=JPEGReader.ProgressiveEncoding;
|
||||
JPGReader:=TFPReaderJPEG(ImgReader);
|
||||
FProgressiveEncoding:=JPGReader.ProgressiveEncoding;
|
||||
end;
|
||||
inherited FinalizeFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TJPEGImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter);
|
||||
procedure TJPGImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter);
|
||||
var
|
||||
JPEGWriter: TFPWriterJPEG;
|
||||
JPGWriter: TFPWriterJPEG;
|
||||
begin
|
||||
if ImgWriter is TFPWriterJPEG then begin
|
||||
JPEGWriter:=TFPWriterJPEG(ImgWriter);
|
||||
if JPEGWriter<>nil then ;
|
||||
JPEGWriter.ProgressiveEncoding:=ProgressiveEncoding;
|
||||
JPEGWriter.CompressionQuality:=CompressionQuality;
|
||||
JPGWriter:=TFPWriterJPEG(ImgWriter);
|
||||
if JPGWriter<>nil then ;
|
||||
JPGWriter.ProgressiveEncoding:=ProgressiveEncoding;
|
||||
JPGWriter.CompressionQuality:=CompressionQuality;
|
||||
end;
|
||||
inherited InitFPImageWriter(ImgWriter);
|
||||
end;
|
||||
|
||||
function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass;
|
||||
function TJPGImage.GetDefaultFPReader: TFPCustomImageReaderClass;
|
||||
begin
|
||||
Result:=TFPReaderJPEG;
|
||||
end;
|
||||
|
||||
function TJPEGImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
||||
function TJPGImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
||||
begin
|
||||
Result:=TFPWriterJPEG;
|
||||
end;
|
||||
|
||||
constructor TJPEGImage.Create;
|
||||
constructor TJPGImage.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FPerformance:=jpBestQuality;
|
||||
@ -109,20 +109,19 @@ begin
|
||||
FQuality:=75;
|
||||
end;
|
||||
|
||||
function TJPEGImage.GetFileExtensions: string;
|
||||
function TJPGImage.GetFileExtensions: string;
|
||||
begin
|
||||
Result:='jpg;jpeg';
|
||||
WriteLn('Sending result=',result);
|
||||
end;
|
||||
|
||||
initialization
|
||||
TPicture.RegisterFileFormat('jpg', 'JPEG Image File', TJPEGImage);
|
||||
TPicture.RegisterFileFormat('jpeg', 'JPEG Image File', TJPEGImage);
|
||||
TPicture.RegisterClipboardFormat(RegisterClipboardFormat(DefaultJPEGMimeType),
|
||||
TJPEGImage);
|
||||
TPicture.RegisterFileFormat('jpg', 'JPEG Image File', TJPGImage);
|
||||
TPicture.RegisterFileFormat('jpeg', 'JPEG Image File', TJPGImage);
|
||||
TPicture.RegisterClipboardFormat(RegisterClipboardFormat(DefaultJPGMimeType),
|
||||
TJPGImage);
|
||||
|
||||
finalization
|
||||
TPicture.UnregisterGraphicClass(TJPEGImage);
|
||||
TPicture.UnregisterGraphicClass(TJPGImage);
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
}
|
||||
unit Lazpng;
|
||||
unit LazPNG;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
}
|
||||
unit Lazpnm;
|
||||
unit LazPNM;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -62,7 +62,6 @@ end;
|
||||
function TPNMImage.GetFileExtensions: string;
|
||||
begin
|
||||
Result:='ppm;pgm;pbm';
|
||||
WriteLn('Sending result=',result);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
107
components/images/laztga.pas
Normal file
107
components/images/laztga.pas
Normal file
@ -0,0 +1,107 @@
|
||||
{ Copyright (C) 2003 Mattias Gaertner
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program 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 Library General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU Library 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.
|
||||
}
|
||||
unit LazTGA;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, FPImage, IntfGraphics, Graphics,
|
||||
FPReadTGA, FPWriteTGA,
|
||||
ClipBrd;
|
||||
|
||||
type
|
||||
TTGAImage = class(TFPImageBitmap)
|
||||
protected
|
||||
procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override;
|
||||
public
|
||||
constructor Create; override;
|
||||
class function GetFileExtensions: string; override;
|
||||
class function GetDefaultFPReader: TFPCustomImageReaderClass; override;
|
||||
class function GetDefaultFPWriter: TFPCustomImageWriterClass; override;
|
||||
end;
|
||||
|
||||
const
|
||||
DefaultTGAMimeType = 'image/tga';
|
||||
|
||||
implementation
|
||||
|
||||
{ TTGAImage }
|
||||
|
||||
procedure TTGAImage.InitFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
TGAReader: TFPReaderTarga;
|
||||
begin
|
||||
if ImgReader is TFPReaderTarga then begin
|
||||
end;
|
||||
inherited InitFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TTGAImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
TGAReader: TFPReaderTarga;
|
||||
begin
|
||||
if ImgReader is TFPReaderTarga then begin
|
||||
TGAReader:=TFPReaderTarga(ImgReader);
|
||||
end;
|
||||
inherited FinalizeFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TTGAImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter);
|
||||
var
|
||||
TGAWriter: TFPWriterTarga;
|
||||
begin
|
||||
if ImgWriter is TFPWriterTarga then begin
|
||||
TGAWriter:=TFPWriterTarga(ImgWriter);
|
||||
if TGAWriter<>nil then ;
|
||||
end;
|
||||
inherited InitFPImageWriter(ImgWriter);
|
||||
end;
|
||||
|
||||
function TTGAImage.GetDefaultFPReader: TFPCustomImageReaderClass;
|
||||
begin
|
||||
Result:=TFPReaderTarga;
|
||||
end;
|
||||
|
||||
function TTGAImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
||||
begin
|
||||
Result:=TFPWriterTarga;
|
||||
end;
|
||||
|
||||
constructor TTGAImage.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
function TTGAImage.GetFileExtensions: string;
|
||||
begin
|
||||
Result:='tga';
|
||||
end;
|
||||
|
||||
initialization
|
||||
TPicture.RegisterFileFormat('tga', 'TGA Image File', TTGAImage);
|
||||
TPicture.RegisterClipboardFormat(RegisterClipboardFormat(DefaultTGAMimeType),
|
||||
TTGAImage);
|
||||
|
||||
finalization
|
||||
TPicture.UnregisterGraphicClass(TTGAImage);
|
||||
|
||||
end.
|
||||
|
||||
107
components/images/lazxpm.pas
Normal file
107
components/images/lazxpm.pas
Normal file
@ -0,0 +1,107 @@
|
||||
{ Copyright (C) 2003 Mattias Gaertner
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program 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 Library General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU Library 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.
|
||||
}
|
||||
unit LazXPM;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, FPImage, IntfGraphics, Graphics,
|
||||
FPReadXPM, FPWriteXPM,
|
||||
ClipBrd;
|
||||
|
||||
type
|
||||
TXPMImage = class(TFPImageBitmap)
|
||||
protected
|
||||
procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override;
|
||||
procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override;
|
||||
public
|
||||
constructor Create; override;
|
||||
class function GetFileExtensions: string; override;
|
||||
class function GetDefaultFPReader: TFPCustomImageReaderClass; override;
|
||||
class function GetDefaultFPWriter: TFPCustomImageWriterClass; override;
|
||||
end;
|
||||
|
||||
const
|
||||
DefaultXPMMimeType = 'image/xpm';
|
||||
|
||||
implementation
|
||||
|
||||
{ TXPMImage }
|
||||
|
||||
procedure TXPMImage.InitFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
XPMReader: TFPReaderXPM;
|
||||
begin
|
||||
if ImgReader is TFPReaderXPM then begin
|
||||
end;
|
||||
inherited InitFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TXPMImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
|
||||
var
|
||||
XPMReader: TFPReaderXPM;
|
||||
begin
|
||||
if ImgReader is TFPReaderXPM then begin
|
||||
XPMReader:=TFPReaderXPM(ImgReader);
|
||||
end;
|
||||
inherited FinalizeFPImageReader(ImgReader);
|
||||
end;
|
||||
|
||||
procedure TXPMImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter);
|
||||
var
|
||||
XPMWriter: TFPWriterXPM;
|
||||
begin
|
||||
if ImgWriter is TFPWriterXPM then begin
|
||||
XPMWriter:=TFPWriterXPM(ImgWriter);
|
||||
if XPMWriter<>nil then ;
|
||||
end;
|
||||
inherited InitFPImageWriter(ImgWriter);
|
||||
end;
|
||||
|
||||
function TXPMImage.GetDefaultFPReader: TFPCustomImageReaderClass;
|
||||
begin
|
||||
Result:=TFPReaderXPM;
|
||||
end;
|
||||
|
||||
function TXPMImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
||||
begin
|
||||
Result:=TFPWriterXPM;
|
||||
end;
|
||||
|
||||
constructor TXPMImage.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
function TXPMImage.GetFileExtensions: string;
|
||||
begin
|
||||
Result:='xpm';
|
||||
end;
|
||||
|
||||
initialization
|
||||
TPicture.RegisterFileFormat('xpm', 'XPM Image File', TXPMImage);
|
||||
TPicture.RegisterClipboardFormat(RegisterClipboardFormat(DefaultXPMMimeType),
|
||||
TXPMImage);
|
||||
|
||||
finalization
|
||||
TPicture.UnregisterGraphicClass(TXPMImage);
|
||||
|
||||
end.
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
WARNING WARNING WARNING WARNING WARNING
|
||||
|
||||
This package is broken. Read further.
|
||||
@ -6,24 +5,25 @@ This package is broken. Read further.
|
||||
The pasjpeg code in the current fpc sources have a bug.
|
||||
If you want jpeg, then you must use an older fpc and the jpeg from lazarus-ccr
|
||||
on sourceforge. Not this package.
|
||||
However, if you only need interlaced JPEG, you can use this package.
|
||||
|
||||
The Targa loder is not fully functional.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
We used a simple naming schema to help non expert working with this package.
|
||||
The support type name and the support unit name are :
|
||||
|
||||
The lazarus TJPEGImage is in lazjpeg.pas
|
||||
T$(most_common_extension)Image is in laz$(most_common_extension).pas
|
||||
|
||||
It uses the pasjpeg and fpimage libs provided by FreePascal. See there for in
|
||||
The lazarus TPNGImage is in lazpng.pas
|
||||
The lazarus TPNMImage is in lazpnm.pas
|
||||
The lazarus TJPGImage is in lazjpg.pas
|
||||
The lazarus TBMPImage is in lazbmp.pas
|
||||
The lazarus TTGAImage is in laztga.pas
|
||||
The lazarus TXPMImage is in lazxpm.pas
|
||||
|
||||
This package uses the fpimage libs provided by FreePascal in the FCL/Image. See there for in
|
||||
more detailed jpeg handling.
|
||||
|
||||
|
||||
JPEG (pronounced "jay-peg") is a standardized familly of algorithms for
|
||||
compression of continous tone still images. Most JPEG processes are lossy,
|
||||
the output image is not exactly identical to the input image. However, on
|
||||
typical photographic images, very good compression levels can be obtained
|
||||
with no visible change, and remarkably high compression levels are possible
|
||||
if you can tolerate a low-quality image. The Independent JPEG Group (IJG) has
|
||||
created a free, portable C library for JPEG compression and decompression of
|
||||
JPEG images.
|
||||
|
||||
|
||||
|
||||
Please report bugs to "Mazen NEIFER" <mazen@freepascal.org>
|
||||
Loading…
Reference in New Issue
Block a user