View Issue Details

IDProjectCategoryView StatusLast Update
0012853LazarusWidgetsetpublic2020-05-26 23:42
ReporterLaurent Jacques (Wile64) Assigned ToMarc Weustink  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionreopened 
Product Version0.9.27 (SVN) 
Fixed in Version0.9.27 (SVN) 
Summary0012853: Color on Canvas dont work after assign TLazIntfImage (win32 only)
DescriptionWhen you assign LazIntfImage on a Canvas (TBitmap or Component) unable to change all color.

Dont work after this,

PreviewImage : TLazIntfImage;
PreviewBuffer: TCustomBitmap;
 
  PreviewImage.CreateBitmaps(ImgHandle, ImgMaskHandle, true);
  PreviewBuffer.SetHandles(ImgHandle, ImgMaskHandle);

ex:
  PreviewBuffer.Canvas.Pen.Color:= clWhite;
  PreviewBuffer.Canvas.Brush.Color:= clBlack;
  PreviewBuffer.Canvas.Color:= clRed;

All draw is White/White (TextOut, Line, Rectangle...)

Additional InformationThis work on Linux GTK2 but not in Windows XP.

I use FPC 2.2.3 Lazarus Last SVN
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0013505 assignedMarc Weustink TImageList.AddMasked not working with TBitmap.PixelFormat := pf32bit 

Activities

Paul Ishenin

2009-01-23 08:06

manager   ~0024658

Probably fixed in the mean time. At least this code works:

procedure TForm1.Button1Click(Sender: TObject);
var
  PreviewImage : TLazIntfImage;
  PreviewBuffer: TCustomBitmap;
  B: TBitmap;
  ImgHandle, ImgMaskHandle: HBitmap;
begin
  B := TBitmap.Create;
  B.SetSize(100, 100);
  B.Canvas.Rectangle(10, 10, 30, 30);
  PreviewImage := B.CreateIntfImage;
  PreviewImage.CreateBitmaps(ImgHandle, ImgMaskHandle, true);

  PreviewBuffer := TBitmap.Create;
  PreviewBuffer.SetHandles(ImgHandle, ImgMaskHandle);
  PreviewBuffer.Canvas.Pen.Color:= clWhite;
  PreviewBuffer.Canvas.Brush.Color:= clRed;
  PreviewBuffer.Canvas.Rectangle(40, 40, 70, 70);

  Image1.Picture.Graphic := PreviewBuffer;
end;

I see one white rectangle and one red with white border as it must be.

If it is not fixed for you please attach a simple test application. In other case please close.

Laurent Jacques (Wile64)

2009-02-04 16:31

developer   ~0025111

I add sample

2009-02-04 16:31

 

testlazimage.zip (3,077 bytes)

Marc Weustink

2009-08-12 00:37

administrator   ~0029768

This will take some releases before it gets fixed. First we need full alpha support for pens and brushes. Second we need drawing support on a canvas with alpha channel. Currently the windows GDI doesn't support this.
What you do is creating a bitmap with alpha channel and use that as canvas. The results fo GDI in this case are not very predictable

Paul Ishenin

2011-11-05 18:46

manager   ~0053826

Windows does not support alpha drawing on 32 bit bitmaps. Fixing this can wait after 1.0 and even later.

Issue History

Date Modified Username Field Change
2008-12-24 10:05 Laurent Jacques (Wile64) New Issue
2008-12-24 10:05 Laurent Jacques (Wile64) LazTarget => -
2008-12-24 10:05 Laurent Jacques (Wile64) Widgetset => Win32
2009-01-19 13:51 Vincent Snijders LazTarget - => 1.0
2009-01-19 13:51 Vincent Snijders Status new => acknowledged
2009-01-19 13:51 Vincent Snijders Target Version => 1.0.0
2009-01-23 08:06 Paul Ishenin Status acknowledged => resolved
2009-01-23 08:06 Paul Ishenin Fixed in Version => 0.9.27 (SVN)
2009-01-23 08:06 Paul Ishenin Resolution open => fixed
2009-01-23 08:06 Paul Ishenin Assigned To => Paul Ishenin
2009-01-23 08:06 Paul Ishenin Note Added: 0024658
2009-02-04 16:31 Laurent Jacques (Wile64) Assigned To Paul Ishenin =>
2009-02-04 16:31 Laurent Jacques (Wile64) Status resolved => assigned
2009-02-04 16:31 Laurent Jacques (Wile64) Resolution fixed => reopened
2009-02-04 16:31 Laurent Jacques (Wile64) Note Added: 0025111
2009-02-04 16:31 Laurent Jacques (Wile64) File Added: testlazimage.zip
2009-08-07 13:44 Vincent Snijders Assigned To => Paul Ishenin
2009-08-12 00:33 Marc Weustink Assigned To Paul Ishenin => Marc Weustink
2009-08-12 00:37 Marc Weustink Note Added: 0029768
2011-04-04 05:36 Paul Ishenin LazTarget 1.0 => 0.99.0
2011-04-04 05:37 Paul Ishenin Target Version 1.0.0 => 0.99.0
2011-09-28 15:46 Felipe Monteiro de Carvalho LazTarget 0.99.0 => 1.0
2011-10-28 10:06 Vincent Snijders LazTarget 1.0 => 0.99.0
2011-10-28 10:08 Vincent Snijders Assigned To Marc Weustink => Paul Ishenin
2011-11-05 18:45 Paul Ishenin LazTarget 0.99.0 => -
2011-11-05 18:45 Paul Ishenin Assigned To Paul Ishenin => Marc Weustink
2011-11-05 18:45 Paul Ishenin Target Version 0.99.0 =>
2011-11-05 18:46 Paul Ishenin Note Added: 0053826
2011-11-05 18:46 Paul Ishenin Relationship added related to 0013505