LCL: Activate writing of grayscale JPEG images. (Issue #30408, patch by Nur Cholif Murtadho)

git-svn-id: trunk@59052 -
This commit is contained in:
wp 2018-09-17 21:27:13 +00:00
parent c0c477a971
commit 17269a3edf
2 changed files with 10 additions and 1 deletions

View File

@ -1764,6 +1764,7 @@ type
FProgressiveEncoding: boolean;
FQuality: TJPEGQualityRange;
procedure SetCompressionQuality(AValue: TJPEGQualityRange);
procedure SetGrayScale(AValue: Boolean);
protected
procedure InitializeReader(AImage: TLazIntfImage; AReader: TFPCustomImageReader); override;
procedure InitializeWriter(AImage: TLazIntfImage; AWriter: TFPCustomImageWriter); override;
@ -1778,7 +1779,7 @@ type
class function GetFileExtensions: string; override;
public
property CompressionQuality: TJPEGQualityRange read FQuality write SetCompressionQuality;
property GrayScale: Boolean read FGrayScale;
property GrayScale: Boolean read FGrayScale write SetGrayScale;
property ProgressiveEncoding: boolean read FProgressiveEncoding;
property Performance: TJPEGPerformance read FPerformance write FPerformance;
end;

View File

@ -91,6 +91,7 @@ begin
if not(AWriter is TFPWriterJPEG) then Exit;
TFPWriterJPEG(AWriter).ProgressiveEncoding := ProgressiveEncoding;
TFPWriterJPEG(AWriter).CompressionQuality := CompressionQuality;
TFPWriterJPEG(AWriter).GrayScale := GrayScale;
end;
procedure TJPEGImage.SetCompressionQuality(AValue: TJPEGQualityRange);
@ -99,3 +100,10 @@ begin
FQuality := AValue;
FreeSaveStream;
end;
procedure TJPEGImage.SetGrayScale(AValue: Boolean);
begin
if FGrayScale = AValue then Exit;
FGrayScale := AValue;
FreeSaveStream;
end;