Haru Free PDF Library
home | download | documentation | examples | sourceforge | forums

Image Functions

HPDF_Image_GetSize

#include "apdf.h"

HPDF_Point
HPDF_Image_GetSize (HPDF_Image  image);

Description

HPDF_Image_GetSize() gets the size of the image of an image object.

Parameter

image
The handle of an image object.

Returns

When HPDF_Image_GetSize() succeed, it returns a HPDF_Point struct which includes the size of the image. Otherwise, it returns a HPDF_Point struct whose value is (0, 0).

HPDF_Image_GetWidth

#include "apdf.h"

HPDF_UINT
HPDF_Image_GetWidth (HPDF_Image  image);

Description

HPDF_Image_GetWidth() gets the width of the image of an image object.

Parameter

image
The handle of an image object.

Returns

When HPDF_Image_GetWidth() succeed, it returns the width of the image. Otherwise, it returns 0.

HPDF_Image_GetHeight

#include "apdf.h"

HPDF_UINT
HPDF_Image_GetHeight (HPDF_Image  image);

Description

HPDF_Image_GetHeight() gets the height of the image of an image object.

Parameter

image
The handle of an image object.

Returns

When HPDF_Image_GetHeight() succeed, it returns the height of the image. Otherwise, it returns 0.

HPDF_Image_GetBitsPerComponent

#include "apdf.h"

HPDF_UINT
HPDF_Image_GetBitsPerComponent (HPDF_Image  image);

Description

HPDF_Image_GetBitsPerComponent() gets the number of bits used to describe each color component.

Parameter

image
The handle of an image object.

Returns

When HPDF_Image_GetHeight() succeed, it returns the number of bits. Otherwise, it returns 0.

HPDF_Image_GetColorSpace

#include "apdf.h"

const char*
HPDF_Image_GetColorSpace(HPDF_Image  image);

Description

HPDF_Image_GetColorSpace() gets the name of the image's color space.

Parameter

image
The handle of an image object.

Returns

When HPDF_Image_GetColorSpace() succeed, it returns the following values. Otherwise, it returns NULL.
  • "DeviceGray"
  • "DeviceRGB"
  • "DeviceCMYK"
  • "Indexed"

HPDF_Image_SetColorMask

#include "apdf.h"

HPDF_STATUS
HPDF_Image_SetColorMask (HPDF_Image   image,
                         HPDF_UINT    rmin,
                         HPDF_UINT    rmax,
                         HPDF_UINT    gmin,
                         HPDF_UINT    gmax,
                         HPDF_UINT    bmin,
                         HPDF_UINT    bmax);

Description

HPDF_Image_SetColorMask() sets the transparent color of the image by the RGB range values.
The color within the range is displayed as a transparent color.
The Image must be RGB color space.

Parameter

image
Specify the handle of an image object.

rmin
The lower limit of Red. It must be between 0 and 255.

rmax
The upper limit of Red. It must be between 0 and 255.

gmin
The lower limit of Green. It must be between 0 and 255.

gmax
The upper limit of Green. It must be between 0 and 255.

bmin
The lower limit of Blue. It must be between 0 and 255.

bmax
The upper limit of Blue. It must be between 0 and 255.


Returns

When HPDF_Image_SetColorMask() succeed, it returns HPDF_OK. Otherwise it returns error code and an error-handler will be invoked.

Error

HPDF_INVALID_IMAGE
An invalid image handle was set.

HPDF_INVALID_COLOR_SPACE
An image other than RGB color was specified.

HPDF_FAILD_TO_ALLOC_MEM
Memory Allocation Failed.

APDF_INVALID_PARAMETER
An invalid value is specified.


HPDF_Image_SetMaskImage

#include "apdf.h"

HPDF_STATUS
HPDF_Image_SetMaskImage  (HPDF_Image   image,
                          HPDF_Image   mask_image);

Description

HPDF_Image_SetMaskImage() sets the mask image.

Parameter

image
Specify the handle of an image object.

mask_image
Specify the handle of an image object which is used as image-mask. This image must be 1bit gray-scale color image.

Returns

When HPDF_Image_SetMaskImage() succeed, it returns HPDF_OK. Otherwise it returns error code and an error-handler will be invoked.

Error

HPDF_INVALID_IMAGE
An invalid image handle was set.

HPDF_INVALID_BIT_PER_COMPONENT
An invalid bit-per-component.

HPDF_FAILD_TO_ALLOC_MEM
Memory Allocation Failed.