Empty

smile.pictures.Empty
case object Empty extends Element

The empty picture, with nothing drawn and no room taken. It has no bounds, it is 0x0, its anchor is the origin, and every transform of it and every new anchor for it is it. It is the identity for composition. Adding it to a picture, or a picture to it, gives that picture, and no gap is laid out next to it. A zero scale factor gives it too.

Its bitmap (see smile.pictures.toBitmap) has no bounds either, but its pixels are one transparent pixel, since a buffer of pixels cannot have none.

Blank space that takes room is smile.pictures.blank.

Attributes

Source
Element.scala
Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Element
class Object
trait Matchable
class Any
Show all
Self type
Empty.type

Members list

Grouped members

scaling

final def scaleAround(horizontal: Double, vertical: Double, pivot: Pos): Element

This element scaled by horizontal along the world's x axis and vertical along its y axis, around pivot. A negative factor also mirrors it on that axis, and a zero factor gives the empty picture.

This element scaled by horizontal along the world's x axis and vertical along its y axis, around pivot. A negative factor also mirrors it on that axis, and a zero factor gives the empty picture.

Attributes

Throws
IllegalArgumentException

if a factor or a coordinate of pivot is not finite, or the scaled element would be too large for its transform to hold in a Double

Inherited from:
Element
Source
Element.scala
final def scaleAround(factor: Double, pivot: Pos): Element

This element scaled by factor around pivot. A negative factor also mirrors it, and a zero factor gives the empty picture.

This element scaled by factor around pivot. A negative factor also mirrors it, and a zero factor gives the empty picture.

Attributes

Throws
IllegalArgumentException

if the factor or a coordinate of pivot is not finite, or the scaled element would be too large for its transform to hold in a Double

Inherited from:
Element
Source
Element.scala
final def scaleBy(horizontal: Double, vertical: Double): Element

This element scaled by horizontal along the world's x axis and vertical along its y axis, around its anchor. A negative factor also mirrors it on that axis, and a zero factor gives the empty picture.

This element scaled by horizontal along the world's x axis and vertical along its y axis, around its anchor. A negative factor also mirrors it on that axis, and a zero factor gives the empty picture.

import smile.colors.PresetColor.*
import smile.modeling.*

val coin      = Circle(Pos.Origin, 30, fillWith(Gold), lineWith(Black, 4, round = true))
val stretched = coin.scaleBy(2, 0.5)

A golden circle with a black outline The circle stretched wide and
flat, its outline thicker at the sides

Attributes

Throws
IllegalArgumentException

if a factor is not finite

Inherited from:
Element
Source
Element.scala
final def scaleBy(factor: Double): Element

This element scaled by factor around its anchor. A negative factor also mirrors it, and a zero factor gives the empty picture.

This element scaled by factor around its anchor. A negative factor also mirrors it, and a zero factor gives the empty picture.

Attributes

Throws
IllegalArgumentException

if the factor is not finite

Inherited from:
Element
Source
Element.scala
final def scaleTo(width: Double, height: Double): Element

This element scaled around its anchor along the world axes so that its bounds are width wide and height high, outlines included, since they scale with the shape.

This element scaled around its anchor along the world axes so that its bounds are width wide and height high, outlines included, since they scale with the shape.

A negative target flips the element on that axis first. A zero target gives the empty picture. An axis on which the element has no extent, such as the width of an empty text, is left as it is.

Scaling along the world axes scales the bounds by exactly the same factors, so one step is enough, up to the rounding of the factors and of the arithmetic that places the bounds. That rounding has an absolute floor of about 2^-19 pixel, since the anchor and every move lie on the grid of 2^-20 pixel, so a target smaller than that is not met to its own precision.

Attributes

Throws
IllegalArgumentException

if a target is not finite, or the target is so much larger than the current extent that the factor between them, or the scaled transform, overflows a Double

Inherited from:
Element
Source
Element.scala

turning

final def flipDiagonally: Self

This element mirrored both ways through its anchor, which is a half turn around it.

This element mirrored both ways through its anchor, which is a half turn around it.

Attributes

Inherited from:
Element
Source
Element.scala
final def flipHorizontally: Self

This element mirrored left to right across the vertical line through its anchor.

This element mirrored left to right across the vertical line through its anchor.

