Added by Pawel Przeradowski, last edited by Pawel Przeradowski on Nov 26, 2008  (view change)

Labels

 
(None)

Zend Framework: Zend_Gfx Component Proposal

Proposed Component Name Zend_Gfx
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Gfx
Proposers Pawel Przeradowski
Zend Liaison TBD
Revision 0.1 - 15 November 2008: Initial Draft.
0.1.1 - 18 November 2008: Updated class diagram.
0.1.2 - 23 November 2008: Added simple use cases. (wiki revision: 16)

Table of Contents

1. Overview

Zend_Gfx is an ecosystem of graphics processing classes that try to grasp best techniques from drawing APIs available around. It's based on Adapter pattern and targets to integrate well with ZF design.

Proof-of-concept implementation in progress.

2. References

Adapter references:

Drawing API design:

Math:

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will support both GD2 and ImageMagick backends.
  • This component will implement drawing API (geometric primitives, strokes and fills etc), image transformations (rotates, flips, skews etc) and image processing (filters, blurs, brightness, etc).
  • This component will have text drawing APIs with support of bounding boxes and alignment.
  • This component will understand a subset of CSS specification in context of color selection (rgb(a,b,c), rgba(a, b, c,d), hsl(a,b,c), hsla(a,b,c,a), #abc, #aabbcc, svg color names eg. "white").
  • This component will support image and gradient fills, either natively or will allocate gradient
    surfaces (in case of GD2)
  • This component will support batch processing through Zend_Gfx_Batch.
  • This component should support matrix stroke transformations
  • This component should support Beizer curves
  • This component should have stock geometry factory (autoshapes) like arrows, stars, etc. (See MS Office)
  • This component may support layers
  • This component may have pure-PHP SVG write and adapter support
  • This component may implement drawing API adapter to Zend_Pdf
  • This component may implement write support adapter to WHATWG Canvas Element (outputs JavaScript)
  • This component may support crop masks

4. Dependencies on Other Framework Components

  • Zend_Exception
  • Zend_Pdf (optional) ?

5. Theory of Operation

All the drawing operations are proxied by Zend_Gfx_Image into specific Zend_Gfx_Adapter_Abstract implementation. Additionally there are Zend_Gfx_Fill and Zend_Gfx_Stroke classes which encapsulate stroke and fill information.

6. Milestones / Tasks

  • Milestone 1: The proposal is complete
  • Milestone 2: The proposal is put under community review
  • Milestone 3: The proposal is reviewed by Zend
  • Milestone 4: Working prototype checked into the incubator supporting use cases #1, #2, ...
  • Milestone 5: Working prototype checked into the incubator supporting use cases #3 and #4.
  • Milestone 6: Unit tests exist, work, and are checked into SVN.
  • Milestone 7: Initial documentation exists.

If a milestone is already done, begin the description with "[DONE]", like this:

  • Milestone #: [DONE] Unit tests ...

7. Class Index

  • Zend_Gfx_Image
  • Zend_Gfx_Adapter_Abstract
  • Zend_Gfx_Adapter_Gd2
  • Zend_Gfx_Adapter_ImageMagick
  • Zend_Gfx_Adapter_Svg ?
  • Zend_Gfx_Adapter_Pdf ?
  • Zend_Gfx_Adapter_HtmlCanvas ?
  • Zend_Gfx_Fill_Abstract
  • Zend_Gfx_Fill_Color
  • Zend_Gfx_Fill_Image
  • Zend_Gfx_Fill_Gradient
  • Zend_Gfx_Stock
  • Zend_Gfx_Stroke
  • Zend_Gfx_Color
  • Zend_Gfx_SvgPalette
  • Zend_Gfx_Batch

8. Use Cases

9. Class Skeletons

Draft class diagram (does not include image transformation and processing operations yet):