# Documentation/API/Image

### From libHaru.org wiki

< Documentation | API

## HPDF_Image_GetSize()

    HPDF_Point HPDF_Image_GetSize (HPDF_Image image);

Description

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

Parameters

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()

    HPDF_UINT HPDF_Image_GetWidth (HPDF_Image image);

Description

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

Parameters

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()

    HPDF_UINT HPDF_Image_GetHeight (HPDF_Image  image);

Description

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

Parameters

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()

    HPDF_UINT HPDF_Image_GetBitsPerComponent (HPDF_Image image);

Description

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

Parameters

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()

    const char* HPDF_Image_GetColorSpace(HPDF_Image  image);

Description

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

Parameters

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()

    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.

Parameters

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 codes

- 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.
- HPDF_INVALID_PARAMETER - An invalid value is specified.

## HPDF_Image_SetMaskImage()

    HPDF_STATUS HPDF_Image_SetMaskImage  (HPDF_Image   image,
                                          HPDF_Image   mask_image);

Description

HPDF_Image_SetMaskImage() sets the mask image.

Parameters

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 codes

- 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.

Retrieved from "http://daylessday../../../../articles/d/o/c/Documentation_API_Image_a513.html"

##### Views

- Page
- Discussion
- View source
- History

##### Personal tools

- Log in

##### Search

##### Toolbox

- What links here
- Related changes
- Special pages
- Printable version
- Permanent link