next up previous contents
Next: Font engine Up: The hibLib engines - Previous: The scroll   Contents


The screen

Due to the special scrolling engine, every graphic function have to know the width of the screen buffer in byte unit. So, every graphic function has in parameter a structure that defines the screen memory :


\begin{lstlisting}
typedef struct {
char * ptr;
short byte_width;
} h_ScreenMem;
\end{lstlisting}

For exemple, the classical LCD screen is defined by :


\begin{lstlisting}
...

The screen size is defined as a structure too :


\begin{lstlisting}
typedef struct {
short width;
short height;
} h_ScreenSize;
\end{lstlisting}

Note that the width can be not equal to $8 * byte\_width$. This is the case for the LCD buffer for the Ti 89.

And the position of the screen :


\begin{lstlisting}
typedef struct {
short x;
short y;
} h_ScreenPos;
\end{lstlisting}

The position is used to defined a frame in the buffer of the screen. For exemple, if you want to define a new screen in the LCD screen with a border of 10 pixels : its x position will equal to $10$, y to $10$, its width to $LCD\_WIDTH - 20$ and its height to $LCD\_HEIGHT - 20$ (its memory is still $LCD\_SCREEN$).

And then the global definition of the screen


\begin{lstlisting}
typedef struct {
h_ScreenMem mem;
h_ScreenSize size;
h_ScreenPos pos;
} h_Screen;
\end{lstlisting}

With the previous example, it will be :


\begin{lstlisting}
h_Screen internal_frame = {
.mem = LCD_SCREEN,
.size = {
....
...height = LCD_HEIGHT - 20
},
.pos = {
.x = 10,
.y = 10
}
};
\end{lstlisting}


next up previous contents
Next: Font engine Up: The hibLib engines - Previous: The scroll   Contents
2006-02-19