mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-11 13:50:14 +01:00
* Added resource loading support to TPicture and Glyps to avoid image quality loss when converted to TBitmap * Removed copy paste code for imagelist resource loading * Moved some graphic classes to their own ini file git-svn-id: trunk@14876 -
91 lines
2.9 KiB
PHP
91 lines
2.9 KiB
PHP
{%MainUnit ../graphics.pp}
|
|
|
|
{******************************************************************************
|
|
TJPegImage
|
|
******************************************************************************
|
|
|
|
*****************************************************************************
|
|
* *
|
|
* This file is part of the Lazarus Component Library (LCL) *
|
|
* *
|
|
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
|
* for details about the copyright. *
|
|
* *
|
|
* 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. *
|
|
* *
|
|
*****************************************************************************
|
|
}
|
|
|
|
{ TJPEGImage }
|
|
|
|
procedure TJPEGImage.InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader);
|
|
var
|
|
JPEGReader: TFPReaderJPEG;
|
|
begin
|
|
if ImgReader is TFPReaderJPEG then
|
|
begin
|
|
JPEGReader := TFPReaderJPEG(ImgReader);
|
|
JPEGReader.Performance := Performance;
|
|
JPEGReader.OnProgress := @Progress;
|
|
end;
|
|
inherited InitFPImageReader(IntfImg, ImgReader);
|
|
end;
|
|
|
|
procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
|
|
var
|
|
JPEGReader: TFPReaderJPEG;
|
|
begin
|
|
if ImgReader is TFPReaderJPEG then
|
|
begin
|
|
JPEGReader := TFPReaderJPEG(ImgReader);
|
|
FProgressiveEncoding := JPEGReader.ProgressiveEncoding;
|
|
FGrayScale := JPEGReader.GrayScale;
|
|
end;
|
|
inherited FinalizeFPImageReader(ImgReader);
|
|
end;
|
|
|
|
procedure TJPEGImage.InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter);
|
|
var
|
|
JPEGWriter: TFPWriterJPEG;
|
|
begin
|
|
if ImgWriter is TFPWriterJPEG then
|
|
begin
|
|
JPEGWriter := TFPWriterJPEG(ImgWriter);
|
|
if JPEGWriter <> nil then
|
|
begin
|
|
JPEGWriter.ProgressiveEncoding := ProgressiveEncoding;
|
|
JPEGWriter.CompressionQuality := CompressionQuality;
|
|
JPEGWriter.OnProgress := @Progress;
|
|
end;
|
|
end;
|
|
inherited InitFPImageWriter(IntfImg, ImgWriter);
|
|
end;
|
|
|
|
class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass;
|
|
begin
|
|
Result := TFPReaderJPEG;
|
|
end;
|
|
|
|
class function TJPEGImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
|
|
begin
|
|
Result := TFPWriterJPEG;
|
|
end;
|
|
|
|
constructor TJPEGImage.Create;
|
|
begin
|
|
inherited Create;
|
|
FPerformance := jpBestQuality;
|
|
FProgressiveEncoding := False;
|
|
FGrayScale := False;
|
|
FQuality := 75;
|
|
end;
|
|
|
|
class function TJPEGImage.GetFileExtensions: string;
|
|
begin
|
|
Result := 'jpg;jpeg';
|
|
end;
|
|
|
|
|