Example #1
0
    PotraceImage::PotraceImage(const IBWRecognizer& bwRecognizer, const RasterImage& rasterImg) {
        pixelMap = NULL;
        isInvertedMap = NULL;
        BuildMaps(bwRecognizer, rasterImg);

        this->width = rasterImg.GetWidth();
        this->height = rasterImg.GetHeight();
    }
Example #2
0
    void PotraceImage::BuildMaps(const IBWRecognizer& bwRecognizer, const RasterImage& rasterImg) {
        long numberOfPixels = rasterImg.GetWidth() * rasterImg.GetHeight();
        pixelMap = new PixelColor::Enum[numberOfPixels];

        long currentPixelIndex = 0;

        for (image_size_t y = 0; y < rasterImg.GetHeight(); ++y) {
            for (image_size_t x = 0; x < rasterImg.GetWidth(); ++x) {
                pixelMap[currentPixelIndex] = bwRecognizer.GetPotraceColor(rasterImg.GetColor(x, y));
                ++currentPixelIndex;
            }
        }

        isInvertedMap = new bool[numberOfPixels];
        for (long i = 0; i < numberOfPixels; ++i) {
            isInvertedMap[i] = false;
        }
    }