Look at SetPixelDirect for details.
procedure ImSetPixelDirect(const Image: TImageData; X: LongInt; Y: LongInt; Pixel: Pointer); cdecl;
ImagingExport (at line 152)