summaryrefslogtreecommitdiffstats
path: root/libass/ass_outline.h
diff options
context:
space:
mode:
Diffstat (limited to 'libass/ass_outline.h')
-rw-r--r--libass/ass_outline.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/libass/ass_outline.h b/libass/ass_outline.h
index 7e71b8a..4ee21d1 100644
--- a/libass/ass_outline.h
+++ b/libass/ass_outline.h
@@ -37,20 +37,41 @@ typedef struct {
int32_t x_min, y_min, x_max, y_max;
} ASS_Rect;
-typedef struct ass_outline {
- size_t n_contours, max_contours;
- size_t *contours;
+/*
+ * Outline represented with array of points and array of segments.
+ * Segment here is spline of order 1 (line), 2 (quadratic) or 3 (cubic).
+ * Each segment owns number of points equal to its order in point array
+ * and uses first point owned by the next segment as last point.
+ * Last segment in each contour instead of the next segment point uses
+ * point owned by the first segment in that contour. Correspondingly
+ * total number of points is equal to the sum of spline orders of all segments.
+ */
+
+enum {
+ OUTLINE_LINE_SEGMENT = 1, // line segment
+ OUTLINE_QUADRATIC_SPLINE = 2, // quadratic spline
+ OUTLINE_CUBIC_SPLINE = 3, // cubic spline
+ OUTLINE_COUNT_MASK = 3, // spline order mask
+ OUTLINE_CONTOUR_END = 4 // last segment in contour flag
+};
+
+typedef struct {
size_t n_points, max_points;
+ size_t n_segments, max_segments;
ASS_Vector *points;
- char *tags;
+ char *segments;
} ASS_Outline;
-bool outline_alloc(ASS_Outline *outline, size_t n_points, size_t n_contours);
+#define OUTLINE_MIN (-((int32_t) 1 << 28))
+#define OUTLINE_MAX (((int32_t) 1 << 28) - 1)
+
+bool outline_alloc(ASS_Outline *outline, size_t n_points, size_t n_segments);
bool outline_convert(ASS_Outline *outline, const FT_Outline *source);
bool outline_copy(ASS_Outline *outline, const ASS_Outline *source);
void outline_free(ASS_Outline *outline);
-bool outline_add_point(ASS_Outline *outline, ASS_Vector pt, char tag);
+bool outline_add_point(ASS_Outline *outline, ASS_Vector pt, char segment);
+bool outline_add_segment(ASS_Outline *outline, char segment);
bool outline_close_contour(ASS_Outline *outline);
void outline_translate(const ASS_Outline *outline, int32_t dx, int32_t dy);