Home  >  Article  >  Backend Development  >  Clever Ways to Create Graphics with PHP 5.0_PHP Tutorial

Clever Ways to Create Graphics with PHP 5.0_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:33:42747browse

I divide graphics editing programs into two categories: one type (is) a drawing program, which can be used to draw an image pixel by pixel (ground); the other type (is) a drawing program, which provides a set of objects , such as lines, ellipses, and rectangles, you can use these objects to combine into a large image, such as a JPEG. Painting programs are great for pixel-level control. But for business graphics, drawing programs are a better way, because most graphics are composed of rectangles, lines, and ellipses.

PHP’s built-in basic drawing operations are very similar to drawing programs. They are very powerful for drawing images; but they are not suitable if you want your image to be a collection 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 extensions provided in PHP V5.

With object-oriented graphics support, your graphics code is very easy to understand and maintain. You may also need to composite graphics from a single graphics source into multiple types of media: Flash movies, SVG, etc.

Goals

Creating a graphical object library includes 3 main goals:

Switching from basic operations to objects

It does not use imageline, imagefilledrectangle and other graphics functions. This library should provide some objects such as Line, Rectangle and Oval, which can be used to make images. It should also support building larger complex objects or grouping objects.

Ability to perform z-value sorting

The drawing program allows painters to move graphic objects up and down on the surface of the screen. This library should support the ability to place an object in front of or behind other objects: it uses a z value that defines the height of the object from the drawing plane. Objects with larger z-values ​​are drawn later, appearing above those with smaller z-values.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322542.htmlTechArticleI divide graphic editing programs into two categories: one (is) drawing program, using this program you can Draw images pixel by pixel; another type of drawing program provides...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn