Class: Skia::ImageFilter

Inherits:
Base
  • Object
show all
Defined in:
lib/skia/image_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) ⇒ ImageFilter

Returns a new instance of ImageFilter.



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

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

Class Method Details

.blur(sigma_x, sigma_y, tile_mode: :decal, input: nil, crop_rect: nil) ⇒ Object

Raises:



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

def self.blur(sigma_x, sigma_y, tile_mode: :decal, input: nil, crop_rect: nil)
  crop_rect_struct = crop_rect&.to_struct
  ptr = Native.sk_imagefilter_new_blur(
    sigma_x.to_f,
    sigma_y.to_f,
    tile_mode,
    input&.ptr,
    crop_rect_struct
  )
  raise Error, 'Failed to create blur image filter' if ptr.nil? || ptr.null?

  new(ptr)
end

.wrap(ptr) ⇒ Object



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

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

  new(ptr)
end