Class: LiteRGSS::Image

Inherits:
Disposable show all
Defined in:
LiteRGSS.rb.yard.rb

Overview

Class that is dedicated to perform Image operation in Memory before displaying those operations inside a texture (Bitmap)

Direct Known Subclasses

Image

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Disposable

#dispose, #disposed?

Instance Attribute Details

#heightInteger (readonly)

Returns the heigth of the image

Returns:

  • (Integer)

    Returns the heigth of the image



197
198
199
# File 'LiteRGSS.rb.yard.rb', line 197

def height
  @height
end

#rectRect (readonly)

Returns the surface of the image (0, 0, width, height)

Returns:

  • (Rect)

    Returns the surface of the image (0, 0, width, height)



199
200
201
# File 'LiteRGSS.rb.yard.rb', line 199

def rect
  @rect
end

#widthInteger (readonly)

Returns the width of the image

Returns:

  • (Integer)

    Returns the width of the image



195
196
197
# File 'LiteRGSS.rb.yard.rb', line 195

def width
  @width
end

Class Method Details

.new(width, height)

Create a new empty image with dimensions

Parameters:

  • width (Integer)
  • height (Integer)


185
186
187
# File 'LiteRGSS.rb.yard.rb', line 185

def self.new(filename_or_memory, from_memory = nil)

end

Instance Method Details

#blt(x, y, source, source_rect) ⇒ self

Blit an other image to this image (process alpha)

Parameters:

  • x (Integer)

    dest x coordinate

  • y (Integer)

    dest y coordinate

  • source (Image)

    image containing the copied pixels

  • source_rect (Rect)

    surface of the source containing the copied pixels

Returns:

  • (self)


212
213
214
# File 'LiteRGSS.rb.yard.rb', line 212

def blt(x, y, source, source_rect)

end

#blt!(x, y, source, source_rect) ⇒ self

Blit an other image to this image (replace the pixels)

Parameters:

  • x (Integer)

    dest x coordinate

  • y (Integer)

    dest y coordinate

  • source (Image)

    image containing the copied pixels

  • source_rect (Rect)

    surface of the source containing the copied pixels

Returns:

  • (self)


221
222
223
# File 'LiteRGSS.rb.yard.rb', line 221

def blt!(x, y, source, source_rect)

end

#clear_rect(x, y, width, height) ⇒ self

Clear a portion of the image

Parameters:

  • x (Integer)

    left corner coordinate

  • y (Integer)

    top corner coordinate

  • width (Integer)

    width of the cleared surface

  • height (Integer)

    height of the cleared surface

Returns:

  • (self)


246
247
248
# File 'LiteRGSS.rb.yard.rb', line 246

def clear_rect(x, y, width, height)

end

#copy_to_bitmap(bitmap) ⇒ self

Copy the image content to the bitmap (Bitmap must be the same size of the image)

Parameters:

Returns:

  • (self)


203
204
205
# File 'LiteRGSS.rb.yard.rb', line 203

def copy_to_bitmap(bitmap)

end

#create_mask(color, alpha)

Change the alpha of all the pixel that match the input color

Parameters:

  • color (Color)

    color to match

  • alpha (Integer)

    new apha value of the pixel that match color



283
284
285
# File 'LiteRGSS.rb.yard.rb', line 283

def create_mask(color, alpha)

end

#fill_rect(x, y, width, height, color)

Fill a portion of the image with a color

Parameters:

  • x (Integer)

    left corner coordinate

  • y (Integer)

    top corner coordinate

  • width (Integer)

    width of the filled surface

  • height (Integer)

    height of the filled surface

  • color (Color)

    color to fill



255
256
257
# File 'LiteRGSS.rb.yard.rb', line 255

def fill_rect(x, y, width, height, color)

end

#get_pixel(x, y) ⇒ Color?

Get a pixel color

Parameters:

  • x (Integer)

    x coordinate of the pixel

  • y (Integer)

    y coordinate of the pixel

Returns:

  • (Color, nil)

    nil means x,y is outside of the Image surface



262
263
264
# File 'LiteRGSS.rb.yard.rb', line 262

def get_pixel(x, y)

end

#get_pixel_alpha(x, y) ⇒ Integer, 0

Get a pixel alpha

Parameters:

  • x (Integer)

    x coordinate of the pixel

  • y (Integer)

    y coordinate of the pixel

Returns:

  • (Integer, 0)


269
270
271
# File 'LiteRGSS.rb.yard.rb', line 269

def get_pixel_alpha(x, y)

end

#set_pixel(x, y, color) ⇒ self

Set a pixel color

Parameters:

  • x (Integer)

    x coordinate of the pixel

  • y (Integer)

    y coordinate of the pixel

  • color (Color)

    new color of the pixel

Returns:

  • (self)


277
278
279
# File 'LiteRGSS.rb.yard.rb', line 277

def set_pixel(x, y, color)

end

#stretch_blt(dest_rect, source, source_rect) ⇒ self

Stretch blit an other image to this image (process alpha)

Parameters:

  • dest_rect (Rect)

    surface of the current image where to copy pixels

  • source (Image)

    image containing the copied pixels

  • source_rect (Rect)

    surface of the source containing the copied pixels

Returns:

  • (self)


229
230
231
# File 'LiteRGSS.rb.yard.rb', line 229

def stretch_blt(dest_rect, source, source_rect)

end

#stretch_blt!(dest_rect, source, source_rect) ⇒ self

Stretch blit an other image to this image (replace the pixels)

Parameters:

  • dest_rect (Rect)

    surface of the current image where to copy pixels

  • source (Image)

    image containing the copied pixels

  • source_rect (Rect)

    surface of the source containing the copied pixels

Returns:

  • (self)


237
238
239
# File 'LiteRGSS.rb.yard.rb', line 237

def stretch_blt!(dest_rect, source, source_rect)

end

#to_pngString?

Convert Image to PNG

Returns:

  • (String, nil)

    contents of the PNG, nil if couldn’t be converted to PNG



288
289
290
# File 'LiteRGSS.rb.yard.rb', line 288

def to_png

end

#to_png_file(filename) ⇒ Boolean

Save the Image to a PNG file

Parameters:

  • filename (String)

    Name of the PNG file

Returns:

  • (Boolean)

    success of the operation



294
295
296
# File 'LiteRGSS.rb.yard.rb', line 294

def to_png_file(filename)

end