Function Path.opSlice

Get a PathRange for this path to iterate the paths elements.

Prototype

PathRange opSlice();

Example

import std.math, std.stdio, std.array;
//Let's create a context first and draw some lines
auto surf = new ImageSurface(Format.CAIRO_FORMAT_ARGB32, 100, 100);
auto ctx = Context(surf);
ctx.moveTo(0.0, 0.0);
ctx.lineTo(10.0, 10.0);
surf.writeToPNG("test2.png");

auto path = ctx.copyPath();
foreach(element; path[])
{
    switch(element.type)
    {
        case PathElementType.CAIRO_PATH_MOVE_TO:
            auto destination = element[0];
            writefln("Move to %s:%s", destination.x, destination.y);
            break;
        default:
    }
}


Authors

Johannes Pfau cairoD
Andrej Mitrovic cairoD
cairo team cairo

Copyright

License

cairoD wrapper/bindings Boost License 1.0
cairo LGPL 2.1 / MPL 1.1