Class: Skia::Base
- Inherits:
-
Object
- Object
- Skia::Base
- Defined in:
- lib/skia/base.rb
Direct Known Subclasses
Bitmap, Canvas, ColorFilter, ColorSpace, Data, Document, Font, Image, ImageFilter, MaskFilter, Paint, Path, PathEffect, Picture, Pixmap, RRect, RuntimeEffect, Shader, Surface, TextBlob, Typeface
Instance Attribute Summary collapse
-
#ptr ⇒ Object
readonly
Returns the value of attribute ptr.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ptr, release_method = nil) ⇒ Base
constructor
A new instance of Base.
- #null? ⇒ Boolean
- #to_ptr ⇒ Object
Constructor Details
#initialize(ptr, release_method = nil) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 |
# File 'lib/skia/base.rb', line 7 def initialize(ptr, release_method = nil) raise NullPointerError, 'Pointer cannot be nil' if ptr.nil? || ptr.null? @ptr = ptr @release_method = release_method setup_release if @release_method end |
Instance Attribute Details
#ptr ⇒ Object (readonly)
Returns the value of attribute ptr.
5 6 7 |
# File 'lib/skia/base.rb', line 5 def ptr @ptr end |
Class Method Details
.release_callback(release_method, ptr) ⇒ Object
23 24 25 |
# File 'lib/skia/base.rb', line 23 def self.release_callback(release_method, ptr) proc { Native.send(release_method, ptr) unless ptr.null? } end |
Instance Method Details
#null? ⇒ Boolean
19 20 21 |
# File 'lib/skia/base.rb', line 19 def null? @ptr.nil? || @ptr.null? end |
#to_ptr ⇒ Object
15 16 17 |
# File 'lib/skia/base.rb', line 15 def to_ptr @ptr end |