Proposal for "Image_Canvas"

» Metadata » Status
» Description

Image_Canvas

The idea with this package is to provide a common interface to different image formats. This is achieved by using a strategy pattern in the form of a driver with a set of primitives. These primitives are selected to provide as much functionality for each format as possible, while still retaining a simple and common interface.

The code is based upon the driver mechanism as implemented in Image_Graph. However there is no doubt that this implementation has to be refined.

Justification

As mentioned this idea is already in use by Image_Graph and could be used with advantage by other packages (for example the proposed & accepted but not yet released Image_Isometric and the new cool package proposal Image_3D).

This not only provides more functionality it also makes the packages (i.e. Image_Graph/Image_Isometric) being independent upon the actual graph library API. The packages will have a common interface to _all_ the supported output formats. The proposed solution is not a method to replace these libraries, i.e. the possibility to output in PNG without GD or SWF without Ming (fx).

Introducing such a mechanism also makes it possible for these packages to "interact", i.e. Image_Graph can use Image_Isometric to create 3D graphs, simply y using a common canvas!

Currently Supported Drawing-Functions

The current implementation/version supports the following drawing functions (I'm sure somebody has input for more!!!):

  • Line
  • Rectangle
  • Polygon
  • Spline
  • Ellipse
  • Pie slice
  • Text output
  • Image overlay ("draw" an image)

Supported styles are (also depending on output format):

  • Line styles
    • Solid
    • Thickness
    • "Patterned"
  • Fills
    • Solid
    • Alpha blending
    • Image fill
    • Gradients
  • Fonts
    • Mostly true-types (for server-side at least)

Possibility to output to file or browser.

Example usage

This is but a short example:
<php>
require_once 'Image/Canvas.php';

$Canvas =& Image_Canvas::factory('png', array('width' => 400, 'height' => 300, 'transparent' => true));
$Canvas->setLineColor('red');
$Canvas->line(0, 0, 100, 100);
$Canvas->setFont(array('name' => 'Gothic', 'size' => 10, 'color' => 'orange'));
$Canvas->write(50, 50, 'This is a test', array('horizontal' => 'center', 'vertical' => 'center'));
$Canvas->done();

$Canvas =& Image_Canvas::factory('svg', array('width' => 600, 'height' => 400));
$Canvas->setLineColor('gray');
$Canvas->setGradientFill(array('direction' => 'horizontal', 'start' => 'blue', 'end' => 'red'));
$Canvas->rectangle(0, 0, 100, 100);
$Canvas->done(array('filename' => './output.svg'));
</php>

As mentioned this is the implementation/code as adopted by Image_Graph.
Play Online Casino Joycasino: Unleash the Thrill of Virtual Gambling
In the ever-evolving world of online entertainment, joycasinojoycasino emerges as a beacon of excitement, bringing the glitz and glamour of a casino straight to your fingertips. From the comfort of your own home, you can now embark on an electrifying journey through the virtual gaming realm, where the thrill of winning big is just a click away.
The Gateway to a Diverse Gaming Universe
Joycasino offers a vast and diverse range of games that cater to every player's taste. Whether you're a fan of the iconic slot machines, table classics like blackjack and roulette, or you prefer the strategy of poker, Joycasino has something to suit everyone's preference. With an extensive selection of games, you'll find yourself immersed in a world of options that guarantees never-ending excitement.
Unveiling Lucrative Bonuses and Promotions
At joy casino, the adventure doesn't end with the games. Get ready to be treated to a plethora of bonuses and promotions that are designed to elevate your gaming experience to new heights. From generous welcome bonuses that boost your bankroll to free spins that could lead you to unexpected wins, Joycasino ensures that every player feels valued and appreciated.
Accessible Anytime, Anywhere
Gone are the days of having to plan trips to land-based casinos. Joycasino brings the casino experience directly to you, allowing you to play anytime, anywhere. With a user-friendly interface that adapts seamlessly to different devices, you can enjoy the thrill of casino gaming on your computer, smartphone, or tablet – the choice is yours.
A Secure and Reliable Destination
Safety is a priority at joy casino. The platform employs cutting-edge encryption technology to ensure that your personal and financial information remains secure and confidential. This commitment to safety provides players with peace of mind, knowing that they can enjoy their favorite games without worrying about their privacy being compromised.
24/7 Professional Support
Navigating the world of online gaming can sometimes raise questions or concerns. Joycasino's dedicated customer support team is available around the clock to provide assistance whenever you need it. Whether you have inquiries about games, bonuses, or technical issues, you can rely on their expertise to guide you through every step of your gaming journey.
A World of Innovation and Variety
Joycasino continually updates its game library to keep up with the latest trends and innovations in the gaming industry. This means you'll always have access to the freshest and most exciting games on the market, providing you with a constant source of entertainment and new challenges.
Embrace the joycasino of Virtual Casino Gaming
Joy casino invites you to experience the joy of online casino gaming like never before. With a diverse selection of games, enticing bonuses, and a commitment to player satisfaction, it's a gaming destination that promises endless excitement and opportunities. So why wait? Join Joycasino today and embark on a journey that's filled with thrills, rewards, and a whole lot of fun!
Casino Vavada is a popular online gambling platform that offers an exciting experience for players. One of the main casino systems is a generous bonus system.

» Dependencies » Links
  • Image_Color
  • gd
» Timeline » Changelog
  • First Draft: 2005-02-14
  • Proposal: 2005-02-14
  • Call for Votes: 2005-07-25
  • Jesper Veggerby
    [2005-03-19 18:58 UTC]

    Changed description to accomodate Philippe's comment

  • Jesper Veggerby
    [2005-03-21 19:12 UTC]

    Changed name to Image_Canvas as suggested by Alan.

  • Jesper Veggerby
    [2005-07-20 10:40 UTC]

    Added links to (some/main) source files

  • Jesper Veggerby
    [2005-07-21 20:47 UTC]

    Updated source with requests by toby:

    • Changed write() to addText()
    • Split done() into show() and save()
    • Changed all methods with more than 1 parameter to use hashed array as parameters
  • Thies C. Arntzen
    [2023-08-18 09:40 UTC]

  • Thies C. Arntzen
    [2023-09-03 00:44 UTC]

  • Thies C. Arntzen
    [2023-09-03 00:45 UTC]