Class: Skia::Paint
Instance Attribute Summary
Attributes inherited from Base
#ptr
Instance Method Summary
collapse
Methods inherited from Base
#null?, release_callback, #to_ptr
Constructor Details
#initialize(ptr = nil) ⇒ Paint
5
6
7
|
# File 'lib/skia/paint.rb', line 5
def initialize(ptr = nil)
super(ptr || Native.sk_paint_new, :sk_paint_delete)
end
|
Instance Method Details
#antialias=(value) ⇒ Object
13
14
15
|
# File 'lib/skia/paint.rb', line 13
def antialias=(value)
Native.sk_paint_set_antialias(@ptr, value)
end
|
#antialias? ⇒ Boolean
9
10
11
|
# File 'lib/skia/paint.rb', line 9
def antialias?
Native.sk_paint_is_antialias(@ptr)
end
|
#blend_mode ⇒ Object
66
67
68
|
# File 'lib/skia/paint.rb', line 66
def blend_mode
Native.sk_paint_get_blendmode(@ptr)
end
|
#blend_mode=(value) ⇒ Object
70
71
72
|
# File 'lib/skia/paint.rb', line 70
def blend_mode=(value)
Native.sk_paint_set_blendmode(@ptr, value)
end
|
#clone ⇒ Object
129
130
131
|
# File 'lib/skia/paint.rb', line 129
def clone
self.class.new(Native.sk_paint_clone(@ptr))
end
|
#color ⇒ Object
17
18
19
|
# File 'lib/skia/paint.rb', line 17
def color
Color.new(Native.sk_paint_get_color(@ptr))
end
|
#color=(value) ⇒ Object
21
22
23
24
|
# File 'lib/skia/paint.rb', line 21
def color=(value)
color_value = value.is_a?(Color) ? value.to_i : value
Native.sk_paint_set_color(@ptr, color_value)
end
|
#color_filter ⇒ Object
96
97
98
99
100
101
|
# File 'lib/skia/paint.rb', line 96
def color_filter
ptr = Native.sk_paint_get_colorfilter(@ptr)
return nil if ptr.nil? || ptr.null?
ColorFilter.wrap(ptr)
end
|
#color_filter=(value) ⇒ Object
103
104
105
|
# File 'lib/skia/paint.rb', line 103
def color_filter=(value)
Native.sk_paint_set_colorfilter(@ptr, value&.ptr)
end
|
#image_filter ⇒ Object
107
108
109
110
111
112
|
# File 'lib/skia/paint.rb', line 107
def image_filter
ptr = Native.sk_paint_get_imagefilter(@ptr)
return nil if ptr.nil? || ptr.null?
ImageFilter.wrap(ptr)
end
|
#image_filter=(value) ⇒ Object
114
115
116
|
# File 'lib/skia/paint.rb', line 114
def image_filter=(value)
Native.sk_paint_set_imagefilter(@ptr, value&.ptr)
end
|
#mask_filter ⇒ Object
85
86
87
88
89
90
|
# File 'lib/skia/paint.rb', line 85
def mask_filter
ptr = Native.sk_paint_get_maskfilter(@ptr)
return nil if ptr.nil? || ptr.null?
MaskFilter.wrap(ptr)
end
|
#mask_filter=(value) ⇒ Object
92
93
94
|
# File 'lib/skia/paint.rb', line 92
def mask_filter=(value)
Native.sk_paint_set_maskfilter(@ptr, value&.ptr)
end
|
#path_effect ⇒ Object
118
119
120
121
122
123
|
# File 'lib/skia/paint.rb', line 118
def path_effect
ptr = Native.sk_paint_get_path_effect(@ptr)
return nil if ptr.nil? || ptr.null?
PathEffect.wrap(ptr)
end
|
#path_effect=(value) ⇒ Object
125
126
127
|
# File 'lib/skia/paint.rb', line 125
def path_effect=(value)
Native.sk_paint_set_path_effect(@ptr, value&.ptr)
end
|
#reset ⇒ Object
133
134
135
136
|
# File 'lib/skia/paint.rb', line 133
def reset
Native.sk_paint_reset(@ptr)
self
end
|
#shader ⇒ Object
74
75
76
77
78
79
|
# File 'lib/skia/paint.rb', line 74
def shader
ptr = Native.sk_paint_get_shader(@ptr)
return nil if ptr.nil? || ptr.null?
Shader.wrap(ptr)
end
|
#shader=(value) ⇒ Object
81
82
83
|
# File 'lib/skia/paint.rb', line 81
def shader=(value)
Native.sk_paint_set_shader(@ptr, value&.ptr)
end
|
#stroke_cap ⇒ Object
42
43
44
|
# File 'lib/skia/paint.rb', line 42
def stroke_cap
Native.sk_paint_get_stroke_cap(@ptr)
end
|
#stroke_cap=(value) ⇒ Object
46
47
48
|
# File 'lib/skia/paint.rb', line 46
def stroke_cap=(value)
Native.sk_paint_set_stroke_cap(@ptr, value)
end
|
#stroke_join ⇒ Object
50
51
52
|
# File 'lib/skia/paint.rb', line 50
def stroke_join
Native.sk_paint_get_stroke_join(@ptr)
end
|
#stroke_join=(value) ⇒ Object
54
55
56
|
# File 'lib/skia/paint.rb', line 54
def stroke_join=(value)
Native.sk_paint_set_stroke_join(@ptr, value)
end
|
#stroke_miter ⇒ Object
58
59
60
|
# File 'lib/skia/paint.rb', line 58
def stroke_miter
Native.sk_paint_get_stroke_miter(@ptr)
end
|
#stroke_miter=(value) ⇒ Object
62
63
64
|
# File 'lib/skia/paint.rb', line 62
def stroke_miter=(value)
Native.sk_paint_set_stroke_miter(@ptr, value.to_f)
end
|
#stroke_width ⇒ Object
34
35
36
|
# File 'lib/skia/paint.rb', line 34
def stroke_width
Native.sk_paint_get_stroke_width(@ptr)
end
|
#stroke_width=(value) ⇒ Object
38
39
40
|
# File 'lib/skia/paint.rb', line 38
def stroke_width=(value)
Native.sk_paint_set_stroke_width(@ptr, value.to_f)
end
|
#style ⇒ Object
26
27
28
|
# File 'lib/skia/paint.rb', line 26
def style
Native.sk_paint_get_style(@ptr)
end
|
#style=(value) ⇒ Object
30
31
32
|
# File 'lib/skia/paint.rb', line 30
def style=(value)
Native.sk_paint_set_style(@ptr, value)
end
|
#with(**options) ⇒ Object
138
139
140
141
142
|
# File 'lib/skia/paint.rb', line 138
def with(**options)
cloned = clone
options.each { |k, v| cloned.send(:"#{k}=", v) }
cloned
end
|