shithub: libicc

ref: 6727b8912f34a00c4a8a83b0795f9bbf96c06fe9
dir: /icc.h/

View raw version
typedef enum {
	ICscnr,
	ICmntr,
	ICprtr,
	IClink,
	ICspac,
	ICabst,
	ICnmcl,
	ICMAX
} ICCclass;

typedef enum {
	ICIEXYZ,
	ICIELAB,
	ICIELUV,
	IYCbCr,
	ICIEYxy,
	IRGB,
	IGray,
	IHSV,
	IHLS,
	ICMYK,
	ICMY,
	I2CLR,
	I3CLR,
	I4CLR,
	I5CLR,
	I6CLR,
	I7CLR,
	I8CLR,
	I9CLR,
	IACLR,
	IBCLR,
	ICCLR,
	IDCLR,
	IECLR,
	IFCLR,
	ISPACEMAX,
} ICCcolorspace;

typedef struct ICCdate ICCdate;
struct ICCdate {
	u16int year;
	u16int month;
	u16int day;
	u16int hours;
	u16int minutes;
	u16int seconds;
};

typedef u32int s15f16;

typedef struct XYZNumber XYZNumber;
struct XYZNumber {
	s15f16 x;
	s15f16 y;
	s15f16 z;
};

typedef enum {
	IDTransparent = 0x1, /* or reflective */
	IDMatte = 0x2, /* or glossy */
	IDNegative = 0x4, /* or positive */
	IDMono = 0x8, /* or color */
} DevAttribute;

typedef struct ICCTag ICCTag;
struct ICCTag{
	u32int signature;
	u32int offset;
	u32int size;
};

typedef struct ICCprofile ICCprofile;
struct ICCprofile
{
	u32int size;
	u32int cmm;
	int vmajor;
	int vminor;
	int vbugfix;
	ICCclass class;
	ICCcolorspace dataspace;
	ICCcolorspace pcs;
	ICCdate creationdate;
	char platform[5];
	u32int flags;
	
	u32int devmanufacturer;
	u32int devmodel;
	u64int devattrs; /* see DevAttribute enum */
	
	/* rendering intent.
	   0 - perceptual
	   1 - media-relative colorimetric
	   2 - saturation
	   3 - ICC-absolute colorimetric
	 */
	u32int rendintent;
	
	XYZNumber illuminant; /* PCS illuminant, D50 */
	
	u32int creator;
	uchar id[16];
	
	uchar *tagdata;
	ICCTag *tags;
	ulong ntags;
};

typedef struct ICCTagPtr ICCTagPtr;
struct ICCTagPtr {
	uchar *ptr;
	u32int type;
	u32int size;
};

ICCprofile *iccload(int fd);
char *iccgetclass(ICCprofile*);
char *iccgetdataspace(ICCprofile*);
char *iccgetpcs(ICCprofile*);

ICCTagPtr iccfindtag(ICCprofile*, u32int);

typedef struct MlucEntry MlucEntry;
struct MlucEntry {
	u16int language;
	u16int country;
	char *str;
	int length;
};

int mlucnum(uchar*);
MlucEntry mlucentry(uchar*, int);

double s15f16tod(s15f16);
s15f16 dtos16f16(double);