Extents, viewports and clipping

Extents, viewports and clipping — Size information about the current context and the screen

Functions

Includes

#include <grx-3.0.h>

Description

These functions are used to get information about the extents of the current context and the screen. Additionally, the clipping limits used by drawing functions can be set to an arbitrary area of the current context.

Functions

grx_get_width ()

gint
grx_get_width (void);

Gets the width of the current context in pixels.

Returns

the width


grx_get_height ()

gint
grx_get_height (void);

Gets the height of the current context in pixels.

Returns

the height


grx_get_max_x ()

gint
grx_get_max_x (void);

Gets the index of the last pixel of the current context in the X direction.

In other words, this is grx_get_width() -1.

Returns

the index


grx_get_max_y ()

gint
grx_get_max_y (void);

Gets the index of the last pixel of the current context in the Y direction.

In other words, this is grx_get_height() -1.

Returns

the index


grx_get_screen_width ()

gint
grx_get_screen_width (void);

Gets the width of the physical screen in pixels.

Returns

the width


grx_get_screen_height ()

gint
grx_get_screen_height (void);

Gets the height of the physical screen in pixels.

Returns

the height


grx_get_virtual_width ()

gint
grx_get_virtual_width (void);

Gets the width of the virtual screen in pixels.

Returns

the width


grx_get_virtual_height ()

gint
grx_get_virtual_height (void);

Gets the height of the virtual screen in pixels.

Returns

the height


grx_is_screen_virtual ()

gboolean
grx_is_screen_virtual (void);

Checks if the current screen is a virtual screen (i.e. the virtual size is larger than the physical size).

Returns

TRUE if the screen is a virtual screen


grx_get_viewport_x ()

gint
grx_get_viewport_x (void);

Gets the starting X coordinate of the current viewport.

Returns

the X coordinate


grx_get_viewport_y ()

gint
grx_get_viewport_y (void);

Gets the starting Y coordinate of the current viewport.

Returns

the Y coordinate


grx_set_viewport ()

gboolean
grx_set_viewport (gint x,
                  gint y);

Sets the viewport on a virtual screen. The width and height of the viewport are determined by the physical screen size (grx_get_screen_width() and grx_get_screen_height()).

Parameters

x

the left X coordinate of the viewport

 

y

the top Y coordinate of the viewport

 

Returns

TRUE if setting the viewport was successful


grx_set_clip_box ()

void
grx_set_clip_box (gint x1,
                  gint y1,
                  gint x2,
                  gint y2);

Sets the clipping limits on the current context.

Parameters

x1

the left bounds

 

y1

the top bounds

 

x2

the right bounds

 

y2

the bottom bounds

 

grx_get_clip_box ()

void
grx_get_clip_box (gint *x1,
                  gint *y1,
                  gint *x2,
                  gint *y2);

Gets the clipping limits of the current context.

Parameters

x1

the left bounds.

[out]

y1

the top bounds.

[out]

x2

the right bounds.

[out]

y2

the bottom bounds.

[out]

grx_reset_clip_box ()

void
grx_reset_clip_box (void);

Resets the clipping limits of the current context to the size of the current context.


grx_get_clip_box_min_x ()

gint
grx_get_clip_box_min_x (void);

Gets the left bounds of the clipping limits of the current context.

Returns

the current value


grx_get_clip_box_min_y ()

gint
grx_get_clip_box_min_y (void);

Gets the top bounds of the clipping limits of the current context.

Returns

the current value


grx_get_clip_box_max_x ()

gint
grx_get_clip_box_max_x (void);

Gets the right bounds of the clipping limits of the current context.

Returns

the current value


grx_get_clip_box_max_y ()

gint
grx_get_clip_box_max_y (void);

Gets the bottom bounds of the clipping limits of the current context.

Returns

the current value

Types and Values