X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fimage.cc;h=e79073d4cf81e276ba32dc41f3d89df05d97ab7c;hb=a16a1a6cb3d831842f75e13653934360db617097;hp=c2452126572c342a39929ce0940c9604cb20ad6b;hpb=ccc1a688b59e25bb934a0d3e2bbf477960068d4f;p=laserbrain_demo 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