X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fimage.cc;h=57817ca9410079c8d24bfdb46e59a5b022b457f9;hb=197bafc7f54795243d4c217c2efcf41f01d4100d;hp=c2452126572c342a39929ce0940c9604cb20ad6b;hpb=ccc1a688b59e25bb934a0d3e2bbf477960068d4f;p=laserbrain_demo diff --git a/src/image.cc b/src/image.cc index c245212..57817ca 100644 --- a/src/image.cc +++ b/src/image.cc @@ -1,9 +1,9 @@ #include -#ifndef _MSC_VER -#include -#else +#if defined(WIN32) || defined(__WIN32__) #include +#else +#include #endif #include "imago2.h" @@ -143,6 +143,34 @@ void Image::rotate_180() flip_horizontal(); } +void Image::resize_half() +{ + int pixsz = pixel_size(fmt); + int newxsz = width / 2; + int newysz = height / 2; + + if(!newxsz || !newysz) return; + + unsigned char *newpix = new unsigned char[newxsz * newysz * pixsz]; + + unsigned char *sptr = (unsigned char*)pixels; + unsigned char *dptr = newpix; + + for(int i=0; i