Attributes

Inherited from:
Element
Source
Element.scala
final def flipVertically: Self

This element mirrored top to bottom across the horizontal line through its anchor.

This element mirrored top to bottom across the horizontal line through its anchor.

Attributes

Inherited from:
Element
Source
Element.scala
final def rotateAround(degrees: Double, pivot: Pos): Self

This element turned by degrees around pivot, counterclockwise on screen for a positive angle. Right angles are exact.

This element turned by degrees around pivot, counterclockwise on screen for a positive angle. Right angles are exact.

import smile.colors.PresetColor.*
import smile.modeling.*

val hand = Rectangle(60, 8, fillWith(Navy), None)
val fan  = Picture((0 to 150 by 30).map(angle => hand.rotateAround(angle, Pos(-30, 0)))*)

Six bars fanning out counterclockwise from one end

Attributes

Throws
IllegalArgumentException

if the angle or a coordinate of pivot is not finite

Inherited from:
Element
Source
Element.scala
final def rotateBy(degrees: Double): Self

This element turned by degrees around its anchor, counterclockwise on screen for a positive angle. Right angles are exact.

This element turned by degrees around its anchor, counterclockwise on screen for a positive angle. Right angles are exact.

Attributes

Throws
IllegalArgumentException

if the angle is not finite

Inherited from:
Element
Source
Element.scala

measuring

final def anchor: Pos

The point this element is placed, turned and scaled by.

The point this element is placed, turned and scaled by.

Attributes

Inherited from:
Element
Source
Element.scala
final def bounds: Option[Bounds]

The tight box around what this element draws, outlines included, or None when it draws nothing and takes no room.

The tight box around what this element draws, outlines included, or None when it draws nothing and takes no room.

Attributes

Inherited from:
Element
Source
Element.scala
final def height: Double

The height of smile.pictures.Element.bounds in pixels, or 0 when there are none.

The height of smile.pictures.Element.bounds in pixels, or 0 when there are none.

Attributes

Inherited from:
Element
Source
Element.scala
final def width: Double

The width of smile.pictures.Element.bounds in pixels, or 0 when there are none.

The width of smile.pictures.Element.bounds in pixels, or 0 when there are none.

Attributes

Inherited from:
Element
Source
Element.scala

moving

final def moveBy(dx: Double, dy: Double): Self

This element moved by dx to the right and dy down.

This element moved by dx to the right and dy down.

Attributes

Throws
IllegalArgumentException

if an offset is not finite

Inherited from:
Element
Source
Element.scala
final def moveTo(p: Pos): Self

This element moved so that its anchor is at p.

This element moved so that its anchor is at p.

Attributes

Throws
IllegalArgumentException

if a coordinate of p is not finite

Inherited from:
Element
Source
Element.scala
final def withAnchor(p: Pos): Self

This element with its anchor at p, drawn exactly as before. The anchor goes to the nearest multiple of 2^-20 pixel, where every translation lies, so that quarter turns around it stay exact. Every transform puts the anchor back on that grid, which moves it by at most half a step.

This element with its anchor at p, drawn exactly as before. The anchor goes to the nearest multiple of 2^-20 pixel, where every translation lies, so that quarter turns around it stay exact. Every transform puts the anchor back on that grid, which moves it by at most half a step.

Attributes

Throws
IllegalArgumentException

if a coordinate of p is not finite

Inherited from:
Element
Source
Element.scala

Type members

Types

type Self = Empty.type

The type of element that a transform that keeps an element whole returns.

The type of element that a transform that keeps an element whole returns.

Attributes

Source
Element.scala

Inherited types

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Singleton
Source
Mirror.scala

Attributes

Inherited from:
Singleton
Source
Mirror.scala
type MirroredMonoType = this.type

The mirrored *-type.

The mirrored *-type.

Attributes

Inherited from:
Singleton
Source
Mirror.scala
type MirroredType = this.type

Attributes

Inherited from:
Singleton
Source
Mirror.scala

Inherited and Abstract types

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Inherited methods

Creates a new instance of type T with elements taken from product p.

Creates a new instance of type T with elements taken from product p.

Value parameters

p

the product whose elements are used to create the new instance

Attributes

Inherited from:
Singleton
Source
Mirror.scala

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala