Complete bitmap doc
This commit is contained in:
parent
da72997a6e
commit
39e25c13e5
|
@ -20,33 +20,30 @@ typedef struct fe_bitmap
|
|||
} fe_bitmap;
|
||||
|
||||
|
||||
/* fe_bitmap_new_rich()
|
||||
/* fe_bitmap_new()
|
||||
creates a new bitmap in the ram
|
||||
with this function, the bmp is dynamic only, but there is still a way tou create it staticly :
|
||||
you create a dynamic bmp
|
||||
you create a static bmp <fe_bitmap bmp;>
|
||||
you do a memcpy*/
|
||||
fe_bitmap_rich* fe_bitmap_new_rich(
|
||||
fe_bitmap* fe_bitmap_new(
|
||||
uint32_t size_px_x, uint32_t size_px_y, // bitmap size
|
||||
uint32_t* color, bool copy_color, // color table address and type (static | dynamic)
|
||||
uint32_t *layout, bool copy_layout // layout table address and type (static | dynamic)
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief delete a rich bitmap created with bitmap_new_rich()
|
||||
*
|
||||
* @param txtr The bitmap to delete
|
||||
*/
|
||||
void fe_bitmap_delete_rich(fe_bitmap_rich * txtr);
|
||||
/* fe_bitmap_del()
|
||||
deletes the bitmap from the ram */
|
||||
void fe_bitmap_del(fe_bitmap * txtr);
|
||||
|
||||
|
||||
/* fe_bitmap_get_pixel()
|
||||
returns the color of a pixel in the gint's type*/
|
||||
uint8_t fe_bitmap_get_pixel_r(const fe_bitmap_rich * txtr, uint32_t x, uint32_t y);
|
||||
uint8_t fe_bitmap_get_pixel(const fe_bitmap * txtr, uint32_t x, uint32_t y);
|
||||
|
||||
|
||||
/* fe_bitmap_display_pixel()
|
||||
display a specific rich bitmap pixel on the screen (on vram) */
|
||||
void fe_bitmap_display_pixel_r(const fe_bitmap_rich * txtr, uint32_t txtr_x, uint32_t txtr_y, uint32_t x, uint32_t y);
|
||||
void fe_bitmap_display_pixel(const fe_bitmap * txtr, uint32_t txtr_x, uint32_t txtr_y, uint32_t x, uint32_t y);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Bitmap data
|
||||
# Fxengine::Bitmap
|
||||
This is part of the [fxengine](/Milang/fxengine) project.
|
||||
This file refers to [bitmap.h](/Milang/fxengine/include/fxengine/model/bitmap.h) header.
|
||||
```c
|
||||
#include <fxengine/model/bitmap.h>
|
||||
```
|
||||
|
@ -20,7 +22,37 @@ typedef struct fe_bitmap
|
|||
uint16_t size_o_y;
|
||||
} fe_bitmap;
|
||||
```
|
||||
Here are the most used parameters :
|
||||
- `size_px_x` and `size_px_y` are the bitmap's height and width, in pixels.
|
||||
Here are the most used parameters, the others are used internally by the machine, so they do not need to be initialized.
|
||||
### Size
|
||||
`size_px_x` and `size_px_y` are the bitmap's height and width, in pixels.
|
||||
### Color and layout encoding
|
||||
- `*color` is a pointer to a monochrome bitmap.
|
||||
The format is the following : one bit is on pixel => 1 means black, 0 means white.
|
||||
The format is the following : one bit per pixel: 1 = black, 0 = white.
|
||||
- `*layout` is a pointer to a layout for the previous bitmap.
|
||||
It is one bit per pixel too, and then, 1=visible, 0=invisible.
|
||||
|
||||
## Use
|
||||
### Create
|
||||
It is not recommended to create a bitmap as this :
|
||||
```c
|
||||
fe_bitmap bmp
|
||||
{...};
|
||||
```
|
||||
Please use the function
|
||||
```c
|
||||
fe_bitmap_rich* fe_bitmap_new(
|
||||
uint32_t size_px_x, uint32_t size_px_y, // bitmap size
|
||||
uint32_t* color, bool copy_color, // color table address and type (static | dynamic)
|
||||
uint32_t *layout, bool copy_layout // layout table address and type (static | dynamic)
|
||||
);
|
||||
```
|
||||
The `bool copy_<...>` lets you choose:
|
||||
- if the bitmap header takes data from the pointer you have given.
|
||||
- if the bitmap header needs to copy data itself.
|
||||
|
||||
### Delete
|
||||
The bitmap is dynamically allocated, so it should be deleted by using `free()` method. However, it contains some complex data, which is itself dynamically allocated, so you need to call that method: `fe_bitmap_del()`.
|
||||
The only argument to pass is the bitmap's address.
|
||||
|
||||
### Display
|
||||
Basically, you can display the bitmap with ``
|
Loading…
Reference in New Issue