/* * layer.h - Separate graphics operations by layers and replay * * Written 2016 by Werner Almesberger * Copyright 2016 by Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef LAYER_H #define LAYER_H #include "gfx.h" struct layer_obj; struct layer_objs { unsigned layer; struct layer_obj *obj; struct layer_obj **next_obj; struct layer_objs *next; }; struct layer { const struct gfx_ops *ops; void *user; int xmin, xmax; int ymin, ymax; struct layer_objs *objs; }; void layer_line(void *ctx, int sx, int sy, int ex, int ey, int color, unsigned layer); void layer_rect(void *ctx, int sx, int sy, int ex, int ey, int color, int fill_color, unsigned layer); void layer_poly(void *ctx, int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer); void layer_circ(void *ctx, int x, int y, int r, int color, int fill_color, unsigned layer); void layer_arc(void *ctx, int x, int y, int r, int sa, int ea, int color, int fill_color, unsigned layer); void layer_text(void *ctx, int x, int y, const char *s, unsigned size, enum text_align align, int rot, unsigned color, unsigned layer); void layer_init(struct layer *layer, const struct gfx_ops *ops, void *user); void layer_wipe(struct layer *layer); void layer_replay(const struct layer *layer); void layer_bbox(const struct layer *layer, int *x, int *y, int *w, int *h); void layer_destroy(struct layer *layer); #endif /* !LAYER_H */