Forge
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 ()
 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/2]

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

Creates a Image object.

Parameters
[in]pWidthWidth of the image
[in]pHeightHeight of the image
[in]pFormatColor channel format of image, uses one of the values of ChannelFormat
[in]pDataTypetakes one of the values of dtype that indicates the integral data type of histogram data

◆ Image() [2/2]

FGAPI Image ( const Image pOther)

Copy constructor of Image.

Parameters
[in]pOtheris the Image of which we make a copy of.

◆ ~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
Examples:
cpu/fractal.cpp, cpu/histogram.cpp, opencl/fractal.cpp, and opencl/histogram.cpp.

◆ 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]pWindowis target window to where image will be rendered
[in]pXis x coordinate of origin of viewport in window coordinates
[in]pYis y coordinate of origin of viewport in window coordinates
[in]pVPWis the width of the viewport
[in]pVPHis 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
Examples:
cpu/fractal.cpp, cpu/histogram.cpp, opencl/fractal.cpp, and opencl/histogram.cpp.

◆ width()

FGAPI unsigned width ( ) const

Get Image width.

Returns
image width

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