Forge: Image

Forge

Functions
Image
C API functions

## Functions
FGAPI fg_err | fg_create_image (fg_image *pImage, const unsigned pWidth, const unsigned pHeight, const fg_channel_format pFormat, const fg_dtype pType)
| Create a Image object. More...
FGAPI fg_err | fg_destroy_image (fg_image pImage)
| Destroy image object. More...
FGAPI fg_err | fg_set_image_alpha (fg_image pImage, const float pAlpha)
| Set a global alpha value for rendering the image. More...
FGAPI fg_err | fg_set_image_aspect_ratio (fg_image pImage, const bool pKeepRatio)
| Set option to inform whether to maintain aspect ratio of original image. More...
FGAPI fg_err | fg_get_image_width (unsigned *pOut, const fg_image pImage)
| Get the width of the image. More...
FGAPI fg_err | fg_get_image_height (unsigned *pOut, const fg_image pImage)
| Get the height of the image. More...
FGAPI fg_err | fg_get_image_pixelformat (fg_channel_format *pOut, const fg_image pImage)
| Get the channel format of the image. More...
FGAPI fg_err | fg_get_image_type (fg_dtype *pOut, const fg_image pImage)
| Get the pixel data type of the image. More...
FGAPI fg_err | fg_get_pixel_buffer (unsigned *pOut, const fg_image pImage)
| Get the image buffer resource identifier. More...
FGAPI fg_err | fg_get_image_size (unsigned *pOut, const fg_image pImage)
| Get the image buffer size in bytes. More...
FGAPI fg_err | fg_render_image (const fg_window pWindow, const fg_image pImage, const int pX, const int pY, const int pWidth, const int pHeight)
| Render the image to given window. More...

## Detailed Description

## Function Documentation

## § fg_create_image()

FGAPI fg_err fg_create_image | ( | fg_image * | pImage,
|  | const unsigned | pWidth,
|  | const unsigned | pHeight,
|  | const fg_channel_format | pFormat,
|  | const fg_dtype | pType
| ) |  |

Create a Image object.

Parameters

  [out] | pImage | will be set to created Image object
  [in] | pWidth | Width of the image
  [in] | pHeight | Height of the image
  [in] | pFormat | Color channel format of image, uses one of the values of fg_channel_format
  [in] | pType | takes one of the values of fg_dtype that indicates the integral data type of histogram data

Returns
  fg_err error code

## § fg_destroy_image()

FGAPI fg_err fg_destroy_image | ( | fg_image | pImage | ) |

Destroy image object.

Parameters

  [in] | pImage | is the image handle

Returns
  fg_err error code

## § fg_get_image_height()

FGAPI fg_err fg_get_image_height | ( | unsigned * | pOut,
|  | const fg_image | pImage
| ) |  |

Get the height of the image.

Parameters

  [out] | pOut | will be set to the height of the image
  [in] | pImage | is the image handle

Returns
  fg_err error code

## § fg_get_image_pixelformat()

FGAPI fg_err fg_get_image_pixelformat | ( | fg_channel_format * | pOut,
|  | const fg_image | pImage
| ) |  |

Get the channel format of the image.

Parameters

  [out] | pOut | will be set to the channel format of the image
  [in] | pImage | is the image handle

Returns
  fg_err error code

## § fg_get_image_size()

FGAPI fg_err fg_get_image_size | ( | unsigned * | pOut,
|  | const fg_image | pImage
| ) |  |

Get the image buffer size in bytes.

Parameters

  [out] | pOut | will be set to the image buffer size in bytes
  [in] | pImage | is the image handle

Returns
  fg_err error code

## § fg_get_image_type()

FGAPI fg_err fg_get_image_type | ( | fg_dtype * | pOut,
|  | const fg_image | pImage
| ) |  |

Get the pixel data type of the image.

Parameters

  [out] | pOut | will be set to the pixel data type of the image
  [in] | pImage | is the image handle

Returns
  fg_err error code

## § fg_get_image_width()

FGAPI fg_err fg_get_image_width | ( | unsigned * | pOut,
|  | const fg_image | pImage
| ) |  |

Get the width of the image.

Parameters

  [out] | pOut | will be set to the width of the image
  [in] | pImage | is the image handle

Returns
  fg_err error code

## § fg_get_pixel_buffer()

FGAPI fg_err fg_get_pixel_buffer | ( | unsigned * | pOut,
|  | const fg_image | pImage
| ) |  |

Get the image buffer resource identifier.

Parameters

  [out] | pOut | will be set to the image resource identifier
  [in] | pImage | is the image handle

Returns
  fg_err error code

## § fg_render_image()

FGAPI fg_err fg_render_image | ( | const fg_window | pWindow,
|  | const fg_image | pImage,
|  | const int | pX,
|  | const int | pY,
|  | const int | pWidth,
|  | const int | pHeight
| ) |  |

Render the image to given window.

Parameters

  [in] | pWindow | is target window to where image will be rendered
  [in] | pImage | is the image handle
  [in] | pX | is x coordinate of origin of viewport in window coordinates
  [in] | pY | is y coordinate of origin of viewport in window coordinates
  [in] | pWidth | is the width of the viewport
  [in] | pHeight | is the height of the viewport

Returns
  fg_err error code

## § fg_set_image_alpha()

FGAPI fg_err fg_set_image_alpha | ( | fg_image | pImage,
|  | const float | pAlpha
| ) |  |

Set a global alpha value for rendering the image.

Parameters

  [in] | pImage | is the image handle
  [in] | pAlpha |

Returns
  fg_err error code

## § fg_set_image_aspect_ratio()

FGAPI fg_err fg_set_image_aspect_ratio | ( | fg_image | pImage,
|  | const bool | pKeepRatio
| ) |  |

Set option to inform whether to maintain aspect ratio of original image.

Parameters

  [in] | pImage | is the image handle
  [in] | pKeepRatio | informs the image object if original aspect ratio has to be maintained

Returns
  fg_err error code