OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
Loading...
Searching...
No Matches
occtl_viz.h File Reference

OCCT-Light: graph-native visualization module public API. More...

#include <stddef.h>
#include <stdint.h>
#include "occtl_core.h"
#include "occtl_geom.h"
#include "occtl_topo.h"
Include dependency graph for occtl_viz.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  occtl_viz_driver_options
 
struct  occtl_viz_view_options
 
struct  occtl_viz_camera
 
struct  occtl_viz_pick_result
 

Macros

#define OCCTL_VIZ_DRIVER_OPTIONS_VERSION_1   1u
 
#define OCCTL_VIZ_VIEW_OPTIONS_VERSION_1   1u
 
#define OCCTL_VIZ_DRIVER_OPTIONS_INIT   {OCCTL_VIZ_DRIVER_OPTIONS_VERSION_1, NULL, 1, 1}
 
#define OCCTL_VIZ_VIEW_OPTIONS_INIT   {OCCTL_VIZ_VIEW_OPTIONS_VERSION_1, NULL, 640, 480, NULL, 1}
 
#define OCCTL_VIZ_PICK_RESULT_VERSION_1   1u
 
#define OCCTL_VIZ_PICK_RESULT_INIT
 

Typedefs

typedef struct occtl_viz_driver occtl_viz_driver_t
 
typedef struct occtl_viz_viewer occtl_viz_viewer_t
 
typedef struct occtl_viz_view occtl_viz_view_t
 
typedef struct occtl_viz_presentable occtl_viz_presentable_t
 
typedef enum occtl_viz_display_mode occtl_viz_display_mode_t
 
typedef enum occtl_viz_selection_mode occtl_viz_selection_mode_t
 
typedef enum occtl_viz_standard_view occtl_viz_standard_view_t
 
typedef struct occtl_viz_driver_options occtl_viz_driver_options_t
 
typedef struct occtl_viz_view_options occtl_viz_view_options_t
 
typedef struct occtl_viz_camera occtl_viz_camera_t
 
typedef struct occtl_viz_pick_result occtl_viz_pick_result_t
 

Enumerations

enum  occtl_viz_display_mode {
  OCCTL_VIZ_DISPLAY_WIREFRAME = 0 , OCCTL_VIZ_DISPLAY_SHADED = 1 , OCCTL_VIZ_DISPLAY_SHADED_WITH_EDGES = 10 , OCCTL_VIZ_DISPLAY_MESH_DEBUG = 11 ,
  OCCTL_VIZ_DISPLAY_RESERVED_FUTURE = 0x7fffffff
}
 
enum  occtl_viz_selection_mode {
  OCCTL_VIZ_SELECT_WHOLE = 0 , OCCTL_VIZ_SELECT_FACE = 1 , OCCTL_VIZ_SELECT_EDGE = 2 , OCCTL_VIZ_SELECT_VERTEX = 3 ,
  OCCTL_VIZ_SELECT_WIRE = 4 , OCCTL_VIZ_SELECT_SHELL = 5 , OCCTL_VIZ_SELECT_SOLID = 6 , OCCTL_VIZ_SELECT_COEDGE = 7 ,
  OCCTL_VIZ_SELECT_PRODUCT = 8 , OCCTL_VIZ_SELECT_COMPOUND = 9 , OCCTL_VIZ_SELECT_COMPSOLID = 10 , OCCTL_VIZ_SELECT_RESERVED_FUTURE = 0x7fffffff
}
 
enum  occtl_viz_standard_view {
  OCCTL_VIZ_VIEW_FRONT = 0 , OCCTL_VIZ_VIEW_BACK = 1 , OCCTL_VIZ_VIEW_LEFT = 2 , OCCTL_VIZ_VIEW_RIGHT = 3 ,
  OCCTL_VIZ_VIEW_TOP = 4 , OCCTL_VIZ_VIEW_BOTTOM = 5 , OCCTL_VIZ_VIEW_ISO = 6 , OCCTL_VIZ_VIEW_RESERVED_FUTURE = 0x7fffffff
}
 

