MyScript Interactive Ink SDK 4.4.2
Style.h
1// Copyright @ MyScript. All rights reserved.
2
3#pragma once
4
5#include <iink/String.h>
6#include <iink/graphics/Color.h>
7#include <iink/graphics/ICanvas.h>
8#include <iink/graphics/LineCap.h>
9#include <iink/graphics/LineJoin.h>
10#include <iink/graphics/FillRule.h>
11#include <iink/graphics/StyleFlag.h>
12
13#include <vector>
14
15namespace myscript {
16namespace iink {
17namespace graphics {
18
22class Style
23{
24protected:
26 float strokeWidth = 1.f;
29 float strokeMiterLimit = 0.5f;
30 std::vector<float> strokeDashArray {};
31 float strokeDashOffset = 0.f;
34
35 String fontFamily = "sans-serif";
36 float fontLineHeight = 1.2f;
37 float fontSize = 10.0f;
38 String fontStyle = "normal";
39 String fontVariant = "normal";
40 int fontWeight = 400;
41
42 float dropShadowXOffset = 0.5f;
43 float dropShadowYOffset = 0.5f;
44 float dropShadowRadius = 2.f;
46
47 std::underlying_type<StyleFlag>::type changeFlags = StyleFlag::StyleFlag_NONE;
48
49public:
50
54 Style() =default;
55
59 IINK_API void clear() noexcept;
60
66 IINK_API void setStrokeColor(Color strokeColor) noexcept;
67
73 IINK_API Color getStrokeColor() const noexcept;
74
80 IINK_API void setStrokeWidth(float strokeWidth) noexcept;
81
87 IINK_API float getStrokeWidth() const noexcept;
88
94 IINK_API void setStrokeLineCap(LineCap strokeLineCap) noexcept;
95
101 IINK_API LineCap getStrokeLineCap() const noexcept;
102
109
115 IINK_API LineJoin getStrokeLineJoin() const noexcept;
116
122 IINK_API void setStrokeMiterLimit(float strokeMiterLimit) noexcept;
123
129 IINK_API float getStrokeMiterLimit() const noexcept;
130
136 IINK_API void setStrokeDashArray(const std::vector<float>& strokeDashArray) noexcept;
137
143 IINK_API std::vector<float> getStrokeDashArray() const noexcept;
144
150 IINK_API void setStrokeDashOffset(float strokeDashOffset) noexcept;
151
157 IINK_API float getStrokeDashOffset() const noexcept;
158
164 IINK_API void setFillColor(Color fillColor) noexcept;
165
171 IINK_API Color getFillColor() const noexcept;
172
178 IINK_API void setFillRule(FillRule fillRule) noexcept;
179
185 IINK_API FillRule getFillRule() const noexcept;
186
192 IINK_API void setFontFamily(const String& fontFamily) noexcept;
193
199 IINK_API String getFontFamily() const noexcept;
200
206 IINK_API void setFontLineHeight(float fontLineHeight) noexcept;
207
213 IINK_API float getFontLineHeight() const noexcept;
214
220 IINK_API void setFontSize(float fontSize) noexcept;
221
227 IINK_API float getFontSize() const noexcept;
228
234 IINK_API void setFontStyle(const String& fontStyle) noexcept;
235
241 IINK_API String getFontStyle() const noexcept;
242
248 IINK_API void setFontVariant(const String& fontVariant) noexcept;
249
255 IINK_API String getFontVariant() const noexcept;
256
262 IINK_API void setFontWeight(int fontWeight) noexcept;
263
269 IINK_API int getFontWeight() const noexcept;
270
276 IINK_API void setDropShadowXOffset(float dropShadowXOffset) noexcept;
277
283 IINK_API float getDropShadowXOffset() const noexcept;
284
290 IINK_API void setDropShadowYOffset(float dropShadowYOffset) noexcept;
291
297 IINK_API float getDropShadowYOffset() const noexcept;
298
304 IINK_API void setDropShadowRadius(float dropShadowRadius) noexcept;
305
311 IINK_API float getDropShadowRadius() const noexcept;
312
318 IINK_API void setDropShadowColor(Color dropShadowColor) noexcept;
319
325 IINK_API Color getDropShadowColor() const noexcept;
326
333 IINK_API std::underlying_type<StyleFlag>::type getChangeFlags() noexcept;
334
340 IINK_API void setChangeFlags(std::underlying_type<StyleFlag>::type flags) noexcept;
341
345 IINK_API void clearChangeFlags() noexcept;
346
353 IINK_API void applyTo(ICanvas& canvas) noexcept;
354
362 IINK_API bool operator==(const Style& other) const noexcept;
363
371 IINK_API bool operator!=(const Style& other) const noexcept;
372};
373
374}
375}
376}
Definition: String.h:17
Definition: ICanvas.h:26
Definition: Style.h:23
void setStrokeColor(Color strokeColor) noexcept
float getFontLineHeight() const noexcept
String fontVariant
Definition: Style.h:39
Color fillColor
Definition: Style.h:32
void setChangeFlags(std::underlying_type< StyleFlag >::type flags) noexcept
void setStrokeLineJoin(LineJoin strokeLineJoin) noexcept
float strokeWidth
Definition: Style.h:26
float getFontSize() const noexcept
void setFillRule(FillRule fillRule) noexcept
float dropShadowXOffset
Definition: Style.h:42
std::underlying_type< StyleFlag >::type changeFlags
Definition: Style.h:47
String getFontFamily() const noexcept
String getFontStyle() const noexcept
String getFontVariant() const noexcept
float getStrokeDashOffset() const noexcept
LineJoin strokeLineJoin
Definition: Style.h:28
float getDropShadowRadius() const noexcept
String fontStyle
Definition: Style.h:38
void setStrokeLineCap(LineCap strokeLineCap) noexcept
float dropShadowRadius
Definition: Style.h:44
void setFontLineHeight(float fontLineHeight) noexcept
void setStrokeWidth(float strokeWidth) noexcept
int getFontWeight() const noexcept
float getDropShadowYOffset() const noexcept
Color getFillColor() const noexcept
FillRule fillRule
Definition: Style.h:33
float fontLineHeight
Definition: Style.h:36
void setDropShadowRadius(float dropShadowRadius) noexcept
int fontWeight
Definition: Style.h:40
void setFontVariant(const String &fontVariant) noexcept
std::underlying_type< StyleFlag >::type getChangeFlags() noexcept
LineJoin getStrokeLineJoin() const noexcept
LineCap strokeLineCap
Definition: Style.h:27
std::vector< float > strokeDashArray
Definition: Style.h:30
float strokeDashOffset
Definition: Style.h:31
Color dropShadowColor
Definition: Style.h:45
void setStrokeMiterLimit(float strokeMiterLimit) noexcept
float fontSize
Definition: Style.h:37
Color getDropShadowColor() const noexcept
float getStrokeMiterLimit() const noexcept
std::vector< float > getStrokeDashArray() const noexcept
void setFontFamily(const String &fontFamily) noexcept
void setStrokeDashOffset(float strokeDashOffset) noexcept
void setDropShadowColor(Color dropShadowColor) noexcept
FillRule getFillRule() const noexcept
float getDropShadowXOffset() const noexcept
String fontFamily
Definition: Style.h:35
LineCap getStrokeLineCap() const noexcept
void setFontStyle(const String &fontStyle) noexcept
void setStrokeDashArray(const std::vector< float > &strokeDashArray) noexcept
float strokeMiterLimit
Definition: Style.h:29
float getStrokeWidth() const noexcept
void applyTo(ICanvas &canvas) noexcept
void setDropShadowXOffset(float dropShadowXOffset) noexcept
void setFontSize(float fontSize) noexcept
void setFontWeight(int fontWeight) noexcept
Color strokeColor
Definition: Style.h:25
float dropShadowYOffset
Definition: Style.h:43
void setDropShadowYOffset(float dropShadowYOffset) noexcept
Color getStrokeColor() const noexcept
void setFillColor(Color fillColor) noexcept
FillRule
Definition: FillRule.h:13
LineJoin
Definition: LineJoin.h:13
StyleFlag
Definition: StyleFlag.h:13
LineCap
Definition: LineCap.h:13
Definition: Configuration.h:10
Definition: Color.h:19
static const Color BLACK
Definition: Color.h:21
static const Color NONE
Definition: Color.h:20