![]() |
Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
|
JPEG read/write backend using libjpeg. More...
#include <iostream>#include <stdio.h>#include "jpeglib.h"#include <setjmp.h>#include "image_data.hpp"Go to the source code of this file.
Classes | |
| struct | codec_error_mgr |
Typedefs | |
| typedef struct codec_error_mgr * | codec_error_mgr_ptr |
Functions | |
| static void | SaveTextureFileJpeg (rendering_engine::ImageData const &imageData, char const *filename) |
| Saves image data to a JPEG file. | |
| codec_error_exit (j_common_ptr cinfo) | |
| static bool | DoReadJpegFile (struct jpeg_decompress_struct *cinfo, char const *filename, unsigned int &width, unsigned int &height, std::vector< unsigned int > &rgbImageDataVector) |
| static bool | ReadJpegFile (char const *filename, unsigned int &width, unsigned int &height, std::vector< unsigned int > &rgbImageDataVector) |
| Reads a JPEG file into an RGB image buffer. | |
| static bool | ReadJpegFromMemory (const unsigned char *memory, size_t memorySize, unsigned int &width, unsigned int &height, std::vector< unsigned int > &rgbImageDataVector) |
| Decode a JPEG image directly from a memory buffer. | |
JPEG read/write backend using libjpeg.
Provides low-level I/O routines bridging ImageData and the libjpeg API. Supports 8-bit RGB images for loading and saving.
The implementation follows the official libjpeg API workflow:
Custom error handling is implemented via codec_error_mgr to safely recover from libjpeg�s internal longjmp behavior.
Definition in file image_codec_jpeg.hpp.
| typedef struct codec_error_mgr* codec_error_mgr_ptr |
Definition at line 98 of file image_codec_jpeg.hpp.
| codec_error_exit | ( | j_common_ptr | cinfo | ) |
Definition at line 105 of file image_codec_jpeg.hpp.
|
static |
Definition at line 154 of file image_codec_jpeg.hpp.
|
static |
Reads a JPEG file into an RGB image buffer.
| filename | Path to input JPEG file. |
| width | [out] Image width in pixels. |
| height | [out] Image height in pixels. |
| rgbImageDataVector | [out] Output vector of RGB pixel data (3 bytes per pixel). |
Definition at line 135 of file image_codec_jpeg.hpp.
|
static |
Decode a JPEG image directly from a memory buffer.
This function behaves similarly to ReadJpegFile(), but instead of reading from disk, it reads raw JPEG bytes already loaded in memory.
Useful when assets are stored in:
The function expects the buffer to contain valid JPEG-formatted data.
| memory | Pointer to the start of the JPEG byte stream. |
| memorySize | Total size of the memory buffer in bytes. |
| width | [out] Decoded image width in pixels. |
| height | [out] Decoded image height in pixels. |
| rgbImageDataVector | [out] Output RGB pixel buffer (3 bytes per pixel). |
Definition at line 314 of file image_codec_jpeg.hpp.
|
static |
Saves image data to a JPEG file.
| imageData | Source image in RGB format. |
| filename | Path to the output file. |
Definition at line 38 of file image_codec_jpeg.hpp.