struct CrystGLFW::Window::Image

Overview

An Image object wraps an underlying GLFW Image and exposes its attributes.

Defined in:

crystglfw/windows/image.cr

Constructors

Instance Method Summary

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.


[View source]

Instance Method Detail

def height : Int32 #

Returns the height of the image in pixels.


[View source]
def pixels : Array(UInt8) #

Returns the pixel data of the image, arranged left-to-right, top-to-bottom.


[View source]
def width : Int32 #

Returns the width of the image in pixels.


[View source]