Recent

Author Topic: [SOLVED] BGRA connector and zoom rect  (Read 2754 times)

bp

  • New member
  • *
  • Posts: 8
[SOLVED] BGRA connector and zoom rect
« on: June 01, 2014, 07:17:21 am »
I've tried to use BGRA connector for chart drawing and got perfect results compared to standard GTK2 renderer. There was some minor problems, but the real show stopper is the invisibility of "Zoom" tool - the rectangle are completely invisible, while the tool works correctly. It was tracked down to BGRADrawer and confirmed, that it actually draws a rectangle on bitmap, but it doesn't reflected on screen. So, when and how bitmap should be displayed?

On a side note, drawer interface probably should have drawFocusRect() method, but this is not important now.
« Last Edit: June 04, 2014, 07:57:51 am by bp »

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: BGRA connector and zoom rect
« Reply #1 on: June 02, 2014, 05:29:35 pm »
Don't use the internal zooming tool in order to get more control. Add a TCharttools component - this disables the built-in zoom tool. Link it to the Tools property of the chart. Double-click on the ChartTools and  add a TZoomDragTool. Set its Shift to ssLeft (in order to zoom by means of the left mouse key). In order to paint on the BGRA bitmap it seems to be essential to use the tdmNormal DrawingMode of the ZoomTool. You can also modify LineStyle/Color of the zoom rect here.

Alternatively, you could also write your own OnInitBuiltInTools handler (just copy TATools.InitBuiltInTools and add DrawingMode := tdmNormal) and assign it to the global function OnInitBuiltinTools in the initialization section of your main unit; just seek for "OnInitBuiltinTools" in TATools and TAGraph to understand the mechanism) - this would allow you to keep the builtin zoom tool. But to be honest the first approach is much simpler...

This works for me with the bgra demo that come with Lazarus (see folder demo/bgra). If it does not work for you please post a small demo application which shows the issue.

bp

  • New member
  • *
  • Posts: 8
Re: BGRA connector and zoom rect
« Reply #2 on: June 04, 2014, 07:56:55 am »
In order to paint on the BGRA bitmap it seems to be essential to use the tdmNormal DrawingMode of the ZoomTool.

Thanks, tdmNormal seems to be the key setting. Now zoom rectangle draws properly albeit a bit slow compared to the non-BGRA mode and with high CPU usage. But slowness seems to be a property of BGRA itself or the way it is connected to TAChart because native redrawing of chart takes about 8-10mS and 280-300mS with BGRA.

 

TinyPortal © 2005-2018