Class: Skia::PathEffect
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ptr) ⇒ PathEffect
constructor
A new instance of PathEffect.
Methods inherited from Base
#null?, release_callback, #to_ptr
Constructor Details
#initialize(ptr) ⇒ PathEffect
Returns a new instance of PathEffect.
5 6 7 |
# File 'lib/skia/path_effect.rb', line 5 def initialize(ptr) super(ptr, :sk_path_effect_unref) end |
Class Method Details
.dash(intervals, phase: 0.0) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/skia/path_effect.rb', line 15 def self.dash(intervals, phase: 0.0) unless intervals.is_a?(Array) && intervals.length >= 2 raise ArgumentError, 'intervals must be an array with at least 2 elements' end interval_values = intervals.map(&:to_f) intervals_ptr = FFI::MemoryPointer.new(:float, interval_values.length) intervals_ptr.write_array_of_float(interval_values) ptr = Native.sk_path_effect_create_dash(intervals_ptr, interval_values.length, phase.to_f) raise Error, 'Failed to create dash path effect' if ptr.nil? || ptr.null? new(ptr) end |
.wrap(ptr) ⇒ Object
9 10 11 12 13 |
# File 'lib/skia/path_effect.rb', line 9 def self.wrap(ptr) return nil if ptr.nil? || ptr.null? new(ptr) end |