openATV enigma2
openATV is an open source SetTopBox Graphical user interface.
picload.cpp File Reference
#include <png.h>
#include <fcntl.h>
#include <lib/base/cfile.h>
#include <lib/base/wrappers.h>
#include <lib/gdi/picload.h>
#include <lib/gdi/picexif.h>
#include <jpeglib.h>
#include <gif_lib.h>
#include <nanosvg.h>
#include <nanosvgrast.h>

Classes

struct  color
 
struct  r_jpeg_error_mgr
 

Macros

#define PNG_SKIP_SETJMP_CHECK
 
#define NANOSVG_ALL_COLOR_KEYWORDS
 
#define NANOSVG_IMPLEMENTATION
 
#define NANOSVGRAST_IMPLEMENTATION
 
#define BMP_TORASTER_OFFSET   10
 
#define BMP_SIZE_OFFSET   18
 
#define BMP_BPP_OFFSET   28
 
#define BMP_RLE_OFFSET   30
 
#define BMP_COLOR_OFFSET   54
 
#define fill4B(a)   ((4 - ((a) % 4 )) & 0x03)
 

Functions

 DEFINE_REF (ePicLoad)
 
static std::string getSize (const char *file)
 
static int convert_8Bit_to_24Bit (Cfilepara *filepara, unsigned char *dest)
 
static unsigned char * simple_resize_24 (unsigned char *orgin, int ox, int oy, int dx, int dy)
 
static unsigned char * simple_resize_8 (unsigned char *orgin, int ox, int oy, int dx, int dy)
 
static unsigned char * color_resize (unsigned char *orgin, int ox, int oy, int dx, int dy)
 
static void fetch_pallete (int fd, struct color pallete[], int count)
 
static unsigned char * bmp_load (const char *file, int *x, int *y)
 
static void png_load (Cfilepara *filepara, unsigned int background)
 Load a png. More...
 
void jpeg_cb_error_exit (j_common_ptr cinfo)
 
static unsigned char * jpeg_load (const char *file, int *ox, int *oy, unsigned int max_x, unsigned int max_y)
 
static int jpeg_save (const char *filename, int ox, int oy, unsigned char *pic_buffer)
 
void m_rend_gif_decodecolormap (unsigned char *cmb, unsigned char *rgbb, ColorMapObject *cm, int s, int l)
 
static void svg_load (Cfilepara *filepara, bool forceRGB=false)
 
