---
name: "ggiGetOrigin"
section: "3ggi"
platform: "linux"
package: "libggi2-dev"
version: "1:2.0.1-2"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/ggiSetOrigin/3ggi"
---

# ggiGetOrigin(3ggi)

Set and get origin of virtual screen

Part of [ggiSetOrigin(3ggi)](/ggiSetOrigin/3ggi.md).

## NAME

ggiSetOrigin, ggiGetOrigin - Set and get origin of virtual screen

## SYNOPSIS

**#include \<ggi/ggi.h\>**

**int ggiSetOrigin(ggi\_visual\_t** *vis***, int** *x***, int** *y***);**

**int ggiGetOrigin(ggi\_visual\_t** *vis***, int \****x***, int \****y***);** .SH "DESCRIPTION"

**ggiSetOrigin** sets the top-left corner of the displayed area to (*x*, *y*).

When using a larger virtual area, you can pan the visible area over the virtual one to do scrolling. Some targets have extemely efficient means to do this (i.e. they do it in hardware).

Large virtual areas are also commonly used for buffering the display contents, but that is usually more easily accomplished by requesting a specific number of *frames* when setting a mode.

This call takes **dot** coordinates, not pixel coordinates as all other drawing primitives do. There is no difference in graphics modes because by definition *dpp* is 1x1, but in text modes the application can do smooth scrolling.

**ggiGetOrigin** gets the current top-left corner of the displayed area into (*x*, *y*).

Due to rounding to the hardware's capabilities, the values retrieved by a subsequent **ggiGetOrigin** may not necessarily match those passed to **ggiSetOrigin** previously.

## RETURN VALUE

0 for OK, otherwise an error code.

## EXAMPLES

### PAN FROM THE TOP TO THE BOTTOM OF THE VIRTUAL SCREEN

```
for(i = 0; i < virt_y-visible_y; i++) {
        ggiSetOrigin(vis, 0, i);
}

```
