Skip to content

VGPaint

A VGPaint describes how a shape is filled or stroked with something richer than a flat color: a gradient or an image. It is an opaque handle with no methods or properties of its own. You obtain one from a factory and then hand it to the context to use it.

namespace GL\VectorGraphics
{
    class VGPaint {}
}

You create a VGPaint from one of:

And you use it with:

Looking for a walkthrough?

The Gradients and Images user guides show paints in action.

Usage

use GL\VectorGraphics\VGColor;

// build a paint from a gradient
$paint = $vg->linearGradient(0, 0, 0, 200, VGColor::red(), VGColor::blue());

// use it as the fill for the next shape
$vg->beginPath();
$vg->rect(0, 0, 200, 200);
$vg->fillPaint($paint);
$vg->fill();