Functions

void occtl_viz_driver_options_init (occtl_viz_driver_options_t *options)
 
void occtl_viz_view_options_init (occtl_viz_view_options_t *options)
 
void occtl_viz_pick_result_init (occtl_viz_pick_result_t *pick)
 
occtl_status_t occtl_viz_driver_create (const occtl_viz_driver_options_t *options, occtl_viz_driver_t **out_driver)
 
void occtl_viz_driver_free (occtl_viz_driver_t *driver)
 
occtl_status_t occtl_viz_viewer_create (occtl_viz_driver_t *driver, occtl_viz_viewer_t **out_viewer)
 
void occtl_viz_viewer_free (occtl_viz_viewer_t *viewer)
 
occtl_status_t occtl_viz_view_create (occtl_viz_viewer_t *viewer, const occtl_viz_view_options_t *options, occtl_viz_view_t **out_view)
 
void occtl_viz_view_free (occtl_viz_view_t *view)
 
occtl_status_t occtl_viz_presentable_create (occtl_viz_viewer_t *viewer, occtl_graph_t *graph, occtl_node_id_t root, occtl_viz_presentable_t **out_presentable)
 
void occtl_viz_presentable_free (occtl_viz_presentable_t *presentable)
 
occtl_status_t occtl_viz_presentable_set_display_mode (occtl_viz_presentable_t *presentable, occtl_viz_display_mode_t mode)
 
occtl_status_t occtl_viz_presentable_synchronize (occtl_viz_presentable_t *presentable, int32_t *out_has_changed)
 
occtl_status_t occtl_viz_presentable_invalidate (occtl_viz_presentable_t *presentable)
 
occtl_status_t occtl_viz_presentable_set_visible_nodes (occtl_viz_presentable_t *presentable, const occtl_node_id_t *nodes, size_t n_nodes)
 
occtl_status_t occtl_viz_presentable_clear_visible_nodes (occtl_viz_presentable_t *presentable)
 
occtl_status_t occtl_viz_view_display (occtl_viz_view_t *view, occtl_viz_presentable_t *presentable)
 
occtl_status_t occtl_viz_view_erase (occtl_viz_view_t *view, occtl_viz_presentable_t *presentable)
 
occtl_status_t occtl_viz_view_resize (occtl_viz_view_t *view, int32_t width, int32_t height)
 
occtl_status_t occtl_viz_view_redraw (occtl_viz_view_t *view)
 
occtl_status_t occtl_viz_view_fit_all (occtl_viz_view_t *view)
 
occtl_status_t occtl_viz_view_set_background (occtl_viz_view_t *view, occtl_color_rgba_t color)
 
occtl_status_t occtl_viz_view_set_camera (occtl_viz_view_t *view, const occtl_viz_camera_t *camera)
 
occtl_status_t occtl_viz_view_get_camera (const occtl_viz_view_t *view, occtl_viz_camera_t *out_camera)
 
occtl_status_t occtl_viz_view_set_standard_view (occtl_viz_view_t *view, occtl_viz_standard_view_t standard_view)
 
occtl_status_t occtl_viz_view_pan (occtl_viz_view_t *view, int32_t dx, int32_t dy)
 
