So, I found an example in the BGRABitmap library. It's called aa_demo. The original example works, but if you want to replace the triangle that draws the original example with a photo, the program stops working. Who explains to me what the mistake is?
To reproduce the error just comment on the line
bmp.FillPolyAntialias([coordToBmp(pts[0]),coordToBmp(pts[1]),coordToBmp(pts[2])],BGRABlack);
and uncomment the line
//bmp.LoadFromFile(GetApplicationLocation() + 'abc.png');