From f3ee4be63e1c78c6f09fcb994b124533b1e5d3c1 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 15 Oct 2018 19:43:01 +0800 Subject: =?UTF-8?q?*=E6=9B=B4=E6=96=B0=E5=9B=BE=E5=BD=A2=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Graphics/Bitmap.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/libjin/Graphics/Bitmap.cpp') diff --git a/src/libjin/Graphics/Bitmap.cpp b/src/libjin/Graphics/Bitmap.cpp index acfde58..160fda2 100644 --- a/src/libjin/Graphics/Bitmap.cpp +++ b/src/libjin/Graphics/Bitmap.cpp @@ -1,4 +1,5 @@ #include "Bitmap.h" +#define STB_IMAGE_IMPLEMENTATION #include "../3rdparty/stb/stb_image.h" #include "../Math/math.h" @@ -9,6 +10,14 @@ namespace jin namespace graphics { + /* ´Ópixel´´½¨bitmap */ + Bitmap* Bitmap::createBitmap(const void* pixel, unsigned width, unsigned height) + { + Bitmap* bitmap = new Bitmap(width, height); + memcpy(bitmap->pixels, pixel, width*height * sizeof(Color)); + return bitmap; + } + /*static*/ Bitmap* Bitmap::createBitmap(const void* imgData, size_t size) { if (imgData == nullptr) @@ -48,7 +57,7 @@ namespace graphics { } - Bitmap::Bitmap(int w, int h) + Bitmap::Bitmap(unsigned w, unsigned h) { width = w; height = h; -- cgit v1.1-26-g67d0