Class: Layout::Image

Inherits:
Entity show all

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

Instance Method Summary # collapse

Methods inherited from Entity

#==, #bounds, #document, #drawing_bounds, #group, #layer_instance, #locked=, #locked?, #move_to_group, #move_to_layer, #on_shared_layer?, #page, #style, #style=, #transform!, #transformation, #untransformed_bounds, #untransformed_bounds=

Constructor Details

#initialize(path, bounds) ⇒ Layout::Image

The #initialize method creates a new Layout::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 Method Details

#clip_maskLayout::Entity

The #clip_mask method returns the clip mask of the Layout::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) ⇒ Object

Note:

clip_mask may be nil as of LayOut 2020.1.

The #clip_mask= method sets the clip mask of the Layout::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