Root/
| 1 | /* |
| 2 | * gfx/record.h - Record graphics operations by layers and replay |
| 3 | * |
| 4 | * Written 2016 by Werner Almesberger |
| 5 | * Copyright 2016 by Werner Almesberger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | #ifndef GFX_RECORD_H |
| 15 | #define GFX_RECORD_H |
| 16 | |
| 17 | #include "gfx/gfx.h" |
| 18 | |
| 19 | |
| 20 | struct record_obj; |
| 21 | |
| 22 | struct record_layer { |
| 23 | unsigned layer; |
| 24 | struct record_obj *objs; |
| 25 | struct record_obj **next_obj; |
| 26 | struct record_layer *next; |
| 27 | }; |
| 28 | |
| 29 | struct record { |
| 30 | const struct gfx_ops *ops; |
| 31 | void *user; |
| 32 | int xmin, xmax; |
| 33 | int ymin, ymax; |
| 34 | struct record_layer *layers; |
| 35 | }; |
| 36 | |
| 37 | |
| 38 | void record_line(void *ctx, int sx, int sy, int ex, int ey, |
| 39 | int color, unsigned layer); |
| 40 | void record_rect(void *ctx, int sx, int sy, int ex, int ey, |
| 41 | int color, int fill_color, unsigned layer); |
| 42 | void record_poly(void *ctx, |
| 43 | int points, const int x[points], const int y[points], |
| 44 | int color, int fill_color, unsigned layer); |
| 45 | void record_circ(void *ctx, int x, int y, int r, |
| 46 | int color, int fill_color, unsigned layer); |
| 47 | void record_arc(void *ctx, int x, int y, int r, int sa, int ea, |
| 48 | int color, int fill_color, unsigned layer); |
| 49 | void record_text(void *ctx, int x, int y, const char *s, unsigned size, |
| 50 | enum text_align align, int rot, unsigned color, unsigned layer); |
| 51 | |
| 52 | void record_init(struct record *rec, const struct gfx_ops *ops, void *user); |
| 53 | void record_wipe(struct record *rec); |
| 54 | void record_replay(const struct record *rec); |
| 55 | void record_bbox(const struct record *rec, int *x, int *y, int *w, int *h); |
| 56 | void record_destroy(struct record *rec); |
| 57 | |
| 58 | #endif /* !GFX_RECORD_H */ |
| 59 |
Branches:
master
