123456789_123456789_123456789_123456789_123456789_

Class: Layout::Image

Relationships
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Entity
Instance Chain:
self, Entity
Inherits: Layout::Entity

Overview

A raster image entity.

Examples:

image = Layout::Image.new("my_image.png", [[1, 1], [3, 3]])
clip_mask = image.clip_mask
if clip_mask.is_a?(Layout::Rectangle)
  point1 = Geom::Point2d.new(1, 1)
  point2 = Geom::Point2d.new(2, 2)
  bounds = [point1, point2]
  image.clip_mask = Layout::Ellipse.new(bounds)
end

Version:

  • LayOut 2018

Class Method Summary

Instance Attribute Summary

Entity - Inherited

#locked=

The #locked= method sets the Entity as locked or unlocked.

#locked?

The #locked? method returns whether the Entity is locked or unlocked.

#on_shared_layer?

The #on_shared_layer? method returns whether or not the Entity is on a shared Layer.

#style

The #style method returns the Style of the Entity.

#style=

The #style= method sets the Style of the Entity.

#untransformed_bounds

The #untransformed_bounds method returns the untransformed bounds of the Entity.

#untransformed_bounds=

The #untransformed_bounds= method sets the untransformed bounds of the Entity.

Instance Method Summary

Entity - Inherited

#==

The #== method checks to see if the two Entitys are equal.

#bounds

The #bounds method returns the 2D rectangular bounds of the Entity.

#document

The #document method returns the Document that the Entity belongs to, or nil if it is not in a Document.

#drawing_bounds

The #drawing_bounds method returns the 2D rectangular drawing bounds of the Entity.

#group

The #group method returns the Group the Entity belongs to, or nil if it is not in a Group.

#layer_instance

The #layer_instance method returns the LayerInstance that the Entity is on, or nil if it is not associated with a LayerInstance.

#move_to_group

The #move_to_group method moves the Entity into a Group.

#move_to_layer

The #move_to_layer method moves the Entity to the given Layer.

#page

The #page method returns the Page that the Entity belongs to, or nil if it is on a shared Layer or not in a Document.

#transform!

The #transform! method transforms the Entity with a given ::Geom::Transformation2d.

#transformation

The #transformation method returns the explicit ::Geom::Transformation2d.

Constructor Details

.new(path, bounds) ⇒ Image

The #initialize method creates a new Image from a given image file.

Examples:

image = Layout::Image.new("my_image.png", [[1, 1], [3, 3]])

Parameters:

Raises:

  • (ArgumentError)

    if bounds are zero size

  • (ArgumentError)

    if there was an error reading the image file, such as the file name being invalid

  • (RuntimeError)

    if there was an error allocating memory for the image

Version:

  • LayOut 2018

Instance Attribute Details

#clip_maskLayout::Entity (rw)

The #clip_mask method returns the clip mask of the Image, or nil if it does not have a clip mask.

Examples:

image = Layout::Image.new("my_image.png", [[1, 1], [3, 3]])
clip_mask = image.clip_mask

Returns:

Version:

  • LayOut 2018

#clip_mask=(clip_mask) (rw)

Note:

clip_mask may be nil as of LayOut 2020.1.

The #clip_mask= method sets the clip mask of the Image. clip_mask can be a Rectangle, Ellipse, or Path, or nil, and it must not currently exist in a Document, or Group.

Examples:

image = Layout::Image.new("my_image.png", [[1, 1], [3, 3]])
point1 = Geom::Point2d.new(1, 1)
point2 = Geom::Point2d.new(2, 2)
bounds = [point1, point2]
clip_mask = Layout::Rectangle.new(bounds)
image.clip_mask = clip_mask

Parameters:

Raises:

Version:

  • LayOut 2018