Actions

Difference between revisions of "Structures"

From XnView Wiki

Line 659: Line 659:
   GFL_TELL_CALLBACK Tell;  
   GFL_TELL_CALLBACK Tell;  
   GFL_SEEK_CALLBACK Seek;  
   GFL_SEEK_CALLBACK Seek;  
   GFL_ALLOCATEBITMAP_CALLBACK AllocateBitmap;  
   GFL_ALLOCATEBITMAP_CALLBACK AllocateBitmap;  
   void* AllocateBitmapParams;  
   void* AllocateBitmapParams;  
   GFL_PROGRESS_CALLBACK Progress;  
   GFL_PROGRESS_CALLBACK Progress;  
   void* ProgressParams;  
   void* ProgressParams;  
   GFL_WANTCANCEL_CALLBACK WantCancel;  
   GFL_WANTCANCEL_CALLBACK WantCancel;  
   void* WantCancelParams;  
   void* WantCancelParams;  
   GFL_VIRTUAL_LOAD_CALLBACK SetLine;  
   GFL_VIRTUAL_LOAD_CALLBACK SetLine;  
   void* SetLineParams;  
   void* SetLineParams;  
  } GFL_LOAD_CALLBACKS;
  } GFL_LOAD_CALLBACKS;

Revision as of 14:53, 23 September 2009

GFL_BITMAP

The GFL_BITMAP structure contains all informations about picture in memory.

typedef struct (
 GFL_BITMAP_TYPE Type,  
 GFL_ORIGIN Origin,  
 GFL_INT32 Width,  
 GFL_INT32 Height,  
 GFL_UINT32 BytesPerLine,  
 GFL_INT16 LinePadding,  
 GFL_UINT16 BitsPerComponent,  
 GFL_UINT16 ComponentsPerPixel,  
 GFL_UINT16 BytesPerPixel,  
 GFL_UINT16 Xdpi,  
 GFL_UINT16 Ydpi,  
 GFL_INT16 TransparentIndex,  
 GFL_INT32 ColorUsed,  
 GFL_COLORMAP* ColorMap,  
 GFL_UINT8* Data,  
 char* Comment,  
 void* MetaData
} GFL_BITMAP

Members

Type
Type of the picture
GFL_BINARY 0x0001 Binary
GFL_GREY 0x0002 Grey scale
GFL_COLORS 0x0004 Colors with colormap
GFL_RGB 0x00010 TrueColors - Red/Green/Blue
GFL_RGBA 0x0020 TrueColors - Red/Green/Blue/Alpha
GFL_BGR 0x0040 TrueColors - Blue/Green/Red
GFL_ABGR 0x0080 TrueColors - Alpha/Blue/Green/Red
GFL_BGRA 0x0100 TrueColors - Blue/Green/Red/Alpha
GFL_ARGB 0x0200 TrueColors - Alpha/Red/Green/Blue
GFL_CMYK 0x0400 TrueColors - Cyan/Magenta/Yellow/Black
Origin
Origin of the picture.
GFL_TOP_LEFT 0 Top left (default)
GFL_BOTTOM_LEFT 2 Bottom left
GFL_TOP_RIGHT 1 Top right
GFL_BOTTOM_RIGHT 3 Bottom right
Width
Width in pixels of the picture.
Height
Height in pixels of the picture.
BytesPerLine
Bytes per line of pixels.
LinePadding
Internal use, do not modify.
BitsPerComponent
Bits per component, can be 1, 8, 16
ComponentsPerPixel
Component per pixel, can be 1, 3 or 4
BytesPerPixel
Bytes per pixel (For example: 1, 3 or 4).
Xdpi
Pixels per inch in X axis.
Ydpi
Pixels per inch in Y axis.
TransparentIndex
Index of transparency (only for GFL_COLORS & GFL_GREY type).
ColorUsed
Number of color used in the picture (only for GFL_COLORS & GFL_GREY type).
ColorMap
Address of a GFL_COLORMAP structure for the colormap (only for GFL_COLORS type).
Data
Pointer of the picture data.
Comment
Address of a string used by the comment. You must use gflSetComment to change the comment.
MetaData
Pointer of Metadata. You must use gflBitmapGetIPTC & gflBitmapGetEXIF to obtain readable data.


