1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2014 Google Inc.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
9cb93a386Sopenharmony_ci// DO NOT USE -- FOR INTERNAL TESTING ONLY
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ci#ifndef sk_paint_DEFINED
12cb93a386Sopenharmony_ci#define sk_paint_DEFINED
13cb93a386Sopenharmony_ci
14cb93a386Sopenharmony_ci#include "include/c/sk_types.h"
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_BEGIN_GUARD
17cb93a386Sopenharmony_ci
18cb93a386Sopenharmony_ci/**
19cb93a386Sopenharmony_ci    Create a new paint with default settings:
20cb93a386Sopenharmony_ci        antialias : false
21cb93a386Sopenharmony_ci        stroke : false
22cb93a386Sopenharmony_ci        stroke width : 0.0f (hairline)
23cb93a386Sopenharmony_ci        stroke miter : 4.0f
24cb93a386Sopenharmony_ci        stroke cap : BUTT_SK_STROKE_CAP
25cb93a386Sopenharmony_ci        stroke join : MITER_SK_STROKE_JOIN
26cb93a386Sopenharmony_ci        color : opaque black
27cb93a386Sopenharmony_ci        shader : NULL
28cb93a386Sopenharmony_ci        maskfilter : NULL
29cb93a386Sopenharmony_ci        xfermode_mode : SRCOVER_SK_XFERMODE_MODE
30cb93a386Sopenharmony_ci*/
31cb93a386Sopenharmony_ciSK_API sk_paint_t* sk_paint_new(void);
32cb93a386Sopenharmony_ci/**
33cb93a386Sopenharmony_ci    Release the memory storing the sk_paint_t and unref() all
34cb93a386Sopenharmony_ci    associated objects.
35cb93a386Sopenharmony_ci*/
36cb93a386Sopenharmony_ciSK_API void sk_paint_delete(sk_paint_t*);
37cb93a386Sopenharmony_ci
38cb93a386Sopenharmony_ci/**
39cb93a386Sopenharmony_ci    Return true iff the paint has antialiasing enabled.
40cb93a386Sopenharmony_ci*/
41cb93a386Sopenharmony_ciSK_API bool sk_paint_is_antialias(const sk_paint_t*);
42cb93a386Sopenharmony_ci/**
43cb93a386Sopenharmony_ci    Set to true to enable antialiasing, false to disable it on this
44cb93a386Sopenharmony_ci    sk_paint_t.
45cb93a386Sopenharmony_ci*/
46cb93a386Sopenharmony_ciSK_API void sk_paint_set_antialias(sk_paint_t*, bool);
47cb93a386Sopenharmony_ci
48cb93a386Sopenharmony_ci/**
49cb93a386Sopenharmony_ci    Return the paint's curent drawing color.
50cb93a386Sopenharmony_ci*/
51cb93a386Sopenharmony_ciSK_API sk_color_t sk_paint_get_color(const sk_paint_t*);
52cb93a386Sopenharmony_ci/**
53cb93a386Sopenharmony_ci    Set the paint's curent drawing color.
54cb93a386Sopenharmony_ci*/
55cb93a386Sopenharmony_ciSK_API void sk_paint_set_color(sk_paint_t*, sk_color_t);
56cb93a386Sopenharmony_ci
57cb93a386Sopenharmony_ci/* stroke settings */
58cb93a386Sopenharmony_ci
59cb93a386Sopenharmony_ci/**
60cb93a386Sopenharmony_ci    Return true iff stroking is enabled rather than filling on this
61cb93a386Sopenharmony_ci    sk_paint_t.
62cb93a386Sopenharmony_ci*/
63cb93a386Sopenharmony_ciSK_API bool sk_paint_is_stroke(const sk_paint_t*);
64cb93a386Sopenharmony_ci/**
65cb93a386Sopenharmony_ci    Set to true to enable stroking rather than filling with this
66cb93a386Sopenharmony_ci    sk_paint_t.
67cb93a386Sopenharmony_ci*/
68cb93a386Sopenharmony_ciSK_API void sk_paint_set_stroke(sk_paint_t*, bool);
69cb93a386Sopenharmony_ci
70cb93a386Sopenharmony_ci/**
71cb93a386Sopenharmony_ci    Return the width for stroking.  A value of 0 strokes in hairline mode.
72cb93a386Sopenharmony_ci */
73cb93a386Sopenharmony_ciSK_API float sk_paint_get_stroke_width(const sk_paint_t*);
74cb93a386Sopenharmony_ci/**
75cb93a386Sopenharmony_ci   Set the width for stroking.  A value of 0 strokes in hairline mode
76cb93a386Sopenharmony_ci   (always draw 1-pixel wide, regardless of the matrix).
77cb93a386Sopenharmony_ci */
78cb93a386Sopenharmony_ciSK_API void sk_paint_set_stroke_width(sk_paint_t*, float width);
79cb93a386Sopenharmony_ci
80cb93a386Sopenharmony_ci/**
81cb93a386Sopenharmony_ci    Return the paint's stroke miter value. This is used to control the
82cb93a386Sopenharmony_ci    behavior of miter joins when the joins angle is sharp.
83cb93a386Sopenharmony_ci*/
84cb93a386Sopenharmony_ciSK_API float sk_paint_get_stroke_miter(const sk_paint_t*);
85cb93a386Sopenharmony_ci/**
86cb93a386Sopenharmony_ci   Set the paint's stroke miter value. This is used to control the
87cb93a386Sopenharmony_ci   behavior of miter joins when the joins angle is sharp. This value
88cb93a386Sopenharmony_ci   must be >= 0.
89cb93a386Sopenharmony_ci*/
90cb93a386Sopenharmony_ciSK_API void sk_paint_set_stroke_miter(sk_paint_t*, float miter);
91cb93a386Sopenharmony_ci
92cb93a386Sopenharmony_citypedef enum {
93cb93a386Sopenharmony_ci    BUTT_SK_STROKE_CAP,
94cb93a386Sopenharmony_ci    ROUND_SK_STROKE_CAP,
95cb93a386Sopenharmony_ci    SQUARE_SK_STROKE_CAP
96cb93a386Sopenharmony_ci} sk_stroke_cap_t;
97cb93a386Sopenharmony_ci
98cb93a386Sopenharmony_ci/**
99cb93a386Sopenharmony_ci    Return the paint's stroke cap type, controlling how the start and
100cb93a386Sopenharmony_ci    end of stroked lines and paths are treated.
101cb93a386Sopenharmony_ci*/
102cb93a386Sopenharmony_ciSK_API sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t*);
103cb93a386Sopenharmony_ci/**
104cb93a386Sopenharmony_ci    Set the paint's stroke cap type, controlling how the start and
105cb93a386Sopenharmony_ci    end of stroked lines and paths are treated.
106cb93a386Sopenharmony_ci*/
107cb93a386Sopenharmony_ciSK_API void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t);
108cb93a386Sopenharmony_ci
109cb93a386Sopenharmony_citypedef enum {
110cb93a386Sopenharmony_ci    MITER_SK_STROKE_JOIN,
111cb93a386Sopenharmony_ci    ROUND_SK_STROKE_JOIN,
112cb93a386Sopenharmony_ci    BEVEL_SK_STROKE_JOIN
113cb93a386Sopenharmony_ci} sk_stroke_join_t;
114cb93a386Sopenharmony_ci
115cb93a386Sopenharmony_ci/**
116cb93a386Sopenharmony_ci    Return the paint's stroke join type, specifies the treatment that
117cb93a386Sopenharmony_ci    is applied to corners in paths and rectangles
118cb93a386Sopenharmony_ci */
119cb93a386Sopenharmony_ciSK_API sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t*);
120cb93a386Sopenharmony_ci/**
121cb93a386Sopenharmony_ci    Set the paint's stroke join type, specifies the treatment that
122cb93a386Sopenharmony_ci    is applied to corners in paths and rectangles
123cb93a386Sopenharmony_ci */
124cb93a386Sopenharmony_ciSK_API void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t);
125cb93a386Sopenharmony_ci
126cb93a386Sopenharmony_ci/**
127cb93a386Sopenharmony_ci *  Set the paint's shader to the specified parameter. This will automatically call unref() on
128cb93a386Sopenharmony_ci *  any previous value, and call ref() on the new value.
129cb93a386Sopenharmony_ci */
130cb93a386Sopenharmony_ciSK_API void sk_paint_set_shader(sk_paint_t*, sk_shader_t*);
131cb93a386Sopenharmony_ci
132cb93a386Sopenharmony_ci/**
133cb93a386Sopenharmony_ci *  Set the paint's maskfilter to the specified parameter. This will automatically call unref() on
134cb93a386Sopenharmony_ci *  any previous value, and call ref() on the new value.
135cb93a386Sopenharmony_ci */
136cb93a386Sopenharmony_ciSK_API void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*);
137cb93a386Sopenharmony_ci
138cb93a386Sopenharmony_ci/**
139cb93a386Sopenharmony_ci *  Set the paint's xfermode to the specified parameter.
140cb93a386Sopenharmony_ci */
141cb93a386Sopenharmony_ciSK_API void sk_paint_set_xfermode_mode(sk_paint_t*, sk_xfermode_mode_t);
142cb93a386Sopenharmony_ci
143cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_END_GUARD
144cb93a386Sopenharmony_ci
145cb93a386Sopenharmony_ci#endif
146