Recent

Author Topic: CanvasRenderingContext2D in Pascal or C++  (Read 2399 times)

sarason

  • Jr. Member
  • **
  • Posts: 77
CanvasRenderingContext2D in Pascal or C++
« on: October 17, 2015, 09:35:06 am »
I am trying to port a web graphics application back to Lazarus Pascal and C++ Builder.
It doesn't need any of the alpha channel stuff but it does need rotations and transforms.
Specifically:

ctx.clearRect
ctx.canvas.width
ctx.canvas.height
ctx.save();   
ctx.transform()
ctx.canvas.height;
ctx.translate()
ctx.restore();
ctx.lineCap
ctx.strokeStyle
ctx.beginPath();
ctx.moveTo(wire.x1, wire.y1);
ctx.lineTo(wire.x2, wire.y2);
ctx.lineWidth = wire.width;
ctx.stroke();
ctx.lineCap = 'round';
ctx.strokeStyle = color;
ctx.beginPath();
ctx.moveTo(wire.x1, wire.y1);
ctx.lineTo(wire.x2, wire.y2);
ctx.lineWidth = wire.width;
ctx.stroke();
ctx.strokeStyle
ctx.beginPath();
ctx.arc();
ctx.lineWidth
ctx.stroke();

Now is there a library available that does this without Java dependencies?
A code fragment someone has implemented?
A better way ?

regards sarason

Leledumbo

  • Hero Member
  • *****
  • Posts: 8244
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: CanvasRenderingContext2D in Pascal or C++
« Reply #1 on: October 17, 2015, 02:34:06 pm »
Now is there a library available that does this without Java dependencies?
A code fragment someone has implemented?
A better way ?
LCL, BGRABitmap, anything else with TCanvas descendant or similar implementation minus the path things.

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: CanvasRenderingContext2D in Pascal or C++
« Reply #2 on: October 17, 2015, 07:05:12 pm »
LCL, BGRABitmap, anything else with TCanvas descendant or similar implementation minus the path things.
[/quote]
I'll add also AggPas (available from Lazarus -> Package -> Install / Uninstall -> find package "aggpaslcl"). But AFAIK it has bugs on linux
http://www.crossgl.com/aggpas/aggpas-demo.htm

circular

  • Hero Member
  • *****
  • Posts: 3381
    • Personal webpage
Re: CanvasRenderingContext2D in Pascal or C++
« Reply #3 on: October 22, 2015, 07:24:48 pm »
BGRABitmap library provides a Canvas2d property which imitates HTML5 functions and syntax
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: CanvasRenderingContext2D in Pascal or C++
« Reply #4 on: October 22, 2015, 08:10:23 pm »
Get last version of BGRABitmap and compile project in the testcanvas2d folder and take a look at test number 16 its show you an easy and fast way to use.

 

TinyPortal © 2005-2018