[fpc-pascal] Drawing bitmap by pixel
    Ryan Joseph 
    ryan at thealchemistguild.com
       
    Fri Jan 20 02:31:57 CET 2017
    
    
  
> On Jan 20, 2017, at 7:20 AM, Graeme Geldenhuys <mailinglists at geldenhuys.co.uk> wrote:
> 
> It is slightly confusing. If you are using an Indexed image, then use
> the Pixels[] property. If you are not using an Indexed image, then use
> the Colors[] property.
Thanks guys,
Here’s the new program based on your example but it still just outputs a pure black image.
procedure Draw;
var
	image: TFPCustomImage;
	canvas: TFPImageCanvas;
	writer: TFPWriterPNG;
	x, y: integer;
begin
	image := TFPCompactImgRGB8Bit.Create(100, 100);
	image.UsePalette := False;
  
	for x := 0 to image.Width-1 do
	for y := 0 to image.Height-1 do
		image.Colors[x, y] := FPColor(255, 0, 0, 255);
	writer := TFPWriterPNG.Create;
	writer.Indexed := False;
  	image.SaveToFile('bitmap.png', writer);
end;
Regards,
	Ryan Joseph
    
    
More information about the fpc-pascal
mailing list