occtl_status_t occtl_viz_view_zoom (occtl_viz_view_t *view, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
 
occtl_status_t occtl_viz_view_orbit_start (occtl_viz_view_t *view, int32_t x, int32_t y)
 
occtl_status_t occtl_viz_view_orbit_update (occtl_viz_view_t *view, int32_t x, int32_t y)
 
occtl_status_t occtl_viz_view_activate_selection (occtl_viz_view_t *view, occtl_viz_presentable_t *presentable, occtl_viz_selection_mode_t mode)
 
occtl_status_t occtl_viz_view_pick (occtl_viz_view_t *view, int32_t x, int32_t y, int32_t select, occtl_viz_pick_result_t *out_pick)
 
occtl_status_t occtl_viz_view_read_pixels_rgba (occtl_viz_view_t *view, uint8_t *out_rgba, size_t cap, size_t *out_count)
 
occtl_status_t occtl_viz_view_dump_image (occtl_viz_view_t *view, const char *path)
 

Detailed Description

OCCT-Light: graph-native visualization module public API.

The visualization module is an opt-in heavy integration over OCCT's native viewer stack. It displays BRepGraph roots through AIS_BRepGraph and exposes only OCCT-Light handles, IDs, POD options, and status codes.

Threading.
Rendering calls must run on the thread that owns the native window and OpenGL context. The module does not create native windows; native handles are borrowed from the host UI toolkit.

Macro Definition Documentation

◆ OCCTL_VIZ_DRIVER_OPTIONS_INIT

#define OCCTL_VIZ_DRIVER_OPTIONS_INIT   {OCCTL_VIZ_DRIVER_OPTIONS_VERSION_1, NULL, 1, 1}

Static initializer for occtl_viz_driver_options_t.

◆ OCCTL_VIZ_PICK_RESULT_INIT

#define OCCTL_VIZ_PICK_RESULT_INIT
Value:
{ \
OCCTL_VIZ_PICK_RESULT_VERSION_1, NULL, OCCTL_UID_INVALID, OCCTL_NODE_ID_INVALID, \
OCCTL_REF_ID_INVALID, OCCTL_VIZ_SELECT_WHOLE, \
{{1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0}} \
}
#define OCCTL_UID_INVALID
Definition occtl_core.h:286
#define OCCTL_NODE_ID_INVALID
Definition occtl_topo_types.h:138
@ OCCTL_VIZ_SELECT_WHOLE
Definition occtl_viz.h:121

◆ OCCTL_VIZ_VIEW_OPTIONS_INIT

#define OCCTL_VIZ_VIEW_OPTIONS_INIT   {OCCTL_VIZ_VIEW_OPTIONS_VERSION_1, NULL, 640, 480, NULL, 1}

Static initializer for occtl_viz_view_options_t.

Typedef Documentation

◆ occtl_viz_camera_t

Camera placement for a viz view.

\par Thread Safety Yes.

See also
occtl_viz_view_set_camera

◆ occtl_viz_display_mode_t

Display mode used for graph presentables.

\par Thread Safety Yes.

See also
occtl_viz_presentable_set_display_mode

◆ occtl_viz_driver_options_t

Versioned options for occtl_viz_driver_create().

Initialize with OCCTL_VIZ_DRIVER_OPTIONS_INIT or occtl_viz_driver_options_init() before use.

\par Thread Safety Yes.

See also
occtl_viz_driver_options_init

◆ occtl_viz_driver_t

typedef struct occtl_viz_driver occtl_viz_driver_t

Opaque process-local visualization driver handle.

Created with occtl_viz_driver_create and released with occtl_viz_driver_free. A driver must outlive viewers created from it.

\par Thread Safety No. Use on the rendering/native-window owner thread.

See also
occtl_viz_driver_create

◆ occtl_viz_pick_result_t

Graph identity returned by occtl_viz_view_pick().

\par Thread Safety Yes.

See also
occtl_viz_view_pick

◆ occtl_viz_presentable_t

typedef struct occtl_viz_presentable occtl_viz_presentable_t

Opaque display object for a BRepGraph root.

Created with occtl_viz_presentable_create and released with occtl_viz_presentable_free. A presentable borrows its source graph; keep the graph alive until the presentable is freed.

\par Thread Safety No. Use on the rendering/native-window owner thread.

See also
occtl_viz_presentable_create

◆ occtl_viz_selection_mode_t

Graph-native selection mode.

\par Thread Safety Yes.

See also
occtl_viz_view_activate_selection

◆ occtl_viz_standard_view_t

Standard camera orientation.

\par Thread Safety Yes.

See also
occtl_viz_view_set_standard_view

◆ occtl_viz_view_options_t

Versioned options for occtl_viz_view_create().

Initialize with OCCTL_VIZ_VIEW_OPTIONS_INIT or occtl_viz_view_options_init() before use.

\par Thread Safety Yes.

See also
occtl_viz_view_options_init

◆ occtl_viz_view_t

typedef struct occtl_viz_view occtl_viz_view_t

Opaque native or offscreen view handle.

Created with occtl_viz_view_create and released with occtl_viz_view_free. When a native window handle is supplied in occtl_viz_view_options_t, the view borrows that handle; the host UI toolkit remains responsible for it.

\par Thread Safety No. Use on the rendering/native-window owner thread.

See also
occtl_viz_view_create

◆ occtl_viz_viewer_t

typedef struct occtl_viz_viewer occtl_viz_viewer_t

Opaque viewer handle.

Created with occtl_viz_viewer_create and released with occtl_viz_viewer_free. A viewer must outlive views and presentables created from it.

\par Thread Safety No. Use on the rendering/native-window owner thread.

See also
occtl_viz_viewer_create

Enumeration Type Documentation

◆ occtl_viz_display_mode

Display mode used for graph presentables.

\par Thread Safety Yes.

See also
occtl_viz_presentable_set_display_mode
Enumerator
OCCTL_VIZ_DISPLAY_WIREFRAME 

Wireframe display.

OCCTL_VIZ_DISPLAY_SHADED 

Shaded display without B-Rep edges.

OCCTL_VIZ_DISPLAY_SHADED_WITH_EDGES 

Shaded display with B-Rep edges.

OCCTL_VIZ_DISPLAY_MESH_DEBUG 

Mesh-debug display mode.

◆ occtl_viz_selection_mode

Graph-native selection mode.

\par Thread Safety Yes.

See also
occtl_viz_view_activate_selection
Enumerator
OCCTL_VIZ_SELECT_WHOLE 

Select the whole presentable.

OCCTL_VIZ_SELECT_FACE 

Select faces.

OCCTL_VIZ_SELECT_EDGE 

Select edges.

OCCTL_VIZ_SELECT_VERTEX 

Select vertices.

OCCTL_VIZ_SELECT_WIRE 

Select wires.

OCCTL_VIZ_SELECT_SHELL 

Select shells.

OCCTL_VIZ_SELECT_SOLID 

Select solids.

OCCTL_VIZ_SELECT_COEDGE 

Select coedges.

OCCTL_VIZ_SELECT_PRODUCT 

Select product nodes.

OCCTL_VIZ_SELECT_COMPOUND 

Select compounds.

OCCTL_VIZ_SELECT_COMPSOLID 

Select compsolids.

◆ occtl_viz_standard_view

Standard camera orientation.

\par Thread Safety Yes.

See also
occtl_viz_view_set_standard_view
Enumerator
OCCTL_VIZ_VIEW_FRONT 

Front view.

OCCTL_VIZ_VIEW_BACK 

Back view.

OCCTL_VIZ_VIEW_LEFT 

Left view.

OCCTL_VIZ_VIEW_RIGHT 

Right view.

OCCTL_VIZ_VIEW_TOP 

Top view.

OCCTL_VIZ_VIEW_BOTTOM 

Bottom view.

OCCTL_VIZ_VIEW_ISO 

Isometric view.

Function Documentation

◆ occtl_viz_driver_create()

occtl_status_t occtl_viz_driver_create ( const occtl_viz_driver_options_t options,
occtl_viz_driver_t **  out_driver 
)

Creates the process-local visualization driver.

The returned handle owns the visualization driver state and must be released with occtl_viz_driver_free. Pass NULL for options to use OCCTL_VIZ_DRIVER_OPTIONS_INIT defaults.

Parameters
[in]optionsBorrows it. Optional; NULL uses defaults.
[out]out_driverOwns it. Must be non-NULL. On success receives a new driver handle; on failure receives NULL.
Return values
OCCTL_OKDriver created.
OCCTL_INVALID_ARGUMENTout_driver is NULL.
OCCTL_VERSION_MISMATCHoptions has an unsupported version.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_driver_free

◆ occtl_viz_driver_free()

void occtl_viz_driver_free ( occtl_viz_driver_t driver)

Frees a visualization driver.

Child viewers, views, and presentables created from driver must already be freed. Passing NULL is a no-op.

Parameters
[in]driverOwns it. NULL is accepted.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_driver_create

◆ occtl_viz_driver_options_init()

void occtl_viz_driver_options_init ( occtl_viz_driver_options_t options)

Runtime initialiser for occtl_viz_driver_options_t.

Sets all fields to OCCTL_VIZ_DRIVER_OPTIONS_INIT.

Parameters
[out]optionsBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_viz_driver_create

◆ occtl_viz_pick_result_init()

void occtl_viz_pick_result_init ( occtl_viz_pick_result_t pick)

Runtime initialiser for occtl_viz_pick_result_t.

Sets all fields to OCCTL_VIZ_PICK_RESULT_INIT.

Parameters
[out]pickBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_viz_view_pick

◆ occtl_viz_presentable_clear_visible_nodes()

occtl_status_t occtl_viz_presentable_clear_visible_nodes ( occtl_viz_presentable_t presentable)

Clears a visible node mask.

Parameters
[in]presentableBorrows it. Must be non-NULL.
Return values
OCCTL_OKMask cleared.
OCCTL_INVALID_ARGUMENTpresentable is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_presentable_set_visible_nodes

◆ occtl_viz_presentable_create()

occtl_status_t occtl_viz_presentable_create ( occtl_viz_viewer_t viewer,
occtl_graph_t graph,
occtl_node_id_t  root,
occtl_viz_presentable_t **  out_presentable 
)

Creates a display object for a graph root.

The returned presentable borrows both viewer and graph. Keep both alive until the presentable is released with occtl_viz_presentable_free.

Parameters
[in]viewerBorrows it. Must be non-NULL.
[in]graphBorrows it. Must be non-NULL and must outlive the presentable.
[in]rootRoot node to display.
[out]out_presentableOwns it. Must be non-NULL. On success receives a new presentable handle; on failure receives NULL.
Return values
OCCTL_OKPresentable created.
OCCTL_INVALID_ARGUMENTviewer, graph, or out_presentable is NULL.
OCCTL_NOT_FOUNDroot is not a valid display root.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_presentable_free

◆ occtl_viz_presentable_free()

void occtl_viz_presentable_free ( occtl_viz_presentable_t presentable)

Frees a presentable.

Passing NULL is a no-op.

Parameters
[in]presentableOwns it. NULL is accepted.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_presentable_create

◆ occtl_viz_presentable_invalidate()

occtl_status_t occtl_viz_presentable_invalidate ( occtl_viz_presentable_t presentable)

Invalidates cached presentation state.

Parameters
[in]presentableBorrows it. Must be non-NULL.
Return values
OCCTL_OKCache invalidated.
OCCTL_INVALID_ARGUMENTpresentable is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_presentable_synchronize

◆ occtl_viz_presentable_set_display_mode()

occtl_status_t occtl_viz_presentable_set_display_mode ( occtl_viz_presentable_t presentable,
occtl_viz_display_mode_t  mode 
)

Sets the display mode for a presentable.

Parameters
[in]presentableBorrows it. Must be non-NULL.
[in]modeDisplay mode.
Return values
OCCTL_OKMode set.
OCCTL_INVALID_ARGUMENTpresentable is NULL.
OCCTL_OUT_OF_RANGEmode is not valid.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_display

◆ occtl_viz_presentable_set_visible_nodes()

occtl_status_t occtl_viz_presentable_set_visible_nodes ( occtl_viz_presentable_t presentable,
const occtl_node_id_t nodes,
size_t  n_nodes 
)

Restricts display to a visible node mask.

Parameters
[in]presentableBorrows it. Must be non-NULL.
[in]nodesBorrows it. Optional array of node IDs.
[in]n_nodesNumber of entries in nodes.
Return values
OCCTL_OKMask applied.
OCCTL_INVALID_ARGUMENTpresentable is NULL or nodes is NULL with non-zero count.
OCCTL_NOT_FOUNDAn entry in nodes is not a valid node ID.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_presentable_clear_visible_nodes

◆ occtl_viz_presentable_synchronize()

occtl_status_t occtl_viz_presentable_synchronize ( occtl_viz_presentable_t presentable,
int32_t *  out_has_changed 
)

Synchronizes a presentable after graph or metadata changes.

Parameters
[in]presentableBorrows it. Must be non-NULL.
[out]out_has_changedBorrows it. Must be non-NULL; receives a 0/1 changed flag.
Return values
OCCTL_OKSynchronization completed.
OCCTL_INVALID_ARGUMENTpresentable or out_has_changed is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_presentable_invalidate

◆ occtl_viz_view_activate_selection()

occtl_status_t occtl_viz_view_activate_selection ( occtl_viz_view_t view,
occtl_viz_presentable_t presentable,
occtl_viz_selection_mode_t  mode 
)

Activates graph-native selection for a presentable.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]presentableBorrows it. Must be non-NULL.
[in]modeSelection mode.
Return values
OCCTL_OKSelection activated.
OCCTL_INVALID_ARGUMENTA required handle is NULL.
OCCTL_OUT_OF_RANGEmode is not valid.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_pick

◆ occtl_viz_view_create()

occtl_status_t occtl_viz_view_create ( occtl_viz_viewer_t viewer,
const occtl_viz_view_options_t options,
occtl_viz_view_t **  out_view 
)

Creates a native or offscreen view.

The returned view borrows viewer and must be freed before the viewer. Pass NULL for options to use OCCTL_VIZ_VIEW_OPTIONS_INIT defaults.

Parameters
[in]viewerBorrows it. Must be non-NULL.
[in]optionsBorrows it. Optional; NULL uses defaults.
[out]out_viewOwns it. Must be non-NULL. On success receives a new view handle; on failure receives NULL.
Return values
OCCTL_OKView created.
OCCTL_INVALID_ARGUMENTviewer or out_view is NULL.
OCCTL_VERSION_MISMATCHoptions has an unsupported version.
OCCTL_OUT_OF_RANGEoptions has a non-positive width or height.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_free

◆ occtl_viz_view_display()

occtl_status_t occtl_viz_view_display ( occtl_viz_view_t view,
occtl_viz_presentable_t presentable 
)

Displays a presentable in a view.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]presentableBorrows it. Must be non-NULL.
Return values
OCCTL_OKDisplayed.
OCCTL_INVALID_ARGUMENTA required handle is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_erase

◆ occtl_viz_view_dump_image()

occtl_status_t occtl_viz_view_dump_image ( occtl_viz_view_t view,
const char *  path 
)

Dumps a view image to a PNG path when OCCT image codecs are available.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]pathBorrows it. UTF-8 destination path.
Return values
OCCTL_OKImage written.
OCCTL_INVALID_ARGUMENTA required pointer is NULL.
OCCTL_IO_ERRORThe image could not be written.
OCCTL_UNSUPPORTEDImage dumping is unavailable.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_read_pixels_rgba

◆ occtl_viz_view_erase()

occtl_status_t occtl_viz_view_erase ( occtl_viz_view_t view,
occtl_viz_presentable_t presentable 
)

Erases a presentable from a view.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]presentableBorrows it. Must be non-NULL.
Return values
OCCTL_OKErased.
OCCTL_INVALID_ARGUMENTA required handle is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_display

◆ occtl_viz_view_fit_all()

occtl_status_t occtl_viz_view_fit_all ( occtl_viz_view_t view)

Fits all displayed content.

Parameters
[in]viewBorrows it. Must be non-NULL.
Return values
OCCTL_OKCamera fitted.
OCCTL_INVALID_ARGUMENTview is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_set_standard_view

◆ occtl_viz_view_free()

void occtl_viz_view_free ( occtl_viz_view_t view)

Frees a view.

Passing NULL is a no-op.

Parameters
[in]viewOwns it. NULL is accepted.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_create

◆ occtl_viz_view_get_camera()

occtl_status_t occtl_viz_view_get_camera ( const occtl_viz_view_t view,
occtl_viz_camera_t out_camera 
)

Gets the camera.

Parameters
[in]viewBorrows it. Must be non-NULL.
[out]out_cameraBorrows it. Must be non-NULL.
Return values
OCCTL_OKCamera returned.
OCCTL_INVALID_ARGUMENTA required pointer is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_set_camera

◆ occtl_viz_view_options_init()

void occtl_viz_view_options_init ( occtl_viz_view_options_t options)

Runtime initialiser for occtl_viz_view_options_t.

Sets all fields to OCCTL_VIZ_VIEW_OPTIONS_INIT.

Parameters
[out]optionsBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_viz_view_create

◆ occtl_viz_view_orbit_start()

occtl_status_t occtl_viz_view_orbit_start ( occtl_viz_view_t view,
int32_t  x,
int32_t  y 
)

Starts an orbit interaction.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]xStart x coordinate.
[in]yStart y coordinate.
Return values
OCCTL_OKOrbit started.
OCCTL_INVALID_ARGUMENTview is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_orbit_update

◆ occtl_viz_view_orbit_update()

occtl_status_t occtl_viz_view_orbit_update ( occtl_viz_view_t view,
int32_t  x,
int32_t  y 
)

Updates an orbit interaction.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]xCurrent x coordinate.
[in]yCurrent y coordinate.
Return values
OCCTL_OKOrbit updated.
OCCTL_INVALID_ARGUMENTview is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_orbit_start

◆ occtl_viz_view_pan()

occtl_status_t occtl_viz_view_pan ( occtl_viz_view_t view,
int32_t  dx,
int32_t  dy 
)

Pans the camera by screen-space pixels.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]dxHorizontal delta in pixels.
[in]dyVertical delta in pixels.
Return values
OCCTL_OKCamera panned.
OCCTL_INVALID_ARGUMENTview is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_zoom

◆ occtl_viz_view_pick()

occtl_status_t occtl_viz_view_pick ( occtl_viz_view_t view,
int32_t  x,
int32_t  y,
int32_t  select,
occtl_viz_pick_result_t out_pick 
)

Moves/selects at a screen point and returns graph identity.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]xScreen x coordinate.
[in]yScreen y coordinate.
[in]select0/1; non-zero performs selection, zero only detects.
[out]out_pickBorrows it. Must be non-NULL.
Return values
OCCTL_OKPick result returned.
OCCTL_INVALID_ARGUMENTA required pointer is NULL.
OCCTL_NOT_FOUNDNothing graph-native was detected.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_activate_selection

◆ occtl_viz_view_read_pixels_rgba()

occtl_status_t occtl_viz_view_read_pixels_rgba ( occtl_viz_view_t view,
uint8_t *  out_rgba,
size_t  cap,
size_t *  out_count 
)

Reads view pixels as tightly packed RGBA bytes.

Parameters
[in]viewBorrows it. Must be non-NULL.
[out]out_rgbaBorrows it. Optional buffer; NULL performs sizing only.
[in]capCapacity of out_rgba in bytes.
[out]out_countBorrows it. Receives required or written byte count.
Return values
OCCTL_OKPixels written.
OCCTL_INVALID_ARGUMENTview or out_count is NULL.
OCCTL_BUFFER_TOO_SMALLcap is too small for the current view size.
OCCTL_OUT_OF_MEMORYTemporary pixel storage could not be allocated.
OCCTL_UNSUPPORTEDOffscreen pixel extraction is unavailable.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_dump_image

◆ occtl_viz_view_redraw()

occtl_status_t occtl_viz_view_redraw ( occtl_viz_view_t view)

Redraws a view.

Parameters
[in]viewBorrows it. Must be non-NULL.
Return values
OCCTL_OKRedrawn.
OCCTL_INVALID_ARGUMENTview is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_read_pixels_rgba

◆ occtl_viz_view_resize()

occtl_status_t occtl_viz_view_resize ( occtl_viz_view_t view,
int32_t  width,
int32_t  height 
)

Resizes a view.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]widthNew width in pixels.
[in]heightNew height in pixels.
Return values
OCCTL_OKView resized.
OCCTL_INVALID_ARGUMENTview is NULL.
OCCTL_OUT_OF_RANGEwidth or height is non-positive.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_redraw

◆ occtl_viz_view_set_background()

occtl_status_t occtl_viz_view_set_background ( occtl_viz_view_t view,
occtl_color_rgba_t  color 
)

Sets the view background color.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]colorBackground color.
Return values
OCCTL_OKColor set.
OCCTL_INVALID_ARGUMENTview is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_redraw

◆ occtl_viz_view_set_camera()

occtl_status_t occtl_viz_view_set_camera ( occtl_viz_view_t view,
const occtl_viz_camera_t camera 
)

Sets the camera.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]cameraBorrows it. Must be non-NULL.
Return values
OCCTL_OKCamera set.
OCCTL_INVALID_ARGUMENTA required pointer is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_get_camera

◆ occtl_viz_view_set_standard_view()

occtl_status_t occtl_viz_view_set_standard_view ( occtl_viz_view_t view,
occtl_viz_standard_view_t  standard_view 
)

Sets a standard camera orientation.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]standard_viewStandard view orientation.
Return values
OCCTL_OKOrientation set.
OCCTL_INVALID_ARGUMENTview is NULL.
OCCTL_OUT_OF_RANGEstandard_view is not valid.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_fit_all

◆ occtl_viz_view_zoom()

occtl_status_t occtl_viz_view_zoom ( occtl_viz_view_t view,
int32_t  x1,
int32_t  y1,
int32_t  x2,
int32_t  y2 
)

Zooms using two screen-space points.

Parameters
[in]viewBorrows it. Must be non-NULL.
[in]x1First x coordinate.
[in]y1First y coordinate.
[in]x2Second x coordinate.
[in]y2Second y coordinate.
Return values
OCCTL_OKCamera zoomed.
OCCTL_INVALID_ARGUMENTview is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_view_pan

◆ occtl_viz_viewer_create()

occtl_status_t occtl_viz_viewer_create ( occtl_viz_driver_t driver,
occtl_viz_viewer_t **  out_viewer 
)

Creates a viewer from a visualization driver.

The returned viewer borrows driver and must be freed before the driver.

Parameters
[in]driverBorrows it. Must be non-NULL.
[out]out_viewerOwns it. Must be non-NULL. On success receives a new viewer handle; on failure receives NULL.
Return values
OCCTL_OKViewer created.
OCCTL_INVALID_ARGUMENTdriver or out_viewer is NULL.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_viewer_free

◆ occtl_viz_viewer_free()

void occtl_viz_viewer_free ( occtl_viz_viewer_t viewer)

Frees a viewer.

Views and presentables created from viewer must already be freed. Passing NULL is a no-op.

Parameters
[in]viewerOwns it. NULL is accepted.

\par Thread Safety No. Call on the rendering/native-window owner thread.

See also
occtl_viz_viewer_create