GFL_COLORMAP

The GFL_COLORMAP structure is used for colormap.

typedef struct (
 GFL_UINT8 Red[256],  
 GFL_UINT8 Green[256],  
 GFL_UINT8 Blue[256]
} GFL_COLORMAP

Members

Red
Array of red components.
Green
Array of green components.
Blue
Array of blue components.


GFL_FORMAT_INFORMATION

The GFL_FORMAT_INFORMATION structure contains informations about a format available in GFL.

typedef struct (
 GFL_INT32 Index,  
 GFL_ORIGIN Name[8],  
 char Description[64],  
 GFL_UINT32 Status,  
 GFL_UINT32 NumberOfExtension,  
 char Extension[16][8]
} GFL_FORMAT_INFORMATION

Members

Index
Index of the format.
Name
Null-terminated string that contains the name of the format. For example, "jpeg" is for JPEG format.
Description
Null-terminated string that contains the label of the format.
Status
Format status.
GFL_READ Reading support
GFL_WRITE Writing support
NumberOfExtension
Nomber of extension known by this format.
Extension
Array of Null-terminated string that contains the extension.


GFL_FILE_INFORMATION

The GFL_FILE_INFORMATION structure contains informations about a picture's file.

typedef struct (
 GFL_BITMAP_TYPE Type,  
 GFL_ORIGIN Origin,  
 GFL_INT32 Width,  
 GFL_INT32 Height,  
 GFL_INT32 FormatIndex,  
 char FormatName[8],  
 char Description[64],  
 GFL_UINT16 Xdpi,  
 GFL_UINT16 Ydpi,  
 GFL_UINT16 BitsPerComponent,  
 GFL_UINT16 ComponentsPerPixel,  
 GFL_INT32 NumberOfImages,  
 GFL_UINT32 FileSize,  
 GFL_COLORMODEL ColorModel,  
 GFL_COMPRESSION Compression,  
 char CompressionDescription[64]
} GFL_LOAD_PARAMS

Members

Type
Not used
Origin
Origin of the picture.
GFL_TOP_LEFT 0 Top left (default)
GFL_BOTTOM_LEFT 2 Bottom left
GFL_TOP_RIGHT 1 Top right
GFL_BOTTOM_RIGHT 3 Bottom right
Width
Width in pixels of the picture.
Height
Height in pixels of the picture.
FormatIndex
Index of picture's format.
FormatName
Name of picture's format.
Description
File label.
Xdpi
Pixels per inch in the X axis.
Ydpi
Pixels per inch in the Y axis.
BitsPerComponent
Bits per component, can be 1, 8, 16
ComponentsPerPixel
Component per pixel, can be 1, 3 or 4
NumberOfImages
Number of picture in the file.
FileSize
Size of the file.
ColorModel
Color model.
GFL_CM_RGB 0 Red-Green-Blue
GFL_CM_GREY 1 Greyscale
GFL_CM_CMY 2 Cyan-Magenta-Yellow
GFL_CM_CMYK 3 Cyan-Magenta-Yellow-Black
GFL_CM_YCBCR 4 YCbCr
GFL_CM_YUV16 5 YUV 16bits
GFL_CM_LAB 6 Lab
GFL_CM_LOGLUV 7 Log Luv
GFL_CM_LOGL 8 Log L
Compression
GFL_NO_COMPRESSION 0 No compression
GFL_RLE 1 Packbits
GFL_LZW 2 LZW
GFL_JPEG 3 JPEG
GFL_ZIP 4 ZIP
GFL_SGI_RLE 5 SGI Packbits
GFL_CCITT_RLE 6 CCITT RLE
GFL_CCITT_FAX3 7 Fax Group 3
GFL_CCITT_FAX3_2D 8 Fax Group 3-2D
GFL_CCITT_FAX4 9 Fax Group 4
GFL_WAVELET 10 Wavelet
GFL_UNKNOWN_COMPRESSION 255 Other compression
CompressionDescription
Pointer to a buffer that contains the full compression description.

Remarks

gflFreeFileInformation must be used for freeing the allocated memory.


GFL_LOAD_PARAMS

The GFL_LOAD_PARAMS structure contains options for picture loading.

typedef struct (
 GFL_UINT32 Flags,  
 GFL_INT32 FormatIndex,  
 GFL_INT32 ImageWanted,  
 GFL_ORIGIN Origin,  
 GFL_BITMAP_TYPE ColorModel,  
 GFL_UINT32 LinePadding,  
 GFL_UINT8 DefaultAlpha,  
 GFL_UINT8 Reserved1,  
 GFL_UINT16 Reserved2,  
 GFL_INT32 Width,  
 GFL_INT32 Height,  
 GFL_UINT32 Offset,  
 GFL_CORDER ChannelOrder,  
 GFL_CTYPE ChannelType,  
 GFL_UINT16 PcdBase,  
 GFL_UINT16 EpsDpi,  
 GFL_INT32 EpsWidth,  
 GFL_INT32 EpsHeight,  
 GFL_READ_CALLBACK Read,  
 GFL_TELL_CALLBACK Tell,  
 GFL_SEEK_CALLBACK Seek
} GFL_LOAD_PARAMS

Members

Flags
Options
GFL_LOAD_SKIP_ALPHA If the picture has an alpha channel, it is ignored
GFL_LOAD_IGNORE_READ_ERROR Ignore all read errors
GFL_LOAD_BY_EXTENSION_ONLY Use only extension to recognize the filetype
GFL_LOAD_READ_ALL_COMMENT Read all comment in the file
GFL_LOAD_FORCE_COLOR_MODEL ColorModel is used for the picture type
GFL_LOAD_PREVIEW_NO_CANVAS_RESIZE Keep the ratio for the preview
GFL_LOAD_BINARY_AS_GREY Load a binary file in 8bits
GFL_LOAD_ORIGINAL_COLORMODEL If the color model of the file is CMYK, so the picture loaded will be in CMYK
GFL_LOAD_ONLY_FIRST_FRAME If the color model of the file is CMYK, so the picture loaded will be in CMYK
GFL_LOAD_ORIGINAL_DEPTH If the file has more than 8 bits per component, keep it
GFL_LOAD_METADATA Read all metadata (IPTC & EXIF)
GFL_LOAD_COMMENT Read comment
GFL_LOAD_HIGH_QUALITY_THUMBNAIL Use high quality for gflLoadThumbnail
FormatIndex
Index of the format used to load.
Default value : -1 (for an automatic recognition).
ImageWanted
For a multi-page file, identifies the image number.
Default value : 0
Origin
Origin wanted.
GFL_TOP_LEFT Top left
GFL_BOTTOM_LEFT Bottom left
GFL_TOP_RIGHT Top right
GFL_BOTTOM_RIGHT Bottom right
Default value : GFF_TOP_LEFT
ColorModel
Color Model wanted.
GFL_RGB True colors - Red/Green/Blue (24 bits)
GFL_BGR True colors - Blue/Green/Red (24 bits)
GFL_RGBA True colors - Red/Green/Blue/Alpha (32 bits)
GFL_ABGR True colors - Alpha/Blue/Green/Red (32 bits)
GFL_BGRA True colors - Blue/Green/Red/Alpha (32 bits)
GFL_ARGB True colors - Red/Green/Blue/Alpha (32 bits)
Default value : GFL_RGB
LinePadding
Pad for a pixels line (For example, a value of 4 allow a line padding on 32bits).
Default value : 1
DefaultAlpha
Alpha value to use when the picture is loaded in 32bits, but the original file doesn't have an alpha.
Default value: Black
Width
For RAW or YUV format, width of picture.
Height
For RAW or YUV format, height of picture.
Offset
For RAW or YUV format, offset of the picture in the file.
ChannelOrder
For RAW format, channel order of the components. GFL_CORDER_INTERLEAVED :Interleaved
GFL_CORDER_SEQUENTIAL Sequential
GFL_CORDER_SEPARATE Separate
ChannelType
For RAW format, channel type of the components.
GFL_CTYPE_GREYSCALE Greyscale
GFL_CTYPE_RGB Red-Green-Blue
GFL_CTYPE_BGR Blue-Green-Red
GFL_CTYPE_RGBA Red-Green-Blue-Alpha
GFL_CTYPE_ABGR Alpha-Blue-Green-Red
GFL_CTYPE_CMY Cyan-Magenta-Yellow
GFL_CTYPE_CMYK Cyan-Magenta-Yellow-Black
PcdBase
For PCD format, it's the base used.
0 192x144
1 384x288
2 768x576
EpsDpi
For PS/EPS format, dpi to be used for loading.
EpsWidth
For PS/EPS format, width to be used for loading.
EpsHeight
For PS/EPS format, height to be used for loading.
Read
Pointer to a read user function.
Tell
Pointer to a tell user function.
Seek
Pointer to a seek user function.


