Recent

Author Topic: Wrong Colors when drawing to TBGRABitmap  (Read 1688 times)

bernie61

  • New Member
  • *
  • Posts: 15
Wrong Colors when drawing to TBGRABitmap
« on: February 24, 2016, 04:45:25 pm »
I'm working with Lazarus 1.4.4 in OS X (Mavericks).
When drawing a graphic on a TBGRABitmap in Linux, all works well.
I set the Font and Pen color to clBlack and draw lines using the TCanvas:

  histo.canvas.CopyRect(Dest,strip.canvas,Source);
  histo.canvas.MoveTo(_LAxis,_VTopLineY);
  histo.Canvas.LineTo(_LAxis,_VBottomLine);
  histo.Canvas.LineTo(_HYAxisPlusOne,_VBottomLine);

  etc. etc.

  But in OS X the colors for text and font are wrong. Red becames cyan and black becomes blue.

  I use TCanvas, because the code comes from Delphi, and originally it was done to work on TBitmap.

  Any tip would be welcome.

circular

  • Hero Member
  • *****
  • Posts: 4462
    • Personal webpage
Re: Wrong Colors when drawing to TBGRABitmap
« Reply #1 on: February 24, 2016, 11:22:24 pm »
You can try to use CanvasBGRA property instead of Canvas property.

Otherwise it may be related to the function "AssignRasterImage" of unit BGRALCLBitmap, that loads the content of a TBitmap. Indeed text is rendered first on TBitmap and then copied on TBGRABitmap. Can you try and debug this function to see what happens when drawing text?

One solution was proposed on this topic: http://forum.lazarus.freepascal.org/index.php/topic,29064.0.html

However, it would be great to debug the latest version.
« Last Edit: February 24, 2016, 11:29:10 pm by circular »
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018