Class: Skia::MaskFilter

Inherits:
Base
  • Object
show all
Defined in:
lib/skia/mask_filter.rb

Instance Attribute Summary

Attributes inherited from Base

#ptr

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#null?, release_callback, #to_ptr

Constructor Details

#initialize(ptr) ⇒ MaskFilter

Returns a new instance of MaskFilter.



5
6
7
# File 'lib/skia/mask_filter.rb', line 5

def initialize(ptr)
  super(ptr, :sk_maskfilter_unref)
end

Class Method Details

.blur(style = :normal, sigma:, respect_ctm: nil) ⇒ Object

Raises:



15
16
17
18
19
20
21
22
23
24
# File 'lib/skia/mask_filter.rb', line 15

def self.blur(style = :normal, sigma:, respect_ctm: nil)
  ptr = if respect_ctm.nil?
          Native.sk_maskfilter_new_blur(style, sigma.to_f)
        else
          Native.sk_maskfilter_new_blur_with_flags(style, sigma.to_f, respect_ctm)
        end
  raise Error, 'Failed to create blur mask filter' if ptr.nil? || ptr.null?

  new(ptr)
end

.wrap(ptr) ⇒ Object



9
10
11
12
13
# File 'lib/skia/mask_filter.rb', line 9

def self.wrap(ptr)
  return nil if ptr.nil? || ptr.null?

  new(ptr)
end