GFL_SAVE_PARAMS

The GFL_SAVE_PARAMS structure contains options for the save of picture.

typedef struct (
 GFL_UINT32 Flags,  
 GFL_INT32 FormatIndex,  
 GFL_COMPRESSION Compression,  
 GFL_INT16 Quality,  
 GFL_INT16 CompressionLevel,  
 GFL_BOOL Interlaced,  
 GFL_BOOL Progressive,  
 GFL_BOOL OptimizeHuffmanTable,  
 GFL_BOOL InAscii,  
 GFL_UINT32 Offset,  
 GFL_CORDER ChannelOrder,  
 GFL_CTYPE ChannelType,  
 GFL_WRITE_CALLBACK Write,  
 GFL_TELL_CALLBACK Tell,  
 GFL_SEEK_CALLBACK Seek
} GFL_SAVE_PARAMS

Members

Flags
Options
GFL_SAVE_REPLACE_EXTENSION Replace extension by the default format extension
GFL_SAVE_ANYWAY Convert picture if colormode can be saved in this format (For example, RGB picture must be converted in 256 colors to save it in GIF)
FormatIndex
Index of format to be used.
Compression
GFL_NO_COMPRESSION No compression
GFL_RLE Packbits
GFL_LZW LZW (tiff only)
GFL_CCITT_FAX3 Fax Group 3 (tiff only)
GFL_CCITT_FAX3_2D Fax Group 3-2D (tiff only)
GFL_CCITT_FAX4 Fax Group 4 (tiff only)
Quality
Quality of the compression (JPEG)
0: the worst, 100: the best
CompressionLevel
Level of compression (PNG).
1: minimum, 7: maximum
Interlaced
Interlaced mode (GIF).
Progressive
Progressive mode (JPEG).
OptimizeHuffmanTable
Optimize the Huffman table (JPEG).
InAscii
Use the ascii mode (PNM)
Offset
For RAW or YUV format, offset of the data start.
ChannelOrder
For RAW format, channel order of components.
GFL_CORDER_INTERLEAVED Interleaved
GFL_CORDER_SEQUENTIAL Sequential
GFL_CORDER_SEPARATE Separate
ChannelType
For RAW format, channel type of components.
GFL_CTYPE_GREYSCALE Greyscale
GFL_CTYPE_RGB Red-Green-Blue
GFL_CTYPE_BGR Bleu-Green-Red
GFL_CTYPE_RGBA Red-Green-Bleu-Alpha
GFL_CTYPE_ABGR Alpha-Bleu-Green-Red
GFL_CTYPE_CMY Cyan-Magenta-Yellow
GFL_CTYPE_CMYK Cyan-Magenta-Yellow-Black
Write
Pointer to a write user function.
Tell
Pointer to a tell user function.
Seek
Pointer to a seek user function.


