c++ – How am i able to repair the inaccurate colours that SDL_RenderReadPixels() returns on Android?

c++ – How am i able to repair the inaccurate colours that SDL_RenderReadPixels() returns on Android?

[ad_1]

I wish to be sincere… I’ve already requested this query in a distinct (extra detailed) type on Stack Overflow, however sadly i have never obtained a helpful reply but:
https://stackoverflow.com/q/77469824/22902214

I have been engaged on a 2D sport for a while and there must also be an editor in it. A deliberate a part of it is a sprite cutter, which breaks down sprite sheets into adjustable particular person components and saves them (additionally with colour keying if needed) as a png file.

Nonetheless, we’d like the pixel knowledge of the feel (which is SDL_TEXTUREACCESS_TARGET) in an effort to convert it into an SDL_Surface to put it aside. This may solely be finished with SDL_RenderReadPixels().

For some purpose that I do not know (Android? / Pill-{Hardware}?), the SDL_RenderReadPixels perform would not give me any pixels with usable colour values. I’ve actually tried all the things possible to alter that.

Right here you see authentic colours:
Original color

That is what i get after SDL_RenderReadPixels():
After SDL_RenderReadPixels

And right here i attempted to repair the colours with my rearrangePixels methodology:
After i tried to fix the Colors

For the detailed code i exploit please click on on the hyperlink on the highest.

I can not proceed my mission that I’ve been engaged on for a number of years with out correcting this problem.

Assist!

[ad_2]

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply