[SDL2]-Open PNG Image & Read Individual Pixel Color?

[SDL2]-Open PNG Image & Read Individual Pixel Color?

Hi,

The new 3D Ray Casting game is delayed.
I am currently porting “PacDude Hero” from SDL1 to SDL2.

How can I open a PNG image and read individual pixel colors with SDL2?
(speed does not matter - it would be done once at start of application)
The board layouts and ghost return to home are both saved as small PNG images.
(and data is read from PNG based on color of pixels)

Thanks!------------------------
JeZxLee
JessePalser <AT> GMail <DOT> com
16BitSoft Inc.
Video Game Design Studio
www.16BitSoft.com

You can just load it into a surface with sdl_image. The following shows how
to read pixels from surfaces. IIUC the surface apis have not changed much
between sdl2 and sdl 1.

http:// http://sdl.beuc.net/sdl.wiki/Pixel_Accesssdl.beuc.net
http://sdl.beuc.net/sdl.wiki/Pixel_Access/
http://sdl.beuc.net/sdl.wiki/Pixel_Accesssdl.wiki
http://sdl.beuc.net/sdl.wiki/Pixel_Access/Pixel_Access
http://sdl.beuc.net/sdl.wiki/Pixel_Access

http://lazyfoo.net/SDL_tutorials/lesson31/index.phpOn Sun, Jun 7, 2015, 11:45 AM JeZ-l-Lee wrote:

[SDL2]-Open PNG Image & Read Individual Pixel Color?

Hi,

The new 3D Ray Casting game is delayed.
I am currently porting “PacDude Hero” from SDL1 to SDL2.

How can I open a PNG image and read individual pixel colors with SDL2?
(speed does not matter - it would be done once at start of application)
The board layouts and ghost return to home are both saved as small PNG
images.
(and data is read from PNG based on color of pixels)

Thanks!


JeZxLee
JessePalser GMail com
16BitSoft Inc.
Video Game Design Studio
www.16BitSoft.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org