aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Bitmap.cpp
diff options
context:
space:
mode:
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;