X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Ftests%2Fpointstobitmap.h;h=36db365a99f6e458efefd85f39c028056869a600;hp=90bfbdb03acb7cedc4dccb449411066756d78fa5;hb=ee5287fabfb214e8f7b483cde424108270525fd7;hpb=deb3f374a569a2d177bfae8c7fdb9d94679991f6 diff --git a/src/tests/pointstobitmap.h b/src/tests/pointstobitmap.h index 90bfbdb..36db365 100644 --- a/src/tests/pointstobitmap.h +++ b/src/tests/pointstobitmap.h @@ -2,6 +2,22 @@ #define _POINTSTOBITMAP_H #include +#include // for min/max_element + +void AntiAlias(unsigned char * pixels, uint64_t w, uint64_t h, uint8_t stride = 4) +{ + int ri = (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? 0 : 3; + int gi = (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? 1 : 2; + int bi = (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? 2 : 1; + for (uint64_t x = 1; x < w-1; ++x) + { + for (uint64_t y = 1; y < h-1; ++y) + { + uint64_t index = stride*(y*w + x); + + } + } +} /** * Map vector of points onto a Bitmap @@ -60,7 +76,16 @@ template void PointsToBitmap(const vector > & points, const pair min(left.first, bottom.second); pair max(right.first, top.second); - + // Force to be square + if (max.first - min.first > max.second - min.second) + { + max.second = min.second + (max.first - min.first); + } + else + { + max.first = min.first + (max.second - min.second); + } + Debug("Bitmap: %llf %llf -> %llf %llf", min.first, min.second, max.first, max.second); // Alternately, just do this: /* pair min(-scale, -scale);