X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fimage.cc;h=e79073d4cf81e276ba32dc41f3d89df05d97ab7c;hp=c2452126572c342a39929ce0940c9604cb20ad6b;hb=e6e1e5deb60ccbb4fa175066820d81ad1bf1cefa;hpb=619c5f42a1bf0dcf16fd9210e0e4d7d42fecf5de diff --git a/src/image.cc b/src/image.cc index c245212..e79073d 100644 --- a/src/image.cc +++ b/src/image.cc @@ -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