summaryrefslogtreecommitdiff
path: root/src/graphics/Graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/Graphics.cpp')
-rw-r--r--src/graphics/Graphics.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp
index 0fa5935..11dcac3 100644
--- a/src/graphics/Graphics.cpp
+++ b/src/graphics/Graphics.cpp
@@ -32,6 +32,25 @@ VideoBuffer::VideoBuffer(VideoBuffer * old):
std::copy(old->Buffer, old->Buffer+(old->Width*old->Height), Buffer);
};
+void VideoBuffer::Resize(float factor, bool resample)
+{
+ int newWidth = ((float)Width)*factor;
+ int newHeight = ((float)Height)*factor;
+ pixel * newBuffer;
+ if(resample)
+ newBuffer = Graphics::resample_img(Buffer, Width, Height, newWidth, newHeight);
+ else
+ newBuffer = Graphics::resample_img_nn(Buffer, Width, Height, newWidth, newHeight);
+
+ if(newBuffer)
+ {
+ delete[] Buffer;
+ Buffer = newBuffer;
+ Width = newWidth;
+ Height = newHeight;
+ }
+}
+
int VideoBuffer::SetCharacter(int x, int y, int c, int r, int g, int b, int a)
{
int i, j, w, bn = 0, ba = 0;