FPImage: HtmlToFPColor doesn't set the second byte, which results in corrupt color
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
HtmlToFPColor doesn't set the second byte of FPColor component (which is WORD).
This results in a corrupt color.
Steps to reproduce:
The following program creates a simple 100x100px JPEG that should be all white. It is black instead:
program FPImgHTML;
uses
FPImage, FPWriteJPEG, FPImgCanv, FPCanvas;
var
xNew: TFPCustomImage;
xCanvas: TFPImageCanvas;
xNewWidth, xNewHeight: Integer;
begin
xNew := nil;
xCanvas := nil;
try
xNewWidth := 100;
xNewHeight := 100;
xNew := TFPMemoryImage.Create(xNewWidth, xNewHeight);
xCanvas := TFPImageCanvas.Create(xNew);
xCanvas.Pen.Style := psClear;
xCanvas.Brush.FPColor := HtmlToFPColor('#FFFFFF');
xCanvas.FillRect(0, 0, xNewWidth, xNewHeight);
xNew.SaveToFile('test.jpg');
finally
xCanvas.Free;
xNew.Free;
end;
end.
Additional information:
Patch attached.
Mantis conversion info:
- Mantis ID: 34388
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 39973 (#5cc137f5)
- Target version: 3.2.0