Class: Tea::Bitmap
- Inherits:
-
Object
- Object
- Tea::Bitmap
- Includes:
- Blitting, Clipping, PrimitiveDrawing
- Defined in:
- lib/tea/c_bitmap.rb
Overview
A Bitmap is a grid of pixels that holds graphics.
Constant Summary
Constants included from PrimitiveDrawing
PrimitiveDrawing::BLEND_MIXER, PrimitiveDrawing::REPLACE_MIXER
Instance Method Summary collapse
- #blittable_buffer ⇒ Object
- #clipping_buffer ⇒ Object
-
#h ⇒ Object
Get the height of the Bitmap in pixels.
-
#initialize(*args) ⇒ Bitmap
constructor
Create a new Bitmap.
- #primitive_buffer ⇒ Object
-
#w ⇒ Object
Get the width of the Bitmap in pixels.
Methods included from PrimitiveDrawing
#circle, #clear, #line, #point, #rect
Methods included from Clipping
Methods included from Blitting
Constructor Details
#initialize(*args) ⇒ Bitmap
Create a new Bitmap. This can be done in 2 ways:
- (image_path)
-
loads from an image
- (width, height, color)
-
creates with the given size and color
May raise ArgumentError if the arguments passed in don’t match one of the above, or Tea::Error if the Bitmap creation fails.
23 24 25 26 27 28 29 30 |
# File 'lib/tea/c_bitmap.rb', line 23 def initialize(*args) case args.length when 1 then from_image(*args) when 3 then fresh(*args) else raise ArgumentError, "wrong number of arguments (#{args.length} for 1 or 3)", caller end end |
Instance Method Details
#blittable_buffer ⇒ Object
43 44 45 |
# File 'lib/tea/c_bitmap.rb', line 43 def blittable_buffer @buffer end |
#clipping_buffer ⇒ Object
48 49 50 |
# File 'lib/tea/c_bitmap.rb', line 48 def clipping_buffer @buffer end |
#h ⇒ Object
Get the height of the Bitmap in pixels.
38 39 40 |
# File 'lib/tea/c_bitmap.rb', line 38 def h @buffer.h end |
#primitive_buffer ⇒ Object
53 54 55 |
# File 'lib/tea/c_bitmap.rb', line 53 def primitive_buffer @buffer end |
#w ⇒ Object
Get the width of the Bitmap in pixels.
33 34 35 |
# File 'lib/tea/c_bitmap.rb', line 33 def w @buffer.w end |