<html><head></head><body dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="ApplePlainTextBody"><div class="ApplePlainTextBody">I’d like to draw a bitmap pixel by pixel then save to disk but I can’t understand the docs available online. I know there’s a BGRABitmap class with direct pixel access but I wasn’t able to find the unit in my FPC distribution.<br><br>I used the image canvas before to draw bitmap fonts so I have this code working. Is there anyway to set a pixel using TFPImageCanvas? I also couldn’t figure out how to set the brush color (confusing reference once again). It looks like Lazarus has good classes but they’re so hard to discover and learn because the references aren’t complete and in one place.<br><br>What’s the best way to do this? Thanks.<br><br>procedure DrawBitmap;<br>var<br><span class="Apple-tab-span" style="white-space:pre"> </span>image: TFPMemoryImage;<br><span class="Apple-tab-span" style="white-space:pre"> </span>canvas: TFPImageCanvas;<br><span class="Apple-tab-span" style="white-space:pre"> </span>writer: TFPWriterPNG;<br>begin<br><span class="Apple-tab-span" style="white-space:pre"> </span>image := TFPMemoryImage.Create(100, 100);<br> canvas := TFPImageCanvas.Create(image);<br><span class="Apple-tab-span" style="white-space:pre"> </span><br><span class="Apple-tab-span" style="white-space:pre"> </span>canvas.Clear;<br><span class="Apple-tab-span" style="white-space:pre"> </span>canvas.Brush.FPColor := colRed; // how do I set the color as an RGB?<br><span class="Apple-tab-span" style="white-space:pre"> </span>canvas.Rectangle(0, 0, 1, 1);<span class="Apple-tab-span" style="white-space:pre"> </span> // how do I draw a single pixel?<br><span class="Apple-tab-span" style="white-space:pre"> </span><br><span class="Apple-tab-span" style="white-space:pre"> </span>writer := TFPWriterPNG.Create;<br> image.SaveToFile('bitmap.png', writer);<br>end;<br><br>Regards,<br><span class="Apple-tab-span" style="white-space:pre"> </span>Ryan Joseph<br><br></div></body></html>