Hi All
Thanks in advance for any assistance!
I am using Laz to code a little pixel graphics editor. I have 4 BGRABitmaps.
1] A Zoomed view of enlarged 64x64 pixels.
2] An actual cell size of 64X64 Pixels {view actual size}
3] A BGRABitmap (512x512) of all the (64x64) cells.
4] A Current Cell Indicator (green rectangle with transparency)
So what I currently have:
User paints a pixel in the zoomed view. This is reflected in both the Actual Size bitmap and ALLCELLS bitmap in real time. All works smoothly!
However, I want there to be another bitmap (Cell Indicator) which is over bitmap 3 showing the cell bounds being painted. However, whenever I do this I get really bad flicker.
Here is the Bitmap Creation Code:
AllCharsBmp:=TBGRABitmap.Create(512,512, BGRA(tPaintCol.Red, tPaintCol.Green, tPaintCol.Blue, tPaintCol.Alpha) );
//AllCharsGrid:=TBGRABitmap.Create(512,512, BGRAPixelTransparent );
SelectBmp:=TBGRABitmap.Create(64,64,BGRAPixelTransparent);
SelectBmp.Canvas.Pen.Color:=BGRA(0,255,0,128);
SelectBmp.Canvas.Pen.Style:=psDash;
SelectBmp.DrawHorizLine(0,0,63, BGRA(0,255,0,128));
SelectBmp.DrawHorizLine(0,63,63, BGRA(0,255,0,128));
and on the MouseMove event I draw the bitmaps like so:
AllCharsBmp.Draw(CharImagePanel.Canvas,8,8,true);
end;
MainPaintBmp.Draw(MainPaintPanel.Canvas,8,8);
SelectBmp.Draw(CharImagePanel.Canvas,8,8, True);
How do I stop the flicker? Should I move all drawing to the onPaint event for the canvas in question?
What I want is the SelectBmp to be shown whilst real time drawing is shown on the bitmap underneath, but with no flicker?
Any help greatly appreciated.
Thanks