GFL_RECT

The GFL_RECT structure define a rectangle.

typedef struct (
 GFL_INT32 x,  
 GFL_INT32 y,  
 GFL_INT32 w,  
 GFL_INT32 h
} GFL_RECT

Members

x
X position.
y
Y position.
w
Width.
h
Height.


GFL_COLOR

The GFL_COLOR structure allow to define a color.

typedef struct (
 GFL_UINT16 Red,  
 GFL_UINT16 Green,  
 GFL_UINT16 Blue,  
 GFL_UINT16 Alpha
} GFL_COLOR

Members

Red
Define the red component.
Green
Define the green component.
Blue
Define the blue component.
Alpha
Define the alpha component.


GFL_POINT

The GFL_POINT structure allows to define a point.

typedef struct (
 GFL_INT32 x,  
 GFL_INT32 y
} GFL_POINT

Members

x
X position.
y
Y position.


GFL_FILTER

The GFL_FILTER structure allows to define a matrix for convolution (maximum 7x7).

typedef struct (
 GFL_INT16 Size,  
 GFL_INT16 Matrix[7*7],  
 GFL_INT16 Divisor,  
 GFL_INT16 Bias
} GFL_FILTER

Members

Size
Define the width of the matrix (maximum 7).
Matrix
Define each values fo the matrix.
Divisor
Define the divisor to apply.
Bias
Define the bias to apply.

Example

A "blur" matrix is defined like this:
Size = 3
Matrix = (1 2 1 2 4 2 1 2 1)
Divisor = 16
Bias = 0


GFL_EXIF_DATA

IFD

GFL_EXIF_IFD_0 0x0001
GFL_EXIF_MAIN_IFD 0x0002
GFL_EXIF_INTEROPERABILITY_IFD 0x0004
GFL_EXIF_IFD_THUMBNAIL 0x0008
GFL_EXIF_GPS_IFD 0x0010
GFL_EXIF_MAKERNOTE_IFD 0x0020

Some tags

GFL_EXIF_MAKER 0x010F
GFL_EXIF_MODEL 0x0110
GFL_EXIF_ORIENTATION 0x0112
GFL_EXIF_EXPOSURETIME 0x829A
GFL_EXIF_FNUMBER 0x829D
GFL_EXIF_DATETIME_ORIGINAL 0x9003
GFL_EXIF_SHUTTERSPEED 0x9201
GFL_EXIF_APERTURE 0x9202
GFL_EXIF_MAXAPERTURE 0x9205
GFL_EXIF_FOCALLENGTH 0x920A
typedef struct {
  GFL_UINT32  Flag; /* EXIF_...IFD */
  GFL_UINT32  Tag; 
  const char* Name; 
  const char* Value; 
} GFL_EXIF_ENTRY; 
typedef struct {
  GFL_UINT32      NumberOfItems; 
  GFL_EXIF_ENTRY* ItemsList; 
} GFL_EXIF_DATA;


GFL_LOAD_CALLBACKS

typedef struct {
  GFL_READ_CALLBACK Read; 
  GFL_TELL_CALLBACK Tell; 
  GFL_SEEK_CALLBACK Seek; 
  GFL_ALLOCATEBITMAP_CALLBACK AllocateBitmap; 
  void* AllocateBitmapParams; 
  GFL_PROGRESS_CALLBACK Progress; 
  void* ProgressParams; 
  GFL_WANTCANCEL_CALLBACK WantCancel; 
  void* WantCancelParams; 
  GFL_VIRTUAL_LOAD_CALLBACK SetLine; 
  void* SetLineParams; 
} GFL_LOAD_CALLBACKS;