Class: TexPlay::EmptyImageStub

Inherits:
ImageStub show all
Defined in:
lib/texplay.rb

Overview

Used internally to create blank images (red/blue/green/alpha all 0) (TexPlay::create_image).

Credit to philomory for this class.

Instance Attribute Summary

Attributes inherited from ImageStub

#columns, #rows

Instance Method Summary collapse

Methods inherited from ImageStub

#to_blob

Constructor Details

#initialize(width, height) ⇒ EmptyImageStub

Returns a new instance of EmptyImageStub.

Parameters:

  • width (Integer)

    Number of pixels wide.

  • height (Integer)

    Number of pixels high.

Raises:

  • (ArgumentError)


156
157
158
159
# File 'lib/texplay.rb', line 156

def initialize(width, height)
  raise ArgumentError if (width > TexPlay::TP_MAX_QUAD_SIZE || height > TexPlay::TP_MAX_QUAD_SIZE)
  super("\0" * (width * height * 4), width, height)
end