aurimasg / blaze

Multi-threaded, CPU-based vector graphics rasterizer.
https://gasiulis.name
MIT License
111 stars 2 forks source link

Image not drawn correctly. #4

Open THZthz opened 10 months ago

THZthz commented 10 months ago

I write a simple program in c++ to quickly dive into Blaze. But the image I got is broken.

Here is how it looks like:

Tiger_out

I guess something was wrong with the multi-threading, but I can't figure out why.

Further information:

Cmakelists:

image

Load vectorimage:

// static VectorImage g_vectorImage;
g_vectorImage.Parse(reinterpret_cast<const uint8 *>(buffer), size);

Update image:

int fw, fh;
glfwGetFramebufferSize(window, &fw, &fh); // Fill the window.
g_image.UpdateSize({fw, fh});
g_image.ClearImage();
g_image.DrawImage(g_vectorImage, Matrix::Identity);

I use stbi_write_png to save the output:

// static DestinationImage<TileDescriptor_16x8> g_image;
const int imgw = g_image.GetImageWidth();
const int imgh = g_image.GetImageHeight();
const uint8_t *data = g_image.GetImageData();

stbi_write_png("Tiger_out.png", imgw, imgh, 4, data, 4 * imgw);
aurimasg commented 9 months ago

@THZthz Which compiler and OS do you use?

THZthz commented 9 months ago

gcc 13.1.0 windows image