Drop all path api

This commit is contained in:
Matthias Clasen
2023-07-18 21:14:22 -04:00
parent 56b17715f1
commit e8ef875a7b
9 changed files with 54 additions and 139 deletions

View File

@@ -20,10 +20,6 @@
#define __GSK_H_INSIDE__
#include <gsk/gskenums.h>
#include <gsk/gskpath.h>
#include <gsk/gskpathbuilder.h>
#include <gsk/gskpathmeasure.h>
#include <gsk/gskpathpoint.h>
#include <gsk/gskrenderer.h>
#include <gsk/gskrendernode.h>
#include <gsk/gskroundedrect.h>

View File

@@ -24,7 +24,7 @@
#include "gskcurveprivate.h"
#include "gskpathbuilder.h"
/**
/*< private >
* GskPath:
*
* A `GskPath` describes lines and curves that are more complex
@@ -96,7 +96,7 @@ gsk_path_new_from_contours (const GSList *contours)
return path;
}
/**
/*< private >
* gsk_path_ref:
* @self: a `GskPath`
*
@@ -114,7 +114,7 @@ gsk_path_ref (GskPath *self)
return self;
}
/**
/*< private >
* gsk_path_unref:
* @self: a `GskPath`
*
@@ -148,7 +148,7 @@ gsk_path_get_flags (GskPath *self)
return self->flags;
}
/**
/*< private >
* gsk_path_print:
* @self: a `GskPath`
* @string: The string to print into
@@ -179,7 +179,7 @@ gsk_path_print (GskPath *self,
}
}
/**
/*< private >
* gsk_path_to_string:
* @self: a `GskPath`
*
@@ -252,7 +252,7 @@ gsk_path_to_cairo_add_op (GskPathOperation op,
return TRUE;
}
/**
/*< private >
* gsk_path_to_cairo:
* @self: a `GskPath`
* @cr: a cairo context
@@ -294,7 +294,7 @@ gsk_path_get_n_contours (GskPath *path)
return path->n_contours;
}
/**
/*< private >
* gsk_path_is_empty:
* @self: a `GskPath`
*
@@ -310,7 +310,7 @@ gsk_path_is_empty (GskPath *self)
return self->n_contours == 0;
}
/**
/*< private >
* gsk_path_get_bounds:
* @self: a `GskPath`
* @bounds: (out caller-allocates): the bounds of the given path
@@ -365,7 +365,7 @@ gsk_path_get_bounds (GskPath *self,
return TRUE;
}
/**
/*< private >
* gsk_path_foreach:
* @self: a `GskPath`
* @flags: flags to pass to the foreach function. See [enum@Gsk.PathForeachFlags]
@@ -763,7 +763,7 @@ parse_circle (const char **p,
return FALSE;
}
/**
/*< private >
* gsk_path_parse:
* @string: a string
*

View File

@@ -75,35 +75,19 @@ typedef gboolean (* GskPathForeachFunc) (GskPathOperation op,
#define GSK_TYPE_PATH (gsk_path_get_type ())
GDK_AVAILABLE_IN_ALL
GType gsk_path_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskPath * gsk_path_ref (GskPath *self);
GDK_AVAILABLE_IN_ALL
void gsk_path_unref (GskPath *self);
GDK_AVAILABLE_IN_ALL
void gsk_path_print (GskPath *self,
GString *string);
GDK_AVAILABLE_IN_ALL
char * gsk_path_to_string (GskPath *self);
GDK_AVAILABLE_IN_ALL
GskPath * gsk_path_parse (const char *string);
GDK_AVAILABLE_IN_ALL
void gsk_path_to_cairo (GskPath *self,
cairo_t *cr);
GDK_AVAILABLE_IN_ALL
gboolean gsk_path_is_empty (GskPath *self);
GDK_AVAILABLE_IN_ALL
gboolean gsk_path_get_bounds (GskPath *self,
graphene_rect_t *bounds);
GDK_AVAILABLE_IN_ALL
gboolean gsk_path_foreach (GskPath *self,
GskPathForeachFlags flags,
GskPathForeachFunc func,

View File

@@ -25,7 +25,7 @@
#include "gskpathprivate.h"
/**
/*< private >
* GskPathBuilder:
*
* A `GskPathBuilder` struct is an opaque struct. It is meant to
@@ -82,7 +82,7 @@ G_DEFINE_BOXED_TYPE (GskPathBuilder,
gsk_path_builder_unref)
/**
/*< private >
* gsk_path_builder_new:
*
* Create a new `GskPathBuilder` object.
@@ -109,7 +109,7 @@ gsk_path_builder_new (void)
return self;
}
/**
/*< private >
* gsk_path_builder_ref:
* @self: a `GskPathBuilder`
*
@@ -201,7 +201,7 @@ gsk_path_builder_clear (GskPathBuilder *self)
self->contours = NULL;
}
/**
/*< private >
* gsk_path_builder_unref:
* @self: a `GskPathBuilder`
*
@@ -224,7 +224,7 @@ gsk_path_builder_unref (GskPathBuilder *self)
g_slice_free (GskPathBuilder, self);
}
/**
/*< private >
* gsk_path_builder_free_to_path: (skip)
* @self: a `GskPathBuilder`
*
@@ -248,7 +248,7 @@ gsk_path_builder_free_to_path (GskPathBuilder *self)
return res;
}
/**
/*< private >
* gsk_path_builder_to_path:
* @self: a `GskPathBuilder`
*
@@ -291,7 +291,7 @@ gsk_path_builder_add_contour (GskPathBuilder *self,
self->contours = g_slist_prepend (self->contours, contour);
}
/**
/*< private >
* gsk_path_builder_get_current_point:
* @self: a `GskPathBuilder`
*
@@ -310,7 +310,7 @@ gsk_path_builder_get_current_point (GskPathBuilder *self)
return &self->current_point;
}
/**
/*< private >
* gsk_path_builder_add_path:
* @self: a `GskPathBuilder`
* @path: (transfer none): the path to append
@@ -332,7 +332,7 @@ gsk_path_builder_add_path (GskPathBuilder *self,
}
}
/**
/*< private >
* gsk_path_builder_add_reverse_path:
* @self: a `GskPathBuilder`
* @path: (transfer none): the path to append
@@ -355,7 +355,7 @@ gsk_path_builder_add_reverse_path (GskPathBuilder *self,
}
}
/**
/*< private >
* gsk_path_builder_add_cairo_path:
* @self: a `GskPathBuilder`
*
@@ -403,7 +403,7 @@ gsk_path_builder_add_cairo_path (GskPathBuilder *self,
}
}
/**
/*< private >
* gsk_path_builder_add_rect:
* @self: A `GskPathBuilder`
* @rect: The rectangle to create a path for
@@ -430,7 +430,7 @@ gsk_path_builder_add_rect (GskPathBuilder *self,
gsk_contour_get_start_end (contour, NULL, &self->current_point);
}
/**
/*< private >
* gsk_path_builder_add_rounded_rect:
* @self: a #GskPathBuilder
* @rect: the rounded rect
@@ -450,7 +450,7 @@ gsk_path_builder_add_rounded_rect (GskPathBuilder *self,
gsk_path_builder_add_contour (self, contour);
}
/**
/*< private >
* gsk_path_builder_add_circle:
* @self: a `GskPathBuilder`
* @center: the center of the circle
@@ -473,7 +473,7 @@ gsk_path_builder_add_circle (GskPathBuilder *self,
gsk_path_builder_add_contour (self, contour);
}
/**
/*< private >
* gsk_path_builder_add_ellipse:
* @self: a #GskPathBuilder
* @center: the center point of the ellipse
@@ -519,7 +519,7 @@ gsk_path_builder_add_ellipse (GskPathBuilder *self,
gsk_path_builder_close (self);
}
/**
/*< private >
* gsk_path_builder_move_to:
* @self: a `GskPathBuilder`
* @x: x coordinate
@@ -545,7 +545,7 @@ gsk_path_builder_move_to (GskPathBuilder *self,
gsk_path_builder_ensure_current (self);
}
/**
/*< private >
* gsk_path_builder_rel_move_to:
* @self: a `GskPathBuilder`
* @x: x offset
@@ -568,7 +568,7 @@ gsk_path_builder_rel_move_to (GskPathBuilder *self,
self->current_point.y + y);
}
/**
/*< private >
* gsk_path_builder_line_to:
* @self: a `GskPathBuilder`
* @x: x coordinate
@@ -596,7 +596,7 @@ gsk_path_builder_line_to (GskPathBuilder *self,
});
}
/**
/*< private >
* gsk_path_builder_rel_line_to:
* @self: a `GskPathBuilder`
* @x: x offset
@@ -619,7 +619,7 @@ gsk_path_builder_rel_line_to (GskPathBuilder *self,
self->current_point.y + y);
}
/**
/*< private >
* gsk_path_builder_quad_to:
* @self: a #GskPathBuilder
* @x1: x coordinate of control point
@@ -650,7 +650,7 @@ gsk_path_builder_quad_to (GskPathBuilder *self,
});
}
/**
/*< private >
* gsk_path_builder_rel_quad_to:
* @self: a `GskPathBuilder`
* @x1: x offset of control point
@@ -681,7 +681,7 @@ gsk_path_builder_rel_quad_to (GskPathBuilder *self,
self->current_point.y + y2);
}
/**
/*< private >
* gsk_path_builder_cubic_to:
* @self: a `GskPathBuilder`
* @x1: x coordinate of first control point
@@ -718,7 +718,7 @@ gsk_path_builder_cubic_to (GskPathBuilder *self,
});
}
/**
/*< private >
* gsk_path_builder_rel_cubic_to:
* @self: a `GskPathBuilder`
* @x1: x offset of first control point
@@ -754,7 +754,7 @@ gsk_path_builder_rel_cubic_to (GskPathBuilder *self,
self->current_point.y + y3);
}
/**
/*< private >
* gsk_path_builder_conic_to:
* @self: a `GskPathBuilder`
* @x1: x coordinate of control point
@@ -792,7 +792,7 @@ gsk_path_builder_conic_to (GskPathBuilder *self,
});
}
/**
/*< private >
* gsk_path_builder_rel_conic_to:
* @self: a `GskPathBuilder`
* @x1: x offset of control point
@@ -826,7 +826,7 @@ gsk_path_builder_rel_conic_to (GskPathBuilder *self,
weight);
}
/**
/*< private >
* gsk_path_builder_close:
* @self: a `GskPathBuilder`
*
@@ -1032,7 +1032,7 @@ gsk_path_builder_svg_arc_to (GskPathBuilder *self,
}
}
/**
/*< private >
* gsk_path_builder_add_layout:
* @self: a #GskPathBuilder
* @layout: the pango layout to add

View File

@@ -31,85 +31,60 @@ G_BEGIN_DECLS
#define GSK_TYPE_PATH_BUILDER (gsk_path_builder_get_type ())
GDK_AVAILABLE_IN_ALL
GType gsk_path_builder_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskPathBuilder * gsk_path_builder_new (void);
GDK_AVAILABLE_IN_ALL
GskPathBuilder * gsk_path_builder_ref (GskPathBuilder *self);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_unref (GskPathBuilder *self);
GDK_AVAILABLE_IN_ALL
GskPath * gsk_path_builder_free_to_path (GskPathBuilder *self) G_GNUC_WARN_UNUSED_RESULT;
GDK_AVAILABLE_IN_ALL
GskPath * gsk_path_builder_to_path (GskPathBuilder *self) G_GNUC_WARN_UNUSED_RESULT;
GDK_AVAILABLE_IN_ALL
const graphene_point_t *gsk_path_builder_get_current_point (GskPathBuilder *self);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_path (GskPathBuilder *self,
GskPath *path);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_reverse_path (GskPathBuilder *self,
GskPath *path);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_cairo_path (GskPathBuilder *self,
const cairo_path_t *path);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_layout (GskPathBuilder *self,
PangoLayout *layout);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_rect (GskPathBuilder *self,
const graphene_rect_t *rect);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_rounded_rect (GskPathBuilder *self,
const GskRoundedRect *rect);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_circle (GskPathBuilder *self,
const graphene_point_t *center,
float radius);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_ellipse (GskPathBuilder *self,
const graphene_point_t *center,
const graphene_size_t *radius);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_add_segment (GskPathBuilder *self,
GskPathMeasure *measure,
float start,
float end);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_move_to (GskPathBuilder *self,
float x,
float y);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_rel_move_to (GskPathBuilder *self,
float x,
float y);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_line_to (GskPathBuilder *self,
float x,
float y);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_rel_line_to (GskPathBuilder *self,
float x,
float y);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_quad_to (GskPathBuilder *self,
float x1,
float y1,
float x2,
float y2);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_rel_quad_to (GskPathBuilder *self,
float x1,
float y1,
float x2,
float y2);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_cubic_to (GskPathBuilder *self,
float x1,
float y1,
@@ -117,7 +92,6 @@ void gsk_path_builder_cubic_to (GskPathBuilder
float y2,
float x3,
float y3);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_rel_cubic_to (GskPathBuilder *self,
float x1,
float y1,
@@ -125,21 +99,18 @@ void gsk_path_builder_rel_cubic_to (GskPathBuilder
float y2,
float x3,
float y3);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_conic_to (GskPathBuilder *self,
float x1,
float y1,
float x2,
float y2,
float weight);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_rel_conic_to (GskPathBuilder *self,
float x1,
float y1,
float x2,
float y2,
float weight);
GDK_AVAILABLE_IN_ALL
void gsk_path_builder_close (GskPathBuilder *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskPathBuilder, gsk_path_builder_unref)

View File

@@ -25,7 +25,7 @@
#include "gskpathpointprivate.h"
#include "gskpathprivate.h"
/**
/*< private >
* `GskPathMeasure` is an object that allows measurements
* on `GskPath`s such as determining the length of the path.
*
@@ -63,7 +63,7 @@ G_DEFINE_BOXED_TYPE (GskPathMeasure, gsk_path_measure,
gsk_path_measure_ref,
gsk_path_measure_unref)
/**
/*< private >
* gsk_path_measure_new:
* @path: the path to measure
*
@@ -77,7 +77,7 @@ gsk_path_measure_new (GskPath *path)
return gsk_path_measure_new_with_tolerance (path, GSK_PATH_TOLERANCE_DEFAULT);
}
/**
/*< private >
* gsk_path_measure_new_with_tolerance:
* @path: the path to measure
* @tolerance: the tolerance for measuring operations
@@ -116,7 +116,7 @@ gsk_path_measure_new_with_tolerance (GskPath *path,
return self;
}
/**
/*< private >
* gsk_path_measure_ref:
* @self: a `GskPathMeasure`
*
@@ -134,7 +134,7 @@ gsk_path_measure_ref (GskPathMeasure *self)
return self;
}
/**
/*< private >
* gsk_path_measure_unref:
* @self: a `GskPathMeasure`
*
@@ -164,7 +164,7 @@ gsk_path_measure_unref (GskPathMeasure *self)
g_free (self);
}
/**
/*< private >
* gsk_path_measure_get_path:
* @self: a `GskPathMeasure`
*
@@ -178,7 +178,7 @@ gsk_path_measure_get_path (GskPathMeasure *self)
return self->path;
}
/**
/*< private >
* gsk_path_measure_get_tolerance:
* @self: a `GskPathMeasure`
*
@@ -192,7 +192,7 @@ gsk_path_measure_get_tolerance (GskPathMeasure *self)
return self->tolerance;
}
/**
/*< private >
* gsk_path_measure_get_length:
* @self: a `GskPathMeasure`
*
@@ -210,7 +210,7 @@ gsk_path_measure_get_length (GskPathMeasure *self)
return self->length;
}
/**
/*< private >
* gsk_path_measure_is_closed:
* @self: a `GskPathMeasure`
*
@@ -244,7 +244,7 @@ gsk_path_measure_clamp_distance (GskPathMeasure *self,
return CLAMP (distance, 0, self->length);
}
/**
/*< private >
* gsk_path_measure_in_fill:
* @self: a `GskPathMeasure`
* @point: the point to test
@@ -319,7 +319,7 @@ gsk_path_builder_add_segment_chunk (GskPathBuilder *self,
}
}
/**
/*< private >
* gsk_path_builder_add_segment:
* @self: a `GskPathBuilder`
* @measure: the `GskPathMeasure` to take the segment to
@@ -376,7 +376,7 @@ gsk_path_builder_add_segment (GskPathBuilder *self,
}
}
/**
/*< private >
* gsk_path_measure_get_point:
* @self: a `GskPathMeasure`
* @distance: the distance
@@ -425,7 +425,7 @@ gsk_path_measure_get_point (GskPathMeasure *self,
contour_offset, offset);
}
/**
/*< private >
* gsk_path_measure_get_closest_point:
* @self: a `GskPathMeasure`
* @point: the point to fond the closest point to

View File

@@ -31,39 +31,21 @@ G_BEGIN_DECLS
#define GSK_TYPE_PATH_MEASURE (gsk_path_measure_get_type ())
GDK_AVAILABLE_IN_ALL
GType gsk_path_measure_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskPathMeasure * gsk_path_measure_new (GskPath *path);
GDK_AVAILABLE_IN_ALL
GskPathMeasure * gsk_path_measure_new_with_tolerance (GskPath *path,
float tolerance);
GDK_AVAILABLE_IN_ALL
GskPathMeasure * gsk_path_measure_ref (GskPathMeasure *self);
GDK_AVAILABLE_IN_ALL
void gsk_path_measure_unref (GskPathMeasure *self);
GDK_AVAILABLE_IN_ALL
GskPath * gsk_path_measure_get_path (GskPathMeasure *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_path_measure_get_tolerance (GskPathMeasure *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
float gsk_path_measure_get_length (GskPathMeasure *self);
GDK_AVAILABLE_IN_ALL
gboolean gsk_path_measure_is_closed (GskPathMeasure *self);
GDK_AVAILABLE_IN_ALL
gboolean gsk_path_measure_in_fill (GskPathMeasure *self,
const graphene_point_t *point,
GskFillRule fill_rule);
GDK_AVAILABLE_IN_ALL
GskPathPoint * gsk_path_measure_get_point (GskPathMeasure *self,
float distance);
GDK_AVAILABLE_IN_ALL
GskPathPoint * gsk_path_measure_get_closest_point (GskPathMeasure *self,
const graphene_point_t *point,
float threshold);

View File

@@ -11,30 +11,16 @@ G_BEGIN_DECLS
#define GSK_TYPE_PATH_POINT (gsk_path_point_get_type ())
GDK_AVAILABLE_IN_ALL
GType gsk_path_point_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskPathPoint * gsk_path_point_ref (GskPathPoint *self);
GDK_AVAILABLE_IN_ALL
void gsk_path_point_unref (GskPathPoint *self);
GDK_AVAILABLE_IN_ALL
GskPathMeasure * gsk_path_point_get_measure (GskPathPoint *self);
GDK_AVAILABLE_IN_ALL
float gsk_path_point_get_distance (GskPathPoint *self);
GDK_AVAILABLE_IN_ALL
void gsk_path_point_get_position (GskPathPoint *self,
graphene_point_t *position);
GDK_AVAILABLE_IN_ALL
void gsk_path_point_get_tangent (GskPathPoint *self,
GskPathDirection direction,
graphene_vec2_t *tangent);
GDK_AVAILABLE_IN_ALL
float gsk_path_point_get_curvature (GskPathPoint *self,
graphene_point_t *center);

View File

@@ -26,11 +26,6 @@ gsk_public_sources = files([
'gskcairorenderer.c',
'gskdiff.c',
'gskglshader.c',
'gskpath.c',
'gskpathbuilder.c',
'gskpathmeasure.c',
'gskpathops.c',
'gskpathpoint.c',
'gskrenderer.c',
'gskrendernode.c',
'gskrendernodeimpl.c',
@@ -46,6 +41,11 @@ gsk_private_sources = files([
'gskcurve.c',
'gskcurveintersect.c',
'gskdebug.c',
'gskpath.c',
'gskpathbuilder.c',
'gskpathmeasure.c',
'gskpathops.c',
'gskpathpoint.c',
'gskprivate.c',
'gskprofiler.c',
'gskspline.c',
@@ -75,10 +75,6 @@ gsk_public_headers = files([
'gskcairorenderer.h',
'gskenums.h',
'gskglshader.h',
'gskpath.h',
'gskpathbuilder.h',
'gskpathmeasure.h',
'gskpathpoint.h',
'gskrenderer.h',
'gskrendernode.h',
'gskroundedrect.h',