Skip to end of metadata
Go to start of metadata

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: 17)

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 Bezier 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):

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 12, 2009

    Could It be possible to generate an option like watermark ? thx

  2. Nov 01, 2009

    There's already a Zend_Image in development which has been accepted already. Therefore I propose against implementation of this proposal, but I would like your coorperation with the Zend_Image team

  3. Aug 19, 2010

    For this proposal, feel free to use the functions in this library which handles things like resizing (with different resize modes - eg. crop, proportional, etc), compression, and different types: http://github.com/balupton/balphp/blob/master/trunk/lib/core/functions/_image.funcs.php
    They have proven to be very stable over the years.

    @Dolf, Where is the Zend_Image proposal?

    1. Aug 19, 2010

      The proposal was accepted a while back, and as such the code is now in incubator, maintained by Davind Caunt.

      Because a really, really similar component was approved already, and because there seems to be no more replies from the original author, I'm archiving this proposal, considering it abandoned.

  4. Feb 08, 2011

    Archiving this proposal, feel free to recover it when you want to work on it again. For more details see this email.