struct CrystGLFW::Window::Image
- CrystGLFW::Window::Image
- Struct
- Value
- Object
Overview
An Image object wraps an underlying GLFW Image and exposes its attributes.
Defined in:
crystglfw/windows/image.crConstructors
-
.new(width : Int32, height : Int32, pixels : Array(UInt8))
Create a new image for use as a Cursor image or a Window icon.
Instance Method Summary
-
#pixels : Slice(UInt8)
Returns the pixel data of the image, arranged left-to-right, top-to-bottom.
- #size : NamedTuple(width: Int32, height: Int32)
Constructor Detail
def self.new(width : Int32, height : Int32, pixels : Array(UInt8))
#
Create a new image for use as a Cursor image or a Window icon.
width, height = 16, 32
pixels = Array(UInt8).new(width * height, 255_u8)
image = CrystGLFW::Image.new(width, height, pixels)
This method accepts the following arguments:
- width, the width of the image, in pixels.
- height, the height of the image, in pixels.
- pixels, the pixel data, given left-to-right, top-to-bottom.
NOTE This method may be called outside a CrystGLFW#run
block defintion without triggering an error.
Instance Method Detail
def pixels : Slice(UInt8)
#
Returns the pixel data of the image, arranged left-to-right, top-to-bottom.