mirror of https://github.com/adamdruppe/arsd.git
Add functions for loading image-data from arsd.color
This commit is contained in:
parent
7c3d511a33
commit
9d0c6e1d0c
|
@ -112,6 +112,26 @@ struct Pixmap {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
/++
|
||||||
|
Creates a Pixmap wrapping the pixel data from the provided `TrueColorImage`.
|
||||||
|
|
||||||
|
Interoperability function: `arsd.color`
|
||||||
|
+/
|
||||||
|
Pixmap fromTrueColorImage(TrueColorImage source) @nogc {
|
||||||
|
return Pixmap(source.imageData.colors, source.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/++
|
||||||
|
Creates a Pixmap wrapping the pixel data from the provided `MemoryImage`.
|
||||||
|
|
||||||
|
Interoperability function: `arsd.color`
|
||||||
|
+/
|
||||||
|
Pixmap fromMemoryImage(MemoryImage source) {
|
||||||
|
return fromTrueColorImage(source.getAsTrueColorImage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@safe pure nothrow @nogc:
|
@safe pure nothrow @nogc:
|
||||||
|
|
||||||
/// Height of the buffer, i.e. the number of lines
|
/// Height of the buffer, i.e. the number of lines
|
||||||
|
|
Loading…
Reference in New Issue