Add initial FnixLib development implementation
This commit is contained in:
commit
84742ae38e
33 files changed
+3340
No files matched your search
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* FnixLib - dibujo 2D por software.
|
||||
*
|
||||
* Todas las funciones dibujan sobre el lienzo de destino (fnix_get_target()).
|
||||
* Sin destino no hacen nada y dejan un error en fnix_last_error().
|
||||
*
|
||||
* Reglas comunes:
|
||||
* - Se recorta al lienzo: dibujar parcial o totalmente fuera es seguro.
|
||||
* - Color con alfa 255 reemplaza el píxel; alfa 0 no dibuja; los valores
|
||||
* intermedios se mezclan con el fondo (alfa "source-over").
|
||||
* - Cada píxel se modifica como máximo una vez por llamada, así que la mezcla
|
||||
* con alfa nunca se aplica dos veces sobre el mismo píxel.
|
||||
* - Coordenadas, anchos, altos y radios deben estar en [-2^28, 2^28]; fuera
|
||||
* de ese rango no se dibuja nada y se registra un error.
|
||||
*/
|
||||
#ifndef FNIX_DRAW2D_H
|
||||
#define FNIX_DRAW2D_H
|
||||
|
||||
#include "fnix/types.h"
|
||||
|
||||
FNIX_BEGIN_DECLS
|
||||
|
||||
/* Rellena todo el lienzo. Ignora el alfa del color (escribe color opaco). */
|
||||
void fnix_clear(FnixColor color);
|
||||
|
||||
void fnix_draw_pixel(int x, int y, FnixColor color);
|
||||
|
||||
/* Línea de 1 píxel de grosor; incluye ambos extremos. */
|
||||
void fnix_draw_line(int x_start, int y_start, int x_end, int y_end,
|
||||
FnixColor color);
|
||||
|
||||
/* Rectángulo con esquina superior izquierda (x, y). width o height <= 0
|
||||
* no dibujan nada. */
|
||||
void fnix_draw_rect(int x, int y, int width, int height, FnixColor color);
|
||||
void fnix_draw_rect_outline(int x, int y, int width, int height,
|
||||
FnixColor color);
|
||||
|
||||
/* Círculo de centro (cx, cy). Un píxel (dx, dy) pertenece al disco si
|
||||
* dx*dx + dy*dy <= radius*radius + radius. radius 0 dibuja un píxel;
|
||||
* radius < 0 no dibuja nada. El contorno es el disco de radio `radius`
|
||||
* menos el de radio `radius - 1` (1 píxel de grosor). */
|
||||
void fnix_draw_circle(int cx, int cy, int radius, FnixColor color);
|
||||
void fnix_draw_circle_outline(int cx, int cy, int radius, FnixColor color);
|
||||
|
||||
FNIX_END_DECLS
|
||||
|
||||
#endif /* FNIX_DRAW2D_H */
|
||||
Reference in new issue
Block a user