SetPixel

Graphics32

TBitmap32.SetPixel

procedure SetPixelT(X, Y: Integer; Value: TColor32); overload;

procedure SetPixelT(var Ptr: PColor32; Value: TColor32); overload;

procedure SetPixelTS(X, Y: Integer; Value: TColor32);

procedure SetPixelX(X, Y: TFixed; Value: TColor32); deprecated;

procedure SetPixelXS(X, Y: TFixed; Value: TColor32); deprecated;

procedure SetPixelF(X, Y: Single; Value: TColor32); deprecated;

procedure SetPixelFS(X, Y: Single; Value: TColor32); deprecated;

Description

SetPixelT blends the pixel with a bitmap at specified coordinates using the specified color. The pixel’s alpha channel is used, but the coordinates are not validated.

The overloaded version of SetPixelT with a pixel pointer argument allows setting pixels addressed with the pointer rather than with coordinates. The pointer is automatically incremented to a next pixel position with each call to SetPixelT, for example:

var
  P: PColor32;
  I: Integer;
begin { Draw a fading white line from (10, 20) to (265, 20) }
  P := PixelPtr[10, 20];
  for I := 0 to 255 do SetPixelT(P, Color32(255, 255, 255, 255 - I));
end;

SetPixelTS is the SetPixelT method with added coordinate verification. If pixel coordinates lie outside the bitmap area, SetPixelTS does nothing.

 

SetPixelX/F/XS/FS methods are deprecated. Please use the PixelX/F/XS/FS property instead.

 

See Also

Naming Conventions, Pixel, TColor32, TFixed