Last update Sun May 11 01:02:35 2014

dmagick.ImageView

License:
zlib (See accompanying LICENSE file)

Authors:
Mike Wey

class ImageView;

The ImageView allows changing induvidual pixels with the slicing and indexing operators.

ImageView view = image.view();

//Assign a square.
view[4..40][5..50] = new Color("red");

//Reduce a view.
view = view[10..view.extend.height-10][20..view.extend.width-20];

//Assign a single row.
view[30] = new Color("blue");
//Or a column.
view[][30] = new Color("blue");
//And induvidual pixels.
view[3][5] = new Color("green");

//We can also use foreach.
foreach ( row; view )
{
    //This is executed in parallel.
    foreach ( ref pixel; row )
        pixel = new Color("black");
}

this(Image image, Geometry area);

Create a new view for image.

const @property size_t width();

The width of the view.

const @property size_t height();

The height of the view.

const size_t opDollar();

The height or the width of the view, depending on in which slice it's used.

BUGS:
dmd bug 7097: opDollar doesn't work with slicing.

Pixels opIndex(size_t row);
void opIndexAssign(Color color, size_t index);

Indexing operators yield or modify the value at a specified index.

ImageView opSlice();
ImageView opSlice(size_t upper, size_t lower);
void opSliceAssign(Color color);
void opSliceAssign(Color color, size_t upper, size_t lower);

Sliceing operators yield or modify the value in the specified slice.

int opApply(int delegate(Pixels) dg);

Support the usage of foreach to loop over the rows in the view. The foreach is executed in parallel.

struct Pixels;

Row reprecents a singe row of pixels in an ImageView.

this(Image image, ssize_t x, ssize_t y, size_t columns, size_t rows);

Get the pixels of the specifies area in the image.

const @property size_t length();
const size_t opDollar();

The number of pixels in this row / column.

BUGS:
dmd bug 7097: opDollar doesn't work with slicing.

Color opIndex(size_t pixel);
void opIndexAssign(Color color, size_t index);

Indexing operators yield or modify the value at a specified index.

Pixels opSlice();
Pixels opSilce(size_t left, size_t right);
void opSliceAssign(Color color);
void opSliceAssign(Color color, size_t left, size_t right);

Sliceing operators yield or modify the value in the specified slice.

void sync();

Sync the pixels back to the image. The destructor does this for you.

int opApply(T : Color)(int delegate(ref T) dg);

Support using foreach on a row.