Functions¶
Most of the functions listed under this section form the core C API of forge library. Forge’s C++ API is built on top of this C API.
Chart Functions¶
-
group
chart_functions
Functions
-
FGAPI fg_err fg_create_chart (fg_chart *pHandle, const fg_chart_type pChartType)
Create a Chart object with given dimensional property.
- Return
fg_err error code
- Parameters
[out] pHandle
: will be set to point to the chart object in memory[in] pChartType
: is chart dimension property
-
FGAPI fg_err fg_retain_chart (fg_chart *pOut, fg_chart pChart)
Increase reference count for the chart resource.
- Return
fg_err error code
- Parameters
[out] pOut
: is new reference to existing resource[in] pChart
: is the existing chart resource handle
-
FGAPI fg_err fg_release_chart (fg_chart pHandle)
Destroy the chart object.
- Return
fg_err error code
- Parameters
[in] pHandle
: is chart handle
-
FGAPI fg_err fg_set_chart_axes_titles (fg_chart pHandle, const char *pX, const char *pY, const char *pZ)
Set axes titles for the chart.
- Return
fg_err error code
- Parameters
[in] pHandle
: is chart handle[in] pX
: is x-axis title label[in] pY
: is y-axis title label[in] pZ
: is z-axis title label
-
FGAPI fg_err fg_set_chart_axes_limits (fg_chart pHandle, const float pXmin, const float pXmax, const float pYmin, const float pYmax, const float pZmin, const float pZmax)
Set axes data ranges.
- Parameters
[in] pHandle
: is chart handle[in] pXmin
: is x-axis minimum data value[in] pXmax
: is x-axis maximum data value[in] pYmin
: is y-axis minimum data value[in] pYmax
: is y-axis maximum data value[in] pZmin
: is z-axis minimum data value[in] pZmax
: is z-axis maximum data value
-
FGAPI fg_err fg_set_chart_label_format (fg_chart pHandle, const char *pXFormat, const char *pYFormat, const char *pZFormat)
Set the format for display of axes labels in a chart.
Display format string follows printf style formating for numbers
- Parameters
[in] pHandle
: is chart handle[in] pXFormat
: sets the display format for numbers of X axis[in] pYFormat
: sets the display format for numbers of Y axis[in] pZFormat
: sets the display format for numbers of Z axis
-
FGAPI fg_err fg_get_chart_axes_limits (float *pXmin, float *pXmax, float *pYmin, float *pYmax, float *pZmin, float *pZmax, const fg_chart pHandle)
Get axes data ranges.
- Parameters
[out] pXmin
: is x-axis minimum data value[out] pXmax
: is x-axis maximum data value[out] pYmin
: is y-axis minimum data value[out] pYmax
: is y-axis maximum data value[out] pZmin
: is z-axis minimum data value[out] pZmax
: is z-axis maximum data value[in] pHandle
: is chart handle
-
FGAPI fg_err fg_set_chart_legend_position (fg_chart pHandle, const float pX, const float pY)
Set legend position for Chart.
- Return
fg_err error code
- Note
By normalized coordinates, the range of these coordinates is expected to be [0-1]. (0,0) is the bottom hand left corner.
- Parameters
[in] pHandle
: is chart handle[in] pX
: is horizontal position in normalized coordinates[in] pY
: is vertical position in normalized coordinates
-
FGAPI fg_err fg_append_image_to_chart (fg_chart pChart, fg_image pImage)
Add an existing image object to chart.
- Return
fg_err error code
- Parameters
[in] pChart
: is the chart to which image has to be added[in] pImage
: is the image to be added to the chart
-
FGAPI fg_err fg_append_histogram_to_chart (fg_chart pChart, fg_histogram pHistogram)
Add an existing histogram object to chart.
- Return
fg_err error code
- Parameters
[in] pChart
: is the chart to which histogram has to be added[in] pHistogram
: is the histogram to be added to the chart
-
FGAPI fg_err fg_append_plot_to_chart (fg_chart pChart, fg_plot pPlot)
Add an existing plot object to chart.
- Return
fg_err error code
- Parameters
[in] pChart
: is the chart to which plot has to be added[in] pPlot
: is the plot to be added to the chart
-
FGAPI fg_err fg_append_surface_to_chart (fg_chart pChart, fg_surface pSurface)
Add an existing surface object to chart.
- Return
fg_err error code
- Parameters
[in] pChart
: is the chart to which surface has to be added[in] pSurface
: is the surface to be added to the chart
-
FGAPI fg_err fg_append_vector_field_to_chart (fg_chart pChart, fg_vector_field pField)
Add an existing vector field object to chart.
- Return
fg_err error code
- Parameters
[in] pChart
: is the chart to which vector field has to be added[in] pField
: is the vector field to be added to the chart
-
FGAPI fg_err fg_add_image_to_chart (fg_image *pImage, fg_chart pHandle, const unsigned pWidth, const unsigned pHeight, const fg_channel_format pFormat, const fg_dtype pType)
Create and add an Image object to the current chart.
- Return
fg_err error code
- Parameters
[out] pImage
: is the handle of the image object created[in] pHandle
: is chart handle to which image object will be added.[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
-
FGAPI fg_err fg_add_histogram_to_chart (fg_histogram *pHistogram, fg_chart pHandle, const unsigned pNBins, const fg_dtype pType)
Create and add an Histogram object to the current chart.
-
FGAPI fg_err fg_add_plot_to_chart (fg_plot *pPlot, fg_chart pHandle, const unsigned pNPoints, const fg_dtype pType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create and add an Plot object to the current chart.
- Return
fg_err error code
- Parameters
[out] pPlot
: is the handle of the plot object created[in] pHandle
: is chart handle[in] pNPoints
: is number of data points to display[in] pType
: takes one of the values of fg_dtype that indicates the integral data type of plot data[in] pPlotType
: dictates the type of plot/graph, it can take one of the values of fg_plot_type[in] pMarkerType
: indicates which symbol is rendered as marker. It can take one of the values of fg_marker_type.
-
FGAPI fg_err fg_add_surface_to_chart (fg_surface *pSurface, fg_chart pHandle, const unsigned pXPoints, const unsigned pYPoints, const fg_dtype pType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create and add an Plot object to the current chart.
- Return
fg_err error code
- Parameters
[out] pSurface
: is the handle of the surface object created[in] pHandle
: is chart handle[in] pXPoints
: is number of data points along X dimension[in] pYPoints
: is number of data points along Y dimension[in] pType
: takes one of the values of fg_dtype that indicates the integral data type of plot data[in] pPlotType
: is the render type which can be one of fg_plot_type (valid choices are FG_PLOT_SURFACE and FG_PLOT_SCATTER)[in] pMarkerType
: is the type of fg_marker_type to draw for FG_PLOT_SCATTER plot type
-
FGAPI fg_err fg_add_vector_field_to_chart (fg_vector_field *pField, fg_chart pHandle, const unsigned pNPoints, const fg_dtype pType)
Create and add an Vector Field object to the current chart.
-
FGAPI fg_err fg_render_chart (const fg_window pWindow, const fg_chart pChart, const int pX, const int pY, const int pWidth, const int pHeight)
Render the chart to given window.
- Return
fg_err error code
- Parameters
[in] pWindow
: is target window to where chart will be rendered[in] pChart
: is chart 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
-
FGAPI fg_err fg_get_chart_type (fg_chart_type *pChartType, const fg_chart pChart)
Render the type of a chart.
- Return
fg_err error code
- Parameters
[out] pChartType
: return the type of the chart[in] pChart
: is chart handle
-
Font Functions¶
-
group
font_functions
Functions
-
FGAPI fg_err fg_create_font (fg_font *pFont)
Create a Font object.
- Return
fg_err error code
- Parameters
[out] pFont
: will point to the font object created after this function returns
-
FGAPI fg_err fg_retain_font (fg_font *pOut, fg_font pIn)
Increase reference count of the resource.
- Return
fg_err error code
- Parameters
[out] pOut
: is the new handle to existing resource[in] pIn
: is the existing resource handle
-
FGAPI fg_err fg_release_font (fg_font pFont)
Destroy font object.
- Return
fg_err error code
- Parameters
[in] pFont
: is the font handle
-
FGAPI fg_err fg_load_font_file (fg_font pFont, const char *const pFileFullPath)
Load a given font file.
- Return
fg_err error code
- Parameters
[in] pFont
: is the font handle[in] pFileFullPath
: True Type Font file path
-
FGAPI fg_err fg_load_system_font (fg_font pFont, const char *const pFontName)
Load a system font based on the name.
- Return
fg_err error code
- Parameters
[in] pFont
: is the font handle[in] pFontName
: True Type Font name
-
Histogram Functions¶
-
group
hist_functions
Functions
-
FGAPI fg_err fg_create_histogram (fg_histogram *pHistogram, const unsigned pNBins, const fg_dtype pDataType)
Creates a Histogram object.
-
FGAPI fg_err fg_retain_histogram (fg_histogram *pOut, fg_histogram pIn)
Increase reference count of the resource.
- Return
fg_err error code
- Parameters
[out] pOut
: is the new handle to existing resource[in] pIn
: is the existing resource handle
-
FGAPI fg_err fg_release_histogram (fg_histogram pHistogram)
Destroy Histogram object.
- Return
fg_err error code
- Parameters
[in] pHistogram
: is the histogram handle
-
FGAPI fg_err fg_set_histogram_color (fg_histogram pHistogram, const float pRed, const float pGreen, const float pBlue, const float pAlpha)
Set the color of bar in the bar graph(histogram)
This is global alpha value for the histogram rendering that takes effect if individual bar alphas are not set by calling the following member functions
Histogram::alphas()
Histogram::alphasSize()
- Return
fg_err error code
- Parameters
[in] pHistogram
: is the histogram handle[in] pRed
: is Red component in range [0, 1][in] pGreen
: is Green component in range [0, 1][in] pBlue
: is Blue component in range [0, 1][in] pAlpha
: is Alpha component in range [0, 1]
-
FGAPI fg_err fg_set_histogram_legend (fg_histogram pHistogram, const char *pLegend)
Set legend for histogram plot.
- Return
fg_err error code
- Parameters
[in] pHistogram
: is the histogram handle[in] pLegend
:
-
FGAPI fg_err fg_get_histogram_vertex_buffer (unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for vertices buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pHistogram
: is the histogram handle
-
FGAPI fg_err fg_get_histogram_color_buffer (unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for colors buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pHistogram
: is the histogram handle
-
FGAPI fg_err fg_get_histogram_alpha_buffer (unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for alpha values buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pHistogram
: is the histogram handle
-
FGAPI fg_err fg_get_histogram_vertex_buffer_size (unsigned *pOut, const fg_histogram pHistogram)
Get the vertices buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pHistogram
: is the histogram handle
-
FGAPI fg_err fg_get_histogram_color_buffer_size (unsigned *pOut, const fg_histogram pHistogram)
Get the colors buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pHistogram
: is the histogram handle
-
FGAPI fg_err fg_get_histogram_alpha_buffer_size (unsigned *pOut, const fg_histogram pHistogram)
Get the alpha values buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pHistogram
: is the histogram handle
-
Image Functions¶
-
group
image_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.
- Return
fg_err error code
- 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
-
FGAPI fg_err fg_retain_image (fg_image *pOut, fg_image pImage)
Increment the internal reference counter for image resource.
- Return
fg_err error code
- Parameters
[out] pOut
: is new reference to existing image resource[in] pImage
: is the input image resource handle
-
FGAPI fg_err fg_release_image (fg_image pImage)
Destroy image object.
- Return
fg_err error code
- Parameters
[in] pImage
: is the image handle
-
FGAPI fg_err fg_set_image_alpha (fg_image pImage, const float pAlpha)
Set a global alpha value for rendering the image.
- Return
fg_err error code
- Parameters
[in] pImage
: is the image handle[in] pAlpha
:
-
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.
- Return
fg_err error code
- Parameters
[in] pImage
: is the image handle[in] pKeepRatio
: informs the image object if original aspect ratio has to be maintained
-
FGAPI fg_err fg_get_image_width (unsigned *pOut, const fg_image pImage)
Get the width of the image.
- Return
fg_err error code
- Parameters
[out] pOut
: will be set to the width of the image[in] pImage
: is the image handle
-
FGAPI fg_err fg_get_image_height (unsigned *pOut, const fg_image pImage)
Get the height of the image.
- Return
fg_err error code
- Parameters
[out] pOut
: will be set to the height of the image[in] pImage
: is the image handle
-
FGAPI fg_err fg_get_image_pixelformat (fg_channel_format *pOut, const fg_image pImage)
Get the channel format of the image.
- Return
fg_err error code
- Parameters
[out] pOut
: will be set to the channel format of the image[in] pImage
: is the image handle
-
FGAPI fg_err fg_get_image_type (fg_dtype *pOut, const fg_image pImage)
Get the pixel data type of the image.
- Return
fg_err error code
- Parameters
[out] pOut
: will be set to the pixel data type of the image[in] pImage
: is the image handle
-
FGAPI fg_err fg_get_pixel_buffer (unsigned *pOut, const fg_image pImage)
Get the image buffer resource identifier.
- Return
fg_err error code
- Parameters
[out] pOut
: will be set to the image resource identifier[in] pImage
: is the image handle
-
FGAPI fg_err fg_get_image_size (unsigned *pOut, const fg_image pImage)
Get the image buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will be set to the image buffer size in bytes[in] pImage
: is the image handle
-
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.
- Return
fg_err error code
- 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
-
Plot Functions¶
-
group
plot_functions
Functions
-
FGAPI fg_err fg_create_plot (fg_plot *pPlot, const unsigned pNPoints, const fg_dtype pType, const fg_chart_type pChartType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create a Plot object.
- Return
fg_err error code
- Parameters
[out] pPlot
: will be set to plot handle upon creating the plot object[in] pNPoints
: is number of data points to display[in] pType
: takes one of the values of fg_dtype that indicates the integral data type of plot data[in] pChartType
: dictates the dimensionality of the chart[in] pPlotType
: dictates the type of plot/graph, it can take one of the values of fg_plot_type[in] pMarkerType
: indicates which symbol is rendered as marker. It can take one of the values of fg_marker_type.
-
FGAPI fg_err fg_retain_plot (fg_plot *pOut, fg_plot pIn)
Increase reference count of the resource.
- Return
fg_err error code
- Parameters
[out] pOut
: is the new handle to existing resource[in] pIn
: is the existing resource handle
-
FGAPI fg_err fg_release_plot (fg_plot pPlot)
Destroy plot object.
- Return
fg_err error code
- Parameters
[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_set_plot_color (fg_plot pPlot, const float pRed, const float pGreen, const float pBlue, const float pAlpha)
Set the color of line graph(plot)
- Return
fg_err error code
- Parameters
[in] pPlot
: is the plot handle[in] pRed
: is Red component in range [0, 1][in] pGreen
: is Green component in range [0, 1][in] pBlue
: is Blue component in range [0, 1][in] pAlpha
: is Blue component in range [0, 1]
-
FGAPI fg_err fg_set_plot_legend (fg_plot pPlot, const char *pLegend)
Set plot legend.
- Return
fg_err error code
- Parameters
[in] pPlot
: is the plot handle[in] pLegend
:
-
FGAPI fg_err fg_set_plot_marker_size (fg_plot pPlot, const float pMarkerSize)
Set global marker size.
This size will be used for rendering markers if no per vertex marker sizes are provided. This value defaults to 10
- Return
fg_err error code
- Parameters
[in] pPlot
: is the plot handle[in] pMarkerSize
: is the target marker size for scatter plots or line plots with markers
-
FGAPI fg_err fg_get_plot_vertex_buffer (unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for vertices buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_get_plot_color_buffer (unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for colors buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_get_plot_alpha_buffer (unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for alpha values buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_get_plot_radii_buffer (unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for markers radii buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_get_plot_vertex_buffer_size (unsigned *pOut, const fg_plot pPlot)
Get the vertices buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_get_plot_color_buffer_size (unsigned *pOut, const fg_plot pPlot)
Get the colors buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_get_plot_alpha_buffer_size (unsigned *pOut, const fg_plot pPlot)
Get the alpha values buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pPlot
: is the plot handle
-
FGAPI fg_err fg_get_plot_radii_buffer_size (unsigned *pOut, const fg_plot pPlot)
Get the markers buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pPlot
: is the plot handle
-
Surface Functions¶
-
group
surf_functions
Functions
-
FGAPI fg_err fg_create_surface (fg_surface *pSurface, const unsigned pXPoints, const unsigned pYPoints, const fg_dtype pType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create a Surface object.
- Return
fg_err error code
- Parameters
[out] pSurface
: will be set to surface handle upon creating the surface object[in] pXPoints
: is number of data points along X dimension[in] pYPoints
: is number of data points along Y dimension[in] pType
: takes one of the values of fg_dtype that indicates the integral data type of surface data[in] pPlotType
: dictates the type of surface/graph, it can take one of the values of fg_plot_type[in] pMarkerType
: indicates which symbol is rendered as marker. It can take one of the values of fg_marker_type.
-
FGAPI fg_err fg_retain_surface (fg_surface *pOut, fg_surface pIn)
Increase reference count of the resource.
- Return
fg_err error code
- Parameters
[out] pOut
: is the new handle to existing resource[in] pIn
: is the existing resource handle
-
FGAPI fg_err fg_release_surface (fg_surface pSurface)
Destroy surface object.
- Return
fg_err error code
- Parameters
[in] pSurface
: is the surface handle
-
FGAPI fg_err fg_set_surface_color (fg_surface pSurface, const float pRed, const float pGreen, const float pBlue, const float pAlpha)
Set the color of surface.
- Return
fg_err error code
- Parameters
[in] pSurface
: is the surface handle[in] pRed
: is Red component in range [0, 1][in] pGreen
: is Green component in range [0, 1][in] pBlue
: is Blue component in range [0, 1][in] pAlpha
: is Blue component in range [0, 1]
-
FGAPI fg_err fg_set_surface_legend (fg_surface pSurface, const char *pLegend)
Set surface legend.
- Return
fg_err error code
- Parameters
[in] pSurface
: is the surface handle[in] pLegend
:
-
FGAPI fg_err fg_get_surface_vertex_buffer (unsigned *pOut, const fg_surface pSurface)
Get the resource identifier for vertices buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pSurface
: is the surface handle
-
FGAPI fg_err fg_get_surface_color_buffer (unsigned *pOut, const fg_surface pSurface)
Get the resource identifier for colors buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pSurface
: is the surface handle
-
FGAPI fg_err fg_get_surface_alpha_buffer (unsigned *pOut, const fg_surface pSurface)
Get the resource identifier for alpha values buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pSurface
: is the surface handle
-
FGAPI fg_err fg_get_surface_vertex_buffer_size (unsigned *pOut, const fg_surface pSurface)
Get the vertices buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pSurface
: is the surface handle
-
FGAPI fg_err fg_get_surface_color_buffer_size (unsigned *pOut, const fg_surface pSurface)
Get the colors buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pSurface
: is the surface handle
-
FGAPI fg_err fg_get_surface_alpha_buffer_size (unsigned *pOut, const fg_surface pSurface)
Get the alpha values buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pSurface
: is the surface handle
-
Vector Field Functions¶
-
group
vfield_functions
Functions
-
FGAPI fg_err fg_create_vector_field (fg_vector_field *pField, const unsigned pNPoints, const fg_dtype pType, const fg_chart_type pChartType)
Create a Vector field object.
- Return
fg_err error code
- Parameters
[out] pField
: will be set to surface handle upon creating the surface object[in] pNPoints
: is number of data points[in] pType
: takes one of the values of fg_dtype that indicates the integral data type of surface data[in] pChartType
: dictates the dimensionality of the chart
-
FGAPI fg_err fg_retain_vector_field (fg_vector_field *pOut, fg_vector_field pIn)
Increase reference count of the resource.
- Return
fg_err error code
- Parameters
[out] pOut
: is the new handle to existing resource[in] pIn
: is the existing resource handle
-
FGAPI fg_err fg_release_vector_field (fg_vector_field pField)
Destroy vector field object.
- Return
fg_err error code
- Parameters
[in] pField
: is the surface handle
-
FGAPI fg_err fg_set_vector_field_color (fg_vector_field pField, const float pRed, const float pGreen, const float pBlue, const float pAlpha)
Set the color of vector field.
- Return
fg_err error code
- Parameters
[in] pField
: is the surface handle[in] pRed
: is Red component in range [0, 1][in] pGreen
: is Green component in range [0, 1][in] pBlue
: is Blue component in range [0, 1][in] pAlpha
: is Blue component in range [0, 1]
-
FGAPI fg_err fg_set_vector_field_legend (fg_vector_field pField, const char *pLegend)
Set vector field legend.
- Return
fg_err error code
- Parameters
[in] pField
: is the vector field handle[in] pLegend
:
-
FGAPI fg_err fg_get_vector_field_vertex_buffer (unsigned *pOut, const fg_vector_field pField)
Get the resource identifier for vertices buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pField
: is the vector field handle
-
FGAPI fg_err fg_get_vector_field_color_buffer (unsigned *pOut, const fg_vector_field pField)
Get the resource identifier for colors buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pField
: is the vector field handle
-
FGAPI fg_err fg_get_vector_field_alpha_buffer (unsigned *pOut, const fg_vector_field pField)
Get the resource identifier for alpha values buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pField
: is the vector field handle
-
FGAPI fg_err fg_get_vector_field_direction_buffer (unsigned *pOut, const fg_vector_field pField)
Get the resource identifier for directions buffer.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer identifier after this function is called[in] pField
: is the vector field handle
-
FGAPI fg_err fg_get_vector_field_vertex_buffer_size (unsigned *pOut, const fg_vector_field pField)
Get the vertices buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pField
: is the vector field handle
-
FGAPI fg_err fg_get_vector_field_color_buffer_size (unsigned *pOut, const fg_vector_field pField)
Get the colors buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pField
: is the vector field handle
-
FGAPI fg_err fg_get_vector_field_alpha_buffer_size (unsigned *pOut, const fg_vector_field pField)
Get the alpha values buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pField
: is the vector field handle
-
FGAPI fg_err fg_get_vector_field_direction_buffer_size (unsigned *pOut, const fg_vector_field pField)
Get the directions buffer size in bytes.
- Return
fg_err error code
- Parameters
[out] pOut
: will have the buffer size in bytes after this function is called[in] pField
: is the vector field handle
-
Window Functions¶
-
group
win_functions
Functions
-
FGAPI fg_err fg_create_window (fg_window *pWindow, const int pWidth, const int pHeight, const char *pTitle, const fg_window pShareWindow, const bool pInvisible)
Create a Window object.
- Return
fg_err error code
- Parameters
[out] pWindow
: is set to the window created[in] pWidth
: Width of the display window[in] pHeight
: Height of the display window[in] pTitle
: window Title[in] pShareWindow
: is an already existing window with which the window to be created should share the rendering context.[in] pInvisible
: indicates if the window is created in invisible mode.
-
FGAPI fg_err fg_retain_window (fg_window *pOut, fg_window pWindow)
Increment the internal reference count for Window.
- Return
fg_err error code
- Parameters
[out] pOut
: is the new window handle pointing to existing window[in] pWindow
: is the original window handle
-
FGAPI fg_err fg_release_window (fg_window pWindow)
Destroy Window Object.
Decrements the reference count to the shared window object.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle
-
FGAPI fg_err fg_set_window_font (fg_window pWindow, const fg_font pFont)
Set font object to be used by Window Object.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle[in] pFont
: is Font handle
-
FGAPI fg_err fg_set_window_title (fg_window pWindow, const char *pTitle)
Set the title of Window Object.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle[in] pTitle
: is the window tile
-
FGAPI fg_err fg_set_window_position (fg_window pWindow, const int pX, const int pY)
Set the window origin of Window Object w.r.t screen origin.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle[in] pX
: is the x coordinate of window top left corner[in] pY
: is the y coordinate of window top left corner
-
FGAPI fg_err fg_set_window_size (fg_window pWindow, const unsigned pWidth, const unsigned pHeight)
Set the window dimensions of Window Object.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle[in] pWidth
: is the width of window[in] pHeight
: is the height of window
-
FGAPI fg_err fg_set_window_colormap (fg_window pWindow, const fg_color_map pColorMap)
Set the colormap to be used by the Window Object.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle[in] pColorMap
: takes one of the values of enum fg_color_map
-
FGAPI fg_err fg_get_window_context_handle (long long *pContext, const fg_window pWindow)
Get the backend specific context handle of Window.
- Return
fg_err error code
- Parameters
[out] pContext
: is set to the backend specific context handle[in] pWindow
: is Window handle
-
FGAPI fg_err fg_get_window_display_handle (long long *pDisplay, const fg_window pWindow)
Get the display device handle of Window.
- Return
fg_err error code
- Parameters
[out] pDisplay
: is set to the display device handle[in] pWindow
: is Window handle
-
FGAPI fg_err fg_get_window_width (int *pWidth, const fg_window pWindow)
Get the width of Window.
- Return
fg_err error code
- Parameters
[out] pWidth
: is set to the width of the Window[in] pWindow
: is Window handle
-
FGAPI fg_err fg_get_window_height (int *pHeight, const fg_window pWindow)
Get the height of Window.
- Return
fg_err error code
- Parameters
[out] pHeight
: is set to the height of the Window[in] pWindow
: is Window handle
-
FGAPI fg_err fg_make_window_current (const fg_window pWindow)
Make the window’s backend specific context the active context in given thread.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle
-
FGAPI fg_err fg_hide_window (const fg_window pWindow)
Hide the Window.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle
-
FGAPI fg_err fg_show_window (const fg_window pWindow)
Show the Window.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle
-
FGAPI fg_err fg_close_window (bool *pIsClosed, const fg_window pWindow)
Check if the Window is closed.
- Return
fg_err error code
- Parameters
[out] pIsClosed
: is set to boolean value if the window is closed[in] pWindow
: is Window handle
-
FGAPI fg_err fg_draw_image (const fg_window pWindow, const fg_image pImage, const bool pKeepAspectRatio)
Render given image to Window.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle[in] pImage
: is Image handle[in] pKeepAspectRatio
: is boolean indicating if the image aspect ratio has to be maintained while rendering the image
-
FGAPI fg_err fg_draw_chart (const fg_window pWindow, const fg_chart pChart)
Render given chart to Window.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle[in] pChart
: is chart handle
-
FGAPI fg_err fg_draw_image_to_cell (const fg_window pWindow, const int pRows, const int pCols, const int pIndex, const fg_image pImage, const char *pTitle, const bool pKeepAspectRatio)
Render given image to Window’s particular sub-view.
- Return
fg_err error code
- Note
this draw call doesn’t automatically swap back buffer with front buffer (double buffering mechanism) since it doesn’t have the knowledge of which sub-regions already got rendered. We should call fg_swap_window_buffers once all draw calls corresponding to all sub-regions are called when in multiview mode.
- Parameters
[in] pWindow
: is Window handle[in] pRows
: indicates the number of rows in grid layout[in] pCols
: indicates the number of columns in grid layout[in] pIndex
: indicates the index of cell in the layout represented bypRows
andpCols
[in] pImage
: is image handle[in] pTitle
: is the title of the sub-view[in] pKeepAspectRatio
: is boolean indicating if the image aspect ratio has to be maintained while rendering the image
-
FGAPI fg_err fg_draw_chart_to_cell (const fg_window pWindow, const int pRows, const int pCols, const int pIndex, const fg_chart pChart, const char *pTitle)
Render given chart to Window’s particular sub-view.
- Return
fg_err error code
- Note
this draw call doesn’t automatically swap back buffer with front buffer (double buffering mechanism) since it doesn’t have the knowledge of which sub-regions already got rendered. We should call fg_swap_window_buffers once all draw calls corresponding to all sub-regions are called when in multiview mode.
- Parameters
[in] pWindow
: is Window handle[in] pRows
: indicates the number of rows in grid layout[in] pCols
: indicates the number of columns in grid layout[in] pIndex
: indicates the index of cell in the layout represented bypRows
andpCols
[in] pChart
: is chart handle[in] pTitle
: is the title of the sub-view
-
FGAPI fg_err fg_swap_window_buffers (const fg_window pWindow)
Swap back buffer with front buffer.
- Return
fg_err error code
- Parameters
[in] pWindow
: is Window handle
-
FGAPI fg_err fg_save_window_framebuffer (const char *pFullPath, const fg_window pWindow)
Save the current frame buffer to a file at provided path.
The frame buffer stored to the disk is saved in the image format based on the extension provided in the full file path string.
- Return
fg_err error code
- Parameters
[in] pFullPath
: is the path at which frame buffer is stored.[in] pWindow
: is Window handle
-
Utility Functions¶
-
group
util_functions
Functions
-
FGAPI void fg_get_last_error (char **msg, int *len)
Fetch the last error’s error code.
-
FGAPI const char * fg_err_to_string (const fg_err err)
Fetch the string message associated to given error code.
-
FGAPI fg_err fg_update_vertex_buffer (const unsigned pBufferId, const size_t pBufferSize, const void *pBufferData)
Update backend specific vertex buffer from given host side memory.
- Return
fg_err error code
- Parameters
[in] pBufferId
: is the buffer identifier[in] pBufferSize
: is the buffer size in bytes[in] pBufferData
: is the pointer of the host side memory
-
FGAPI fg_err fg_update_pixel_buffer (const unsigned pBufferId, const size_t pBufferSize, const void *pBufferData)
Update backend specific pixel buffer from given host side memory.
- Return
fg_err error code
- Parameters
[in] pBufferId
: is the buffer identifier[in] pBufferSize
: is the buffer size in bytes[in] pBufferData
: is the pointer of the host side memory
-
FGAPI fg_err fg_finish ()
Sync all rendering operations till this point.
- Return
fg_err error code
-
FGAPI void updateVertexBuffer (const unsigned pBufferId, const size_t pBufferSize, const void *pBufferData)
Update backend specific vertex buffer from given host side memory.
- Parameters
[in] pBufferId
: is the buffer identifier[in] pBufferSize
: is the buffer size in bytes[in] pBufferData
: is the pointer of the host side memory
-
FGAPI void updatePixelBuffer (const unsigned pBufferId, const size_t pBufferSize, const void *pBufferData)
Update backend specific pixel buffer from given host side memory.
- Parameters
[in] pBufferId
: is the buffer identifier[in] pBufferSize
: is the buffer size in bytes[in] pBufferData
: is the pointer of the host side memory
-
FGAPI void finish ()
Sync all rendering operations till this point.
-