static void gif_load (Cfilepara *filepara)
 
 SWIG_VOID (int) loadPic(ePtr< gPixmap > &result
 
 eDebug ("[ePicLoad] deprecated loadPic function used!!! please use the non blocking version! you can see demo code in Pictureplayer plugin... this function is removed in the near future!")
 
 switch (aspect)
 
 PyTuple_SET_ITEM (tuple, 0, PyLong_FromLong(x))
 
 PyTuple_SET_ITEM (tuple, 1, PyLong_FromLong(y))
 
 PyTuple_SET_ITEM (tuple, 2, PyLong_FromLong(asp1))
 
 PyTuple_SET_ITEM (tuple, 3, PyLong_FromLong(asp2))
 
 PyTuple_SET_ITEM (tuple, 4, PyLong_FromLong(0))
 
 PyTuple_SET_ITEM (tuple, 5, PyLong_FromLong(resize_mode))
 
 if (background) PyTuple_SET_ITEM(tuple
 
 PyString_FromString ("#ff000000"))
 
else PyTuple_SET_ITEM (tuple, 6, PyString_FromString("#00000000"))
 
mPL setPara (tuple)
 
 if (!mPL.startDecode(filename.c_str(), 0, 0, false)) mPL.getData(result)
 

Variables

const uint32_t crc32_table [256]
 
std::string filename
 
std::string int x
 
std::string int int y
 
std::string int int int aspect
 
std::string int int int int resize_mode
 
std::string int int int int int rotate
 
std::string int int int int int unsigned int background
 
std::string int int int int int unsigned int std::string cachefile
 
ePyObject tuple = PyTuple_New(7)
 
ePicLoad mPL
 
else result = 0
 
 return
 

Macro Definition Documentation

◆ BMP_BPP_OFFSET

#define BMP_BPP_OFFSET   28

◆ BMP_COLOR_OFFSET

#define BMP_COLOR_OFFSET   54

◆ BMP_RLE_OFFSET

#define BMP_RLE_OFFSET   30

◆ BMP_SIZE_OFFSET

#define BMP_SIZE_OFFSET   18

◆ BMP_TORASTER_OFFSET

#define BMP_TORASTER_OFFSET   10

◆ fill4B

#define fill4B (   a)    ((4 - ((a) % 4 )) & 0x03)

◆ NANOSVG_ALL_COLOR_KEYWORDS

#define NANOSVG_ALL_COLOR_KEYWORDS

◆ NANOSVG_IMPLEMENTATION

#define NANOSVG_IMPLEMENTATION

◆ NANOSVGRAST_IMPLEMENTATION

#define NANOSVGRAST_IMPLEMENTATION

◆ PNG_SKIP_SETJMP_CHECK

#define PNG_SKIP_SETJMP_CHECK

Function Documentation

◆ bmp_load()

static unsigned char* bmp_load ( const char *  file,
int *  x,
int *  y 
)
static

◆ color_resize()

static unsigned char* color_resize ( unsigned char *  orgin,
int  ox,
int  oy,
int  dx,
int  dy 
)
static

◆ convert_8Bit_to_24Bit()

static int convert_8Bit_to_24Bit ( Cfilepara filepara,
unsigned char *  dest 
)
static

◆ DEFINE_REF()

DEFINE_REF ( ePicLoad  )

◆ eDebug()

eDebug ( " deprecated loadPic function used!!! please use the non blocking version! you can see demo code in Pictureplayer plugin... this function is removed in the near future!"  [ePicLoad])

◆ fetch_pallete()

static void fetch_pallete ( int  fd,
struct color  pallete[],
int  count 
)
static

◆ getSize()

static std::string getSize ( const char *  file)
static

◆ gif_load()

static void gif_load ( Cfilepara filepara)
static

◆ if() [1/2]

if ( !mPL.  startDecodefilename.c_str(), 0, 0, false)

◆ if() [2/2]

if ( background  )

◆ jpeg_cb_error_exit()

void jpeg_cb_error_exit ( j_common_ptr  cinfo)

◆ jpeg_load()

static unsigned char* jpeg_load ( const char *  file,
int *  ox,
int *  oy,
unsigned int  max_x,
unsigned int  max_y 
)
static

◆ jpeg_save()

static int jpeg_save ( const char *  filename,
int  ox,
int  oy,
unsigned char *  pic_buffer 
)
static

◆ m_rend_gif_decodecolormap()

void m_rend_gif_decodecolormap ( unsigned char *  cmb,
unsigned char *  rgbb,
ColorMapObject *  cm,
int  s,
int  l 
)
inline

◆ png_load()

static void png_load ( Cfilepara filepara,
unsigned int  background 
)
static

Load a png.

If you make change to png_load, check the functionality with PngSuite
http://www.schaik.com/pngsuite/
These are test images in all standard PNG.

Parameters
filepara
background
Returns
void

◆ PyString_FromString()

PyString_FromString ( "#ff000000"  )

◆ PyTuple_SET_ITEM() [1/7]

PyTuple_SET_ITEM ( tuple  ,
,
PyLong_FromLong(x  
)

◆ PyTuple_SET_ITEM() [2/7]

PyTuple_SET_ITEM ( tuple  ,
,
PyLong_FromLong(y  
)

◆ PyTuple_SET_ITEM() [3/7]

PyTuple_SET_ITEM ( tuple  ,
,
PyLong_FromLong(asp1)   
)

◆ PyTuple_SET_ITEM() [4/7]

PyTuple_SET_ITEM ( tuple  ,
,
PyLong_FromLong(asp2)   
)

◆ PyTuple_SET_ITEM() [5/7]

PyTuple_SET_ITEM ( tuple  ,
,
PyLong_FromLong(0)   
)

◆ PyTuple_SET_ITEM() [6/7]

PyTuple_SET_ITEM ( tuple  ,
,
PyLong_FromLong(resize_mode  
)

◆ PyTuple_SET_ITEM() [7/7]

else PyTuple_SET_ITEM ( tuple  ,
,
PyString_FromString("#00000000")   
)

◆ setPara()

mPL setPara ( tuple  )

◆ simple_resize_24()

static unsigned char* simple_resize_24 ( unsigned char *  orgin,
int  ox,
int  oy,
int  dx,
int  dy 
)
static

◆ simple_resize_8()

static unsigned char* simple_resize_8 ( unsigned char *  orgin,
int  ox,
int  oy,
int  dx,
int  dy 
)
static

◆ svg_load()

static void svg_load ( Cfilepara filepara,
bool  forceRGB = false 
)
static

◆ SWIG_VOID()

SWIG_VOID ( int  ) &

◆ switch()

switch ( aspect  )

Variable Documentation

◆ aspect

std::string int int int aspect

◆ background

std::string int int int int int unsigned int background

◆ cachefile

std::string int int int int int unsigned int std::string cachefile
Initial value:
{
long asp1, asp2

◆ crc32_table

const uint32_t crc32_table[256]
extern

◆ filename

std::string filename

◆ mPL

ePicLoad mPL

◆ resize_mode

std::string int int int int resize_mode

◆ result

else result = 0

◆ return

return

◆ rotate

std::string int int int int int rotate

◆ tuple

ePyObject tuple = PyTuple_New(7)

◆ x

std::string int x

◆ y

std::string int int y