I was asked if it is easy to draw something in DfPHP.
Hm, yes it is. There is a class called Canvas… Oh!!! something familiar!
First idea was to use a PHP drawing by creating a PNG file which then uploaded to the page. It was not very fast and sometime would make you page looks ugly.
As a result, Canvas class and Bevel, Shape, PaintBox objects are based on this Js code … and you should find a few samples included with the product.
Please notice that you can still use PHP to perform drawing – see here. But as you know:
- GD library is required
- you would need to actually create an image stream which then will be sent to client – server side processing
- If you are not using layers on your page then you will get an element which is “boxed” – nothing else is being placed on it except what you have already drawn.
There is nice article at Zend DevZone about image generation using PHP itself.
But again it is your choice as programmer what is better for you in each situation.
One thing you need to remember – I will try to add this as soon as VCL for PHP is out is to able to print. For that setPrintable(true); call has to be made for jsGraphics instance.