diff --git a/pixmappaint.d b/pixmappaint.d index 52846c5..1cc9701 100644 --- a/pixmappaint.d +++ b/pixmappaint.d @@ -112,6 +112,26 @@ struct Pixmap { 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: /// Height of the buffer, i.e. the number of lines