From 6c9fa81e6860b6147f97c2a7a682e7a78eb1de27 Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Sun, 26 May 2024 18:32:29 +0200 Subject: [PATCH] Rename image import functions of pixmappaint's arsd.color integration --- pixmappaint.d | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/pixmappaint.d b/pixmappaint.d index 10a76b4..99db70d 100644 --- a/pixmappaint.d +++ b/pixmappaint.d @@ -135,26 +135,6 @@ 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 @@ -280,6 +260,24 @@ private struct OriginRectangle { } } +/++ + Creates a Pixmap wrapping the pixel data of the provided `TrueColorImage`. + + Interoperability function: `arsd.color` + +/ +Pixmap toPixmap(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 toPixmap(MemoryImage source) { + return source.getAsTrueColorImage().toPixmap(); +} + // ==== Gamut integration ==== /++