Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
png.cpp File Reference
#include "png.h"
#include <string>
#include <optional>
#include <sstream>
#include <zlib.h>
#include <cassert>
#include "util/serialize.h"
#include "serialization.h"
#include "irrlichttypes.h"
+ Include dependency graph for png.cpp:

Enumerations

enum  { COLOR_GRAY = 0 , COLOR_RGB = 2 , COLOR_RGBA = 6 }
 

Functions

static void writeChunk (std::string &target, const std::string &chunk_str)
 
static std::optional< u8 > reduceColor (const u8 *data, u32 width, u32 height, std::string &new_data)
 
std::string encodePNG (const u8 *data, u32 width, u32 height, s32 compression)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
COLOR_GRAY 
COLOR_RGB 
COLOR_RGBA 

Function Documentation

◆ encodePNG()

std::string encodePNG ( const u8 * data,
u32 width,
u32 height,
s32 compression )

References COLOR_GRAY, COLOR_RGB, COLOR_RGBA, compressZlib(), reduceColor(), writeChunk(), writeU32(), and writeU8().

Referenced by ModApiUtil::l_encode_png().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reduceColor()

static std::optional< u8 > reduceColor ( const u8 * data,
u32 width,
u32 height,
std::string & new_data )
static

References COLOR_GRAY, and COLOR_RGB.

Referenced by encodePNG().

+ Here is the caller graph for this function:

◆ writeChunk()

static void writeChunk ( std::string & target,
const std::string & chunk_str )
static

References U32_MAX, and writeU32().

Referenced by encodePNG().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: