have cairo fill in lines idk
This commit is contained in:
parent
be2eb6483c
commit
8cbde42de3
2 changed files with 16 additions and 13 deletions
|
|
@ -66,7 +66,10 @@ struct _MwLLWayland {
|
|||
struct wl_shm* shm;
|
||||
struct wl_registry_listener registry_listener;
|
||||
|
||||
int mapped_buffer_size;
|
||||
|
||||
cairo_surface_t* cairo_surface;
|
||||
// cairo_t* cairo;
|
||||
|
||||
MwU8* mapped_buffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <Mw/Milsko.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <cairo/cairo.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
|
|
@ -433,24 +434,26 @@ static void MwLLSetWHImpl(MwLL handle, int w, int h) {
|
|||
buffer_setup(&handle->wayland);
|
||||
}
|
||||
}
|
||||
|
||||
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
||||
int i;
|
||||
|
||||
cairo_t* cairo = cairo_create(handle->wayland.cairo_surface);
|
||||
cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_line_width(cairo, 1);
|
||||
cairo_set_source_rgb(cairo, color->common.red / 255., color->common.green / 255., color->common.blue / 255.);
|
||||
cairo_paint(cairo);
|
||||
cairo_set_line_width(cairo, 1);
|
||||
cairo_set_fill_rule(cairo, CAIRO_FILL_RULE_EVEN_ODD);
|
||||
|
||||
for(i = 0; i < points_count - 1; i++) {
|
||||
MwPoint p1 = points[i];
|
||||
MwPoint p2 = points[i + 1];
|
||||
|
||||
cairo_move_to(cairo, p1.x, p1.y);
|
||||
cairo_line_to(cairo, p2.x, p2.y);
|
||||
cairo_new_path(cairo);
|
||||
for(i = 0; i < points_count + 1; i++) {
|
||||
cairo_line_to(cairo, points[i].x, points[i].y);
|
||||
}
|
||||
if(points[0].x != points[i].x && points[0].y != points[i].y) {
|
||||
cairo_line_to(cairo, points[0].x, points[0].y);
|
||||
}
|
||||
cairo_close_path(cairo);
|
||||
|
||||
cairo_stroke_preserve(cairo);
|
||||
cairo_fill(cairo);
|
||||
// cairo_paint(cairo);
|
||||
cairo_destroy(cairo);
|
||||
}
|
||||
|
||||
|
|
@ -491,9 +494,6 @@ static void MwLLFreeColorImpl(MwLLColor color) {
|
|||
free(color);
|
||||
}
|
||||
|
||||
static void MwLLSetBackgroundImpl(MwLL handle, MwLLColor color) {
|
||||
}
|
||||
|
||||
static int MwLLPendingImpl(MwLL handle) {
|
||||
enum {
|
||||
DISPLAY_FD,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue