How to draw Rectangle in TBGRAVirtualScreen.ReDraw lazarus / 39-Graphics ---------------------------------------------------------------------- freeman35 · 2014-09-29 14:08 in TBGRAVirtualScreen.ReDraw: Bitmap.CanvasBGRA.Rectangle(FNewRect, False); "Filled" Parameter is False but still draw in Rectangle question is: How to draw just Rectangle lines in BGRA? Example code for TImage Code: [Select]   with Bitmap.Canvas do begin       Pen.Mode := pmNotXOR;       Pen.Color := clBlue;       Pen.Width := 3;       with FNewRect do Rectangle(Left, Top, Right, Bottom);    end; ---------------------------------------------------------------------- circular · 2014-09-29 21:24 Ah I guess that's a bug. I have applied some fix on subversion. You can in all cases draw just the frame by setting CanvasBGRA.Brush.Style := bsClear just as you would do with usual TCanvas. ---------------------------------------------------------------------- freeman35 · 2014-10-01 08:50 Thank you very much, this code(s) working for me. Code: [Select] Bitmap.PutImage(0, 0, content, dmDrawWithTransparency); with FNewRect do begin    if (left>0)and(Right>0)then begin     //Bitmap.CanvasBGRA.Pen.Color := clBlue;     //Bitmap.CanvasBGRA.Pen.Width := 3;       //Bitmap.CanvasBGRA.Rectangle(FNewRect, False); //--> Fixed     Bitmap.CanvasBGRA.Brush.Style := bsClear;     with Bitmap.Canvas do begin        Pen.Mode := pmNotXOR;        Pen.Color := clBlue;        Pen.Width := 3;        Rectangle(Left, Top, Right, Bottom);     end;    end;  end; And I found different way too Code: [Select].... var   FNewRect : TRect; ...... content := TBGRABitmap.Create('imga.bmp'); ..... procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap); var ctx: TBGRACanvas2D; begin   ctx := Bitmap.Canvas2D;   //ctx.antialiasing := False;   Bitmap.PutImage(0, 0, content, dmDrawWithTransparency);     if (FNewRect.left>0)and(FNewRect.Right>0)then begin       ctx.lineWidth := 2;       ctx.lineStyle([2,2]);       ctx.strokeStyle(clBlue);       ctx.strokeRect(FNewRect.Left, FNewRect.Top, FNewRect.Right, FNewRect.Bottom);   end; end; ---------------------------------------------------------------------- circular · 2014-10-03 19:52 I would not recommend to use Bitmap.Canvas because it is more provided as a workaround in case you cannot use CanvasBGRA and can be slow. Normally the following should do just fine: Code: [Select]   Bitmap.CanvasBGRA.Pen.Color := clBlue;    Bitmap.CanvasBGRA.Pen.Width := 3;       Bitmap.CanvasBGRA.Brush.Style := bsClear;    Bitmap.CanvasBGRA.Rectangle(FNewRect); Or, even simpler: Code: [Select]   Bitmap.Rectangle(FNewRect, clBlue); Or: Code: [Select]   Bitmap.RectangleAntialias(FNewRect.Left,FNewRect.Top, FNewRect.Right,FNewRect.Bottom, CSSBlue, 3);