Path.opSlice

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

struct Path
opSlice
()

Examples

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:
    }
}

Meta