Forge

Public Member Functions
Image Class Reference

Image is plain rendering of an image over the window or sub-region of it. More...

`#include <image.h>`

## Public Member Functions
FGAPI | Image (const unsigned pWidth, const unsigned pHeight, const ChannelFormat pFormat=FG_RGBA, const dtype pDataType=f32)
| Creates a Image object. More...
FGAPI | Image (const Image &pOther)
| Copy constructor of Image. More...
FGAPI | Image (const fg_image pHandle)
| Construct Image ojbect from fg_image resource handle. More...
FGAPI | ~Image ()
| Image Destructor. More...
FGAPI void | setAlpha (const float pAlpha)
| Set a global alpha value for rendering the image. More...
FGAPI void | keepAspectRatio (const bool pKeep)
| Set option to inform whether to maintain aspect ratio of original image. More...
FGAPI unsigned | width () const
| Get Image width. More...
FGAPI unsigned | height () const
| Get Image height. More...
FGAPI ChannelFormat | pixelFormat () const
| Get Image's channel format. More...
FGAPI dtype | channelType () const
| Get Image's integral data type. More...
FGAPI unsigned | pixels () const
| Get the resource id of image buffer. More...
FGAPI unsigned | size () const
| Get the image data size in bytes. More...
FGAPI void | render (const Window &pWindow, const int pX, const int pY, const int pVPW, const int pVPH) const
| Render the image to given window. More...
FGAPI fg_image | get () const
| Get the handle to internal implementation of Image. More...

## Detailed Description

Image is plain rendering of an image over the window or sub-region of it.

Examples:
  cpu/fractal.cpp, cpu/histogram.cpp, opencl/fractal.cpp, and opencl/histogram.cpp.

## Constructor & Destructor Documentation

## ◆ Image() [1/3]

FGAPI Image | ( | const unsigned | pWidth,
|  | const unsigned | pHeight,
|  | const ChannelFormat | pFormat = `FG_RGBA`,
|  | const dtype | pDataType = `f32`
| ) |  |

Creates a Image object.

Parameters

  [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 ChannelFormat
  [in] | pDataType | takes one of the values of dtype that indicates the integral data type of histogram data

## ◆ Image() [2/3]

FGAPI Image | ( | const Image & | pOther | ) |

Copy constructor of Image.

Parameters

  [in] | pOther | is the Image of which we make a copy of.

## ◆ Image() [3/3]

FGAPI Image | ( | const fg_image | pHandle | ) |
| explicit

Construct Image ojbect from fg_image resource handle.

Parameters

  [in] | pHandle | is the input fg_image resource handle

Note
  This kind of construction assumes ownership of the resource handle is released during the Image object's destruction.

## ◆ ~Image()

FGAPI ~Image | ( |  | ) |

Image Destructor.

## Member Function Documentation

## ◆ channelType()

FGAPI dtype channelType | ( |  | ) | const

Get Image's integral data type.

Returns
  dtype value of Image

## ◆ get()

FGAPI fg_image get | ( |  | ) | const

Get the handle to internal implementation of Image.

## ◆ height()

FGAPI unsigned height | ( |  | ) | const

Get Image height.

Returns
  image width

## ◆ keepAspectRatio()

FGAPI void keepAspectRatio | ( | const bool | pKeep | ) |

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

Parameters

  [in] | pKeep |

## ◆ pixelFormat()

FGAPI ChannelFormat pixelFormat | ( |  | ) | const

Get Image's channel format.

Returns
  ChannelFormat value of Image

## ◆ pixels()

FGAPI unsigned pixels | ( |  | ) | const

Get the resource id of image buffer.

Returns
  image buffer id

## ◆ render()

FGAPI void render | ( | const Window & | pWindow,
|  | const int | pX,
|  | const int | pY,
|  | const int | pVPW,
|  | const int | pVPH
| ) |  | const

Render the image to given window.

Parameters

  [in] | pWindow | is target window to where image will be rendered
  [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] | pVPW | is the width of the viewport
  [in] | pVPH | is the height of the viewport

## ◆ setAlpha()

FGAPI void setAlpha | ( | const float | pAlpha | ) |

Set a global alpha value for rendering the image.

Parameters

  [in] | pAlpha |

## ◆ size()

FGAPI unsigned size | ( |  | ) | const

Get the image data size in bytes.

Returns
  image buffer size in bytes

## ◆ width()

FGAPI unsigned width | ( |  | ) | const

Get Image width.

Returns
  image width

The documentation for this class was generated from the following file:

- image.h