iceWing
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Gimage.h File Reference
#include <sys/time.h>
#include <glib.h>

Go to the source code of this file.

Data Structures

struct  iwColor
struct  iwImage

Macros

#define IW_FOURCC(a, b, c, d)   ((unsigned int)((((unsigned int)d)<<24)+(((unsigned int)c)<<16)+(((unsigned int)b)<<8)+a))
#define IW_CTAB_SIZE   256
#define IW_RGB   ((iwColtab)0)
#define IW_BGR   ((iwColtab)1)
#define IW_YUV   ((iwColtab)2)
#define IW_YUV_CAL   ((iwColtab)3)
#define IW_HSV   ((iwColtab)4)
#define IW_LUV   ((iwColtab)5)
#define IW_LAB   ((iwColtab)6)
#define IW_BW   ((iwColtab)7)
#define IW_GRAY   IW_BW
#define IW_INDEX   (iw_def_col_tab)
#define IW_COLFORMAT_MAX   IW_BW
#define IW_COLMAX   255
#define IW_COLCNT   256
#define IW_MOVIE_NEXT_FRAME   (-1)
#define IW_MOVIE_PREV_FRAME   (-2)
#define IW_COLOR_TEXT(i)   ((i)->ctab <= IW_COLFORMAT_MAX ? iwColorText[(long)(i)->ctab]:"PALETTE")
#define IW_TYPE_SIZE(i)   (iwTypeSize[(i)->type])
#define IW_TYPE_MIN(i)   (iwTypeMin[(i)->type])
#define IW_TYPE_MAX(i)   (iwTypeMax[(i)->type])
#define IW_IMG_FREE_DATA   ((iwImgFree)(IW_IMG_FREE_PLANE | IW_IMG_FREE_CTAB | IW_IMG_FREE_PLANEPTR))
#define IW_IMG_FREE_ALL   ((iwImgFree)(-1))

Typedefs

typedef guchar(* iwColtab )[3]
typedef struct _iwImgFileData iwImgFileData
typedef struct _iwMovie iwMovie
typedef struct iwColor iwColor
typedef struct iwImage iwImage

Enumerations

enum  iwImgFormat {
  IW_IMG_FORMAT_UNKNOWN, IW_IMG_FORMAT_PNM, IW_IMG_FORMAT_PNG, IW_IMG_FORMAT_JPEG,
  IW_IMG_FORMAT_MOVIE, IW_IMG_FORMAT_AVI_RAW444 = IW_IMG_FORMAT_MOVIE, IW_IMG_FORMAT_AVI_RAW420, IW_IMG_FORMAT_AVI_MJPEG,
  IW_IMG_FORMAT_AVI_FFV1, IW_IMG_FORMAT_AVI_MPEG4, IW_IMG_FORMAT_MOVIE_MAX = IW_IMG_FORMAT_AVI_MPEG4, IW_IMG_FORMAT_VECTOR = 200,
  IW_IMG_FORMAT_SVG = IW_IMG_FORMAT_VECTOR
}
enum  iwType {
  IW_8U, IW_16U, IW_32S, IW_FLOAT,
  IW_DOUBLE
}
enum  iwImgStatus {
  IW_IMG_STATUS_OK, IW_IMG_STATUS_OPEN, IW_IMG_STATUS_READ, IW_IMG_STATUS_WRITE,
  IW_IMG_STATUS_MEM, IW_IMG_STATUS_FORMAT, IW_IMG_STATUS_ERR, IW_IMG_STATUS_MAX
}
enum  iwImgFree { IW_IMG_FREE_PLANE = 1 << 0, IW_IMG_FREE_PLANEPTR = 1 << 1, IW_IMG_FREE_CTAB = 1 << 2, IW_IMG_FREE_STRUCT = 1 << 3 }

Functions

gboolean iw_img_allocate (iwImage *img)
gboolean iw_img_alloc_planeptr (iwImage *img)
void iw_img_init (iwImage *img)
iwImageiw_img_new (void)
iwImageiw_img_new_alloc (int width, int height, int planes, iwType type)
void iw_img_free (iwImage *img, iwImgFree what)
void iw_img_copy_ctab (const iwImage *src, iwImage *dst)
iwImageiw_img_copy (const iwImage *src, iwImage *dst)
iwImageiw_img_duplicate (const iwImage *img)
iwImageiw_img_load (const char *fname, iwImgStatus *status)
iwImageiw_img_load_interleaved (const char *fname, iwImgStatus *status)
void iw_movie_close (iwMovie *movie)
iwMovieiw_movie_open (const char *fname, iwImgStatus *status)
iwImageiw_movie_read (iwMovie **movie, const char *fname, int frame, iwImgStatus *status)
float iw_movie_get_framerate (const iwMovie *movie)
int iw_movie_get_framecnt (const iwMovie *movie)
int iw_movie_get_framepos (iwMovie *movie)
iwImgFileDataiw_img_data_create (void)
void iw_img_data_free (iwImgFileData *data)
void iw_img_data_set_movie (iwImgFileData *data, iwMovie **movie, float framerate)
void iw_img_data_set_quality (iwImgFileData *data, int quality)
iwImgFormat iw_img_save_get_format (iwImgFormat format, const char *fname)
iwImgStatus iw_img_save (const iwImage *img, iwImgFormat format, const char *fname, const iwImgFileData *data)

Variables

iwColtab iw_def_col_tab
char * iwColorText []
char * iwImgFormatText []
char * iwImgFormatTextBM []
int iwTypeSize []
double iwTypeMin []
double iwTypeMax []

Macro Definition Documentation

#define IW_FOURCC (   a,
  b,
  c,
 
)    ((unsigned int)((((unsigned int)d)<<24)+(((unsigned int)c)<<16)+(((unsigned int)b)<<8)+a))
#define IW_CTAB_SIZE   256
#define IW_RGB   ((iwColtab)0)

Color formats of the data for prev_render...()

#define IW_BGR   ((iwColtab)1)
#define IW_YUV   ((iwColtab)2)
#define IW_YUV_CAL   ((iwColtab)3)

!Not rendered correctly!

#define IW_HSV   ((iwColtab)4)
#define IW_LUV   ((iwColtab)5)

!Not rendered correctly!

#define IW_LAB   ((iwColtab)6)

!Not rendered correctly!

#define IW_BW   ((iwColtab)7)

Only the first plane is used

#define IW_GRAY   IW_BW

Only the first plane is used

#define IW_INDEX   (iw_def_col_tab)
#define IW_COLFORMAT_MAX   IW_BW

Last 'special' definition

#define IW_COLMAX   255
#define IW_COLCNT   256
#define IW_MOVIE_NEXT_FRAME   (-1)

For iw_movie_read(): Return the next/previous frame

#define IW_MOVIE_PREV_FRAME   (-2)
#define IW_COLOR_TEXT (   i)    ((i)->ctab <= IW_COLFORMAT_MAX ? iwColorText[(long)(i)->ctab]:"PALETTE")
#define IW_TYPE_SIZE (   i)    (iwTypeSize[(i)->type])

Size of image data type in bytes

#define IW_TYPE_MIN (   i)    (iwTypeMin[(i)->type])

Min. representable value for the image data type

#define IW_TYPE_MAX (   i)    (iwTypeMax[(i)->type])

Max. representable value for the image data type

#define IW_IMG_FREE_DATA   ((iwImgFree)(IW_IMG_FREE_PLANE | IW_IMG_FREE_CTAB | IW_IMG_FREE_PLANEPTR))
#define IW_IMG_FREE_ALL   ((iwImgFree)(-1))

Typedef Documentation

typedef guchar(* iwColtab)[3]
typedef struct _iwImgFileData iwImgFileData
typedef struct _iwMovie iwMovie
typedef struct iwColor iwColor
typedef struct iwImage iwImage

Enumeration Type Documentation

Possible image file formats

Enumerator:
IW_IMG_FORMAT_UNKNOWN 
IW_IMG_FORMAT_PNM 
IW_IMG_FORMAT_PNG 
IW_IMG_FORMAT_JPEG 
IW_IMG_FORMAT_MOVIE 

First movie format

IW_IMG_FORMAT_AVI_RAW444 
IW_IMG_FORMAT_AVI_RAW420 
IW_IMG_FORMAT_AVI_MJPEG 
IW_IMG_FORMAT_AVI_FFV1 
IW_IMG_FORMAT_AVI_MPEG4 
IW_IMG_FORMAT_MOVIE_MAX 

Last movie format

IW_IMG_FORMAT_VECTOR 
IW_IMG_FORMAT_SVG 
enum iwType

Possible image data types

Enumerator:
IW_8U 
IW_16U 
IW_32S 
IW_FLOAT 
IW_DOUBLE 
Enumerator:
IW_IMG_STATUS_OK 
IW_IMG_STATUS_OPEN 

Unable to open file

IW_IMG_STATUS_READ 

Read error

IW_IMG_STATUS_WRITE 

Write error

IW_IMG_STATUS_MEM 

Unable to allocate memory

IW_IMG_STATUS_FORMAT 

File format not supported (png, ...)

IW_IMG_STATUS_ERR 

Another error

IW_IMG_STATUS_MAX 
enum iwImgFree

Flags specifying what to free during iw_img_free()

Enumerator:
IW_IMG_FREE_PLANE 

img->data[x]

IW_IMG_FREE_PLANEPTR 

img->data

IW_IMG_FREE_CTAB 

img->ctab

IW_IMG_FREE_STRUCT 

img


Function Documentation

gboolean iw_img_allocate ( iwImage img)

  Allocate memory for img->data and img->data[] according to the
  other settings in img.
  Return: TRUE if memory could be allocated.

gboolean iw_img_alloc_planeptr ( iwImage img)

  Allocate memory only for img->data (and NOT img->data[]) according
  to the other settings in img.
  Return: TRUE if memory could be allocated.

void iw_img_init ( iwImage img)

  Initialise image img by setting everything to 0.
  Do NOT allocate any memory.

iwImage* iw_img_new ( void  )

  Allocate a new image and set everything to 0. -> Do NOT allocate
  any image data.

iwImage* iw_img_new_alloc ( int  width,
int  height,
int  planes,
iwType  type 
)

  Allocate and initialise a new img and allocate memory for
  img->data and img->data[].

void iw_img_free ( iwImage img,
iwImgFree  what 
)

  Free parts of the image. 'what' specifies what to free.

void iw_img_copy_ctab ( const iwImage src,
iwImage dst 
)

  If src has an own indexed color tabel, allocate a new one for dst
  and copy the table. Otherwise set the ctab entry of dst to the one
  of src.

iwImage* iw_img_copy ( const iwImage src,
iwImage dst 
)

  Copy src to dst, allocate all plane pointer, planes, and color
  tables, and return a pointer to dst, or NULL on error (no mem).

iwImage* iw_img_duplicate ( const iwImage img)

  Return a copy of the image img. All plane pointer, planes, and
  color tables are also copied.

iwImage* iw_img_load ( const char *  fname,
iwImgStatus status 
)

  Load image from file fname in 'planed' form.

iwImage* iw_img_load_interleaved ( const char *  fname,
iwImgStatus status 
)

  Load image from file fname and return an interleaved image.

void iw_movie_close ( iwMovie movie)

  Close movie file if it is != NULL and free all associated data.

iwMovie* iw_movie_open ( const char *  fname,
iwImgStatus status 
)

  Open the movie file fname for reading.

iwImage* iw_movie_read ( iwMovie **  movie,
const char *  fname,
int  frame,
iwImgStatus status 
)

  Open the movie 'fname' (if not already open) and return its frame
  'frame'.
  ATTENTION: The returned frame is a pointer to an internally used
  image which is freed by iw_movie_close().

float iw_movie_get_framerate ( const iwMovie movie)

  Return frame rate of 'movie'.

int iw_movie_get_framecnt ( const iwMovie movie)

  Return number of frames of 'movie'.

int iw_movie_get_framepos ( iwMovie movie)

  Return the number of the frame, which was the result of the
  last call to iw_movie_read()

iwImgFileData* iw_img_data_create ( void  )

  Initialise struct holding settings for saving images.

void iw_img_data_free ( iwImgFileData data)

  Free struct created with iw_img_create_data().

void iw_img_data_set_movie ( iwImgFileData data,
iwMovie **  movie,
float  framerate 
)

  Set parameters used for MOVIE saving.

void iw_img_data_set_quality ( iwImgFileData data,
int  quality 
)

  Set quality parameter (used for JPEG saving),

iwImgFormat iw_img_save_get_format ( iwImgFormat  format,
const char *  fname 
)

  If 'format' == IW_IMG_FORMAT_UNKNOWN return a format based on the
  extension of fname. Otherwise return 'format'.

iwImgStatus iw_img_save ( const iwImage img,
iwImgFormat  format,
const char *  fname,
const iwImgFileData data 
)

  Save 'img' in file 'fname' in the format 'format'. If
  'format' == IW_IMG_FORMAT_UNKNOWN the extension of fname is used.


Variable Documentation

iwColtab iw_def_col_tab
char* iwColorText[]

PRIVATE, only for next macro

char* iwImgFormatText[]

All formats

char* iwImgFormatTextBM[]

Only bitmap formats

int iwTypeSize[]

PRIVATE, only for next macros

double iwTypeMin[]

PRIVATE, only for next macros

double iwTypeMax[]

PRIVATE, only for next macros