Open pparuzel opened 6 years ago
The returned pointer array is not of size imgsize.x * imgsize.y This is in RGBA so there are 4 values for each pixel.
https://github.com/zyedidia/SFML.jl/blob/6c85e6f9a0def67ed78104f7b1facb80f482d2ce/src/julia/Graphics/image.jl#L43
Solution:
function get_pixels(image::SFML.Image) imgsize = get_size(image) ptr = ccall((:sfImage_getPixelsPtr, SFML.libcsfml_graphics), Ptr{UInt8}, (Ptr{Void},), image.ptr) # Here multiply by 4 convert(Array{UInt8}, unsafe_string(ptr, imgsize.x * imgsize.y * 4)) end
The returned pointer array is not of size imgsize.x * imgsize.y
This is in RGBA so there are 4 values for each pixel.
https://github.com/zyedidia/SFML.jl/blob/6c85e6f9a0def67ed78104f7b1facb80f482d2ce/src/julia/Graphics/image.jl#L43
Solution: