Choco OS
V.0.16.9.0
Join to the chocolate world
|
Module for storing informations about the screen. More...
Typedefs | |
typedef struct Screen_t * | oC_Screen_t |
Screen object pointer. More... | |
Functions | |
oC_Screen_t | oC_Screen_New (oC_Driver_t Driver, const void *Config, const char *Name) |
creates new screen object More... | |
bool | oC_Screen_IsCorrect (oC_Screen_t Screen) |
checks if the Screen object is correct More... | |
bool | oC_Screen_Delete (oC_Screen_t *Screen) |
Destroys the Screen object. More... | |
bool | oC_Screen_IsConfigured (oC_Screen_t Screen) |
checks if the screen is configured to work More... | |
oC_ErrorCode_t | oC_Screen_Configure (oC_Screen_t Screen) |
configures graphics driver to work More... | |
oC_ErrorCode_t | oC_Screen_Unconfigure (oC_Screen_t Screen) |
unconfigures graphics driver More... | |
oC_ErrorCode_t | oC_Screen_ReadColorMap (oC_Screen_t Screen, oC_ColorMap_t **outColorMap) |
reads pointer to the color map More... | |
oC_ErrorCode_t | oC_Screen_ReadResolution (oC_Screen_t Screen, oC_Pixel_ResolutionUInt_t *outWidth, oC_Pixel_ResolutionUInt_t *outHeight) |
reads resolution of the screen More... | |
const char * | oC_Screen_GetName (oC_Screen_t Screen) |
returns name of the screen More... | |
oC_Driver_t | oC_Screen_GetDriver (oC_Screen_t Screen) |
returns driver associated with the screen More... | |
The "Screen" is a special object that stores information about a screen. I know, that it does not sounds very well, but it means exactly what it does. You should use screens objects, when you want to use some graphics drivers or modules. Generally you should not create them - they are created during startup of the system. Of course it also can be created during it's work, but remember, that it is not allocated for the current process - so if you don't delete the screen, it will cause memory leak.
Each screen object handles only one physical object. So, for example if you have 2 LCD displays, you will need 2 the Screen objects.
You always can check if the Screen object is correct by using function named oC_Screen_IsCorrect. It returns true if the Screen was correctly initialized.
To create the screen you will need pointer to the graphics driver and its configuration. After creation of the object, you also have to configure the graphics driver. You have to do it by using the function named oC_Screen_Configure. You cannot configure a driver by your own, because the Screen object requires context of the configuration to work.
To unconfigure the driver call oC_Screen_Unconfigure function.
To draw something on the screen, you should use the #oc_ColorMap_t. Pointer to the color map you can read by using the function oC_Screen_ReadColorMap. You can also read resolution of the screen by calling the function oC_Screen_ReadResolution
typedef struct Screen_t* oC_Screen_t |
This type stores all informations about the screen. It is a main module object. All data inside are private, and cannot be changed without using an interface functions.
The screen is an object, so it must be created before usage. You can do it by using a function called oC_Screen_New. When the object is not needed anymore, you can destroy it by calling a function named oC_Screen_Delete.
Definition at line 88 of file oc_screen.h.
oC_ErrorCode_t oC_Screen_Configure | ( | oC_Screen_t | Screen | ) |
The function is for configuration of the graphic drivers to work with the screen. You can check if the driver was configured before by calling the function oC_Screen_IsConfigured. The screen will work only if the graphic driver is configured by calling this function (it cannot be configured manually).
If the driver is already correctly configured, the function will return error #oC_ErrorCode_AlreadyConfigured. To unconfigure driver please call the function oC_Screen_Unconfigure.
Screen | The Screen object created by the function oC_Screen_New |
Definition at line 257 of file oc_screen.c.
bool oC_Screen_Delete | ( | oC_Screen_t * | Screen | ) |
The function is for destroying the Screen object. It also deconfigures the graphic driver.
The function returns only result of the operation (success or failure), so if you want to know what kind of error occurs you can use function 'oC_ReadLastError' to read it or just use the chell's command "system".
Screen | Pointer to the screen created before by using the function called oC_Screen_New |
Definition at line 185 of file oc_screen.c.
oC_Driver_t oC_Screen_GetDriver | ( | oC_Screen_t | Screen | ) |
The function returns driver associated with the screen or NULL if some error has occured.
Screen | Screen object created by the function oC_Screen_New |
Definition at line 415 of file oc_screen.c.
const char* oC_Screen_GetName | ( | oC_Screen_t | Screen | ) |
The function returns name of the screen.
Screen | Screen object created by the function oC_Screen_New and configured by oC_Screen_Configure |
Definition at line 386 of file oc_screen.c.
bool oC_Screen_IsConfigured | ( | oC_Screen_t | Screen | ) |
The function is for verification if the driver associated with the screen was correctly configured before. The function returns true only if the screen is correct, and the driver configuration function has been called by using the Screen object (oC_Screen_Configure). If the driver is configured without using the Screen object, the screen object will be not usable.
Screen | The screen allocated and initialized before by function #pC_Screen_New |
Definition at line 234 of file oc_screen.c.
bool oC_Screen_IsCorrect | ( | oC_Screen_t | Screen | ) |
The function is for verification if the Screen object is correct. The function returns true if the address is correct and object is initialized.
Screen | Pointer to the screen object |
Definition at line 160 of file oc_screen.c.
oC_Screen_t oC_Screen_New | ( | oC_Driver_t | Driver, |
const void * | Config, | ||
const char * | Name | ||
) |
The function allocates and initializes new oC_Screen_t object. The object is always allocated with the screen allocator. When the oC_Screen_t is not needed anymore, it should be destroyed by the function named oC_Screen_Delete.
This function does not configures the driver to work. It should be done manually by calling the function oC_Screen_Configure.
If the error occurs, you can use function 'oC_ReadLastError' to read it or just use the chell's command "system".
Driver | Pointer to the graphics driver that should be used for screen configuration and managing |
Config | Pointer to the driver configuration. It will be copied |
Name | Friendly name of the screen |
Definition at line 101 of file oc_screen.c.
oC_ErrorCode_t oC_Screen_ReadColorMap | ( | oC_Screen_t | Screen, |
oC_ColorMap_t ** | outColorMap | ||
) |
The function returns color map that can be used for drawing on the screen. Before usage of this function you have to call the function oC_Screen_Configure function.
Screen | The screen object created by the function oC_Screen_New and configured by the function oC_Screen_Configure |
outColorMap | Destination pointer for the color map pointer |
Definition at line 324 of file oc_screen.c.
oC_ErrorCode_t oC_Screen_ReadResolution | ( | oC_Screen_t | Screen, |
oC_Pixel_ResolutionUInt_t * | outWidth, | ||
oC_Pixel_ResolutionUInt_t * | outHeight | ||
) |
The function is for reading resolution of the screen (width and the height). The graphics driver associated with the screen object have to be configured by the function oC_Screen_Configure.
Screen | Screen object created by the function oC_Screen_New and configured by oC_Screen_Configure |
outWidth | Destination for the width of the screen |
outHeight | Destination for the height of the screen |
Definition at line 356 of file oc_screen.c.
oC_ErrorCode_t oC_Screen_Unconfigure | ( | oC_Screen_t | Screen | ) |
The function is for unconfiguration of the driver associated with the screen.. When this function is called, the context of the driver should be destroyed, and the screen is not usable.
If the driver is not configured, the function will return #oC_ErrorCode_NotConfiguredYet
Screen | The screen object created by the function oC_Screen_New |
Definition at line 292 of file oc_screen.c.