JasPer  4.2.4
jas_image.h File Reference

JasPer Image Class. More...

#include <jasper/jas_config.h>
#include <jasper/jas_stream.h>
#include <jasper/jas_types.h>
#include <jasper/jas_seq.h>
#include <jasper/jas_cm.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  jas_image_cmpt_t
 Image component class. More...
 
struct  jas_image_t
 Image class. More...
 
struct  jas_image_cmptparm_t
 Component parameters class. More...
 
struct  jas_image_fmtops_t
 Image format-dependent operations. More...
 
struct  jas_image_fmtinfo_t
 Image format information. More...
 

Macros

#define JAS_IMAGE_MAXFMTS   32
 The maximum number of image data formats supported. More...
 
#define jas_image_width(image)    ((image)->brx_ - (image)->tlx_)
 Get the width of the image in units of the image reference grid. More...
 
#define jas_image_height(image)    ((image)->bry_ - (image)->tly_)
 Get the height of the image in units of the image reference grid. More...
 
#define jas_image_tlx(image)    ((image)->tlx_)
 Get the x-coordinate of the top-left corner of the image bounding box on the reference grid. More...
 
#define jas_image_tly(image)    ((image)->tly_)
 Get the y-coordinate of the top-left corner of the image bounding box on the reference grid. More...
 
#define jas_image_brx(image)    ((image)->brx_)
 Get the x-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one). More...
 
#define jas_image_bry(image)    ((image)->bry_)
 Get the y-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one). More...
 
#define jas_image_numcmpts(image)    ((image)->numcmpts_)
 Get the number of image components. More...
 
#define jas_image_clrspc(image)    ((image)->clrspc_)
 Get the color model used by the image. More...
 
#define jas_image_setclrspc(image, clrspc)    ((image)->clrspc_ = (clrspc))
 Set the color model for an image. More...
 
#define jas_image_cmptwidth(image, cmptno)    ((image)->cmpts_[cmptno]->width_)
 Get the width of a component. More...
 
#define jas_image_cmptheight(image, cmptno)    ((image)->cmpts_[cmptno]->height_)
 Get the height of a component. More...
 
#define jas_image_cmptsgnd(image, cmptno)    ((image)->cmpts_[cmptno]->sgnd_)
 Get the signedness of the sample data for a component. More...
 
#define jas_image_cmptprec(image, cmptno)    ((image)->cmpts_[cmptno]->prec_)
 Get the precision of the sample data for a component. More...
 
#define jas_image_cmpthstep(image, cmptno)    ((image)->cmpts_[cmptno]->hstep_)
 Get the horizontal subsampling factor for a component. More...
 
#define jas_image_cmptvstep(image, cmptno)    ((image)->cmpts_[cmptno]->vstep_)
 Get the vertical subsampling factor for a component. More...
 
#define jas_image_cmpttlx(image, cmptno)    ((image)->cmpts_[cmptno]->tlx_)
 Get the x-coordinate of the top-left corner of a component. More...
 
#define jas_image_cmpttly(image, cmptno)    ((image)->cmpts_[cmptno]->tly_)
 Get the y-coordinate of the top-left corner of a component. More...
 
#define jas_image_cmptbrx(image, cmptno)
 Get the x-coordinate of the bottom-right corner of a component (plus "one"). More...
 
#define jas_image_cmptbry(image, cmptno)
 Get the y-coordinate of the bottom-right corner of a component (plus "one"). More...
 
#define jas_image_cmprof(image)   ((image)->cmprof_)
 Get the color management profile of an image. More...
 
#define jas_image_setcmprof(image, cmprof)   ((image)->cmprof_ = cmprof)
 Set the color management profile for an image. More...
 

Typedefs

typedef int_fast32_t jas_image_coord_t
 Image coordinate. More...
 
typedef int_fast16_t jas_image_colorspc_t
 Color space (e.g., RGB, YCbCr). More...
 
typedef int_fast32_t jas_image_cmpttype_t
 Component type (e.g., color, opacity). More...
 
typedef int_fast16_t jas_image_smpltype_t
 Component sample data format (e.g., real/integer, signedness, precision). More...
 

Functions

JAS_EXPORT jas_image_tjas_image_create (unsigned numcmpts, const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc)
 Create an image. More...
 
JAS_EXPORT jas_image_tjas_image_create0 (void)
 Create an "empty" image. More...
 
JAS_EXPORT jas_image_tjas_image_copy (jas_image_t *image)
 Clone an image. More...
 
JAS_EXPORT void jas_image_destroy (jas_image_t *image)
 Deallocate any resources associated with an image. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT bool jas_image_cmpt_domains_same (const jas_image_t *image)
 Test if all components are specified at the same positions in space. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT uint_fast32_t jas_image_rawsize (const jas_image_t *image)
 Get the raw size of an image (i.e., the nominal size of the image without any compression. More...
 
JAS_EXPORT jas_image_tjas_image_decode (jas_stream_t *in, int fmt, const char *optstr)
 Create an image from a stream in some specified format. More...
 
JAS_EXPORT int jas_image_encode (jas_image_t *image, jas_stream_t *out, int fmt, const char *optstr)
 Write an image to a stream in a specified format. More...
 
JAS_EXPORT int jas_image_readcmpt (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, jas_matrix_t *data)
 Read a rectangular region of an image component. More...
 
JAS_EXPORT int jas_image_writecmpt (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const jas_matrix_t *data)
 Write a rectangular region of an image component. More...
 
JAS_EXPORT void jas_image_delcmpt (jas_image_t *image, unsigned cmptno)
 Delete a component from an image. More...
 
JAS_EXPORT int jas_image_addcmpt (jas_image_t *image, int cmptno, const jas_image_cmptparm_t *cmptparm)
 Add a component to an image. More...
 
JAS_EXPORT int jas_image_copycmpt (jas_image_t *dstimage, unsigned dstcmptno, jas_image_t *srcimage, unsigned srccmptno)
 Copy a component from one image to another. More...
 
JAS_EXPORT int jas_image_depalettize (jas_image_t *image, unsigned cmptno, unsigned numlutents, const int_fast32_t *lutents, unsigned dtype, unsigned newcmptno)
 Depalettize an image. More...
 
JAS_EXPORT int jas_image_readcmptsample (jas_image_t *image, unsigned cmptno, unsigned x, unsigned y)
 Read a component sample for an image. More...
 
JAS_EXPORT void jas_image_writecmptsample (jas_image_t *image, unsigned cmptno, unsigned x, unsigned y, int_fast32_t v)
 Write a component sample for an image. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_getcmptbytype (const jas_image_t *image, jas_image_cmpttype_t ctype)
 Get an image component by its type. More...
 
JAS_EXPORT void jas_image_clearfmts (void)
 Clear the table of image formats. More...
 
JAS_EXPORT const jas_image_fmtinfo_tjas_image_getfmtbyind (int index)
 Get a image format entry by its table index. More...
 
JAS_EXPORT int jas_image_getnumfmts (void)
 Get the number of image format table entries. More...
 
JAS_EXPORT int jas_image_setfmtenable (int index, int enabled)
 Get the number of image format table entries. More...
 
JAS_EXPORT int jas_image_addfmt (int id, const char *name, const char *ext, const char *desc, const jas_image_fmtops_t *ops)
 Add entry to table of image formats. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_strtofmt (const char *s)
 Get the ID for the image format with the specified name. More...
 
JAS_ATTRIBUTE_CONST JAS_EXPORT const char * jas_image_fmttostr (int fmt)
 Get the name of the image format with the specified ID. More...
 
JAS_ATTRIBUTE_CONST JAS_EXPORT const jas_image_fmtinfo_tjas_image_lookupfmtbyid (int id)
 Lookup image format information by the format ID. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_image_fmtinfo_tjas_image_lookupfmtbyname (const char *name)
 Lookup image format information by the format name. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_fmtfromname (const char *filename)
 Guess the format of an image file based on its name. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_getfmt (jas_stream_t *in)
 Get the format of image data in a stream. More...
 
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_ishomosamp (const jas_image_t *image)
 Test if the sampling of the image is homogeneous. More...
 
JAS_EXPORT int jas_image_sampcmpt (jas_image_t *image, unsigned cmptno, unsigned newcmptno, jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, jas_image_coord_t vs, int sgnd, unsigned prec)
 ??? More...
 
JAS_EXPORT int jas_image_writecmpt2 (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const long *buf)
 Write sample data in a component of an image. More...
 
JAS_EXPORT int jas_image_readcmpt2 (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, long *buf)
 Read sample data in a component of an image. More...
 
JAS_EXPORT jas_image_tjas_image_chclrspc (jas_image_t *image, const jas_cmprof_t *outprof, jas_cmxform_intent_t intent)
 Change the color space for an image. More...
 
JAS_EXPORT int jas_image_dump (jas_image_t *image, FILE *out)
 Dump the information for an image (for debugging). More...
 

Detailed Description

JasPer Image Class.