Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: lainz on April 14, 2011, 08:10:39 pm

Title: Clear canvas and set transparent
Post by: lainz on April 14, 2011, 08:10:39 pm
See the attached picture / Attached 7z file (requires BGRABitmap as installed package).

Compile and run lazgui_test.

If you go over the 'ToolButton' you will see that is painted.

But if you leave the 'ToolButton' area isn't cleared, and text is drawn over the previous drawing.

I need to clear the previous drawing and only draw text in a transparent area (to see the background gradient).

I tried to use ACanvas.Clear:

(lazguiwin7.pas line 60):
Code: [Select]
if AState = lgNormal then begin
    bmp:= TBGRABitmap.Create(ARect.Right,ARect.Bottom);
    ACanvas.Clear; // This clear the drawing, but isn't transparent, and used in this way produces flickering
end

But the background isn't transparent, it is filled with clDefault.
Title: Re: Clear canvas and set transparent
Post by: eny on April 14, 2011, 08:45:18 pm
You are 'abusing' the paintboxes and assume that they work like controls.

The easiest fix: repaint all elements of the 'toolbar' when something changes and do it in the right order: first the 'toolbar paintbox' and then all 'button paintboxes'.

BTW: case statement  8)
TinyPortal © 2005-2018