This article will show you how to use PHP to build an object-oriented graphic layer. Using an object-oriented () system can be used to build complex () graphics, which is much simpler (rather) than using the basic functions provided in the standard PHP library. I divided the graphic editing program into two types: a class (yes) plotting program, which can be used to draw images in one pixel or one pixel (ground), and a class (yes) plotting program, this type of program provides a set of objects, such as a line, an ellipse, and a rectangle. you can use these objects to combine them into a large image, such as JPEG. The plotting program is ideal for pixel-level control. But (yes) for business graphics, the plotting program (yes) is better (), because most graphics (yes) are composed of rectangles, lines, and edges ).
The basic operations of PHP built-in () plotting are very similar to those of the plotting program. They are very powerful for image rendering; but (yes) this is not suitable if you want your () image (yes) to be a set of objects. This article will show you how to build an object-oriented graphics library based on the PHP graphics library. You will use the () Object-Oriented () extension provided in PHP V5.
With the support of object-oriented () graphics, your () graphic code is very easy to understand and maintain. You may also need to synthesize images from a single () graphics source into multiple types of media: Flash movies, SVG, and so on.
Target
Creating a Graph object library includes three main targets:
Switch from basic operation to object
It does not use imageline, imagefilledrectangle, and other graphic functions. this library should provide some objects, such as Line, Rectangle, and Oval, which can be used to create images. It should also support building larger complex objects or grouping objects.
Z-value sorting is supported.
The plotting program allows the painter to move the graphic objects up and down on the screen surface. This library should support the function of placing an object before and after other objects: it uses a z value to define the height of an object starting from the drawing plane. The larger the value of z, the later the object is drawn (obtained), and (that is,) appears on objects with smaller z values.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.