aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Bitmap.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-15 19:43:01 +0800
committerchai <chaifix@163.com>2018-10-15 19:43:01 +0800
commitf3ee4be63e1c78c6f09fcb994b124533b1e5d3c1 (patch)
tree4dc9579b101de66b97ea0b5706f1d64f84b4f666 /src/libjin/Graphics/Bitmap.cpp
parentbd3c1f268d959d351631b51d32d9912370144ddd (diff)
*更新图形模块
Diffstat (limited to 'src/libjin/Graphics/Bitmap.cpp')
-rw-r--r--src/libjin/Graphics/Bitmap.cpp11
1 files changed, 10 insertions, 1 deletions
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
{
+ /* pixelbitmap */
+ 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;