VectorGraphic

smile.pictures.VectorGraphic

A trait for vector graphics, which are picture elements defined in terms of points, lines, and curves. Vector graphics can be filled and/or stroked with specific styles.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Show all
Known subtypes
class Arc
class Point
class Polygon
class Text

Members list

Type members

Inherited classlikes

case class ElementWithCoordinates(element: PictureElement, x: Double, y: Double)

Represents an element with its coordinates, used for positioning elements at specific locations.

Represents an element with its coordinates, used for positioning elements at specific locations.

Value parameters

element

The picture element to be positioned.

x

The x-coordinate in pixels for positioning.

y

The y-coordinate in pixels for positioning.

Attributes

Inherited from:
Transformable
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Abstract methods

override def copy(newPosition: Pos): VectorGraphic

Creates a copy of this transformable object positioned at the specified coordinates.

Creates a copy of this transformable object positioned at the specified coordinates.

Value parameters

newPosition

The new position for the copied object.

Attributes

Returns

A new instance of the transformable object at the specified position.

Definition Classes
override def rotateBy(angle: Double, centerOfRotation: Pos): VectorGraphic

Rotates this object around a specified point by a given angle.

Rotates this object around a specified point by a given angle.

Value parameters

angle

The angle in degrees to rotate the object.

centerOfRotation

The point around which the object is rotated.

Attributes

Returns

A new instance of the transformable object rotated by the specified angle.

Definition Classes
override def rotateByAroundOrigin(angle: Double): VectorGraphic

Rotates the transformable object around its center by a specified angle in degrees.

Rotates the transformable object around its center by a specified angle in degrees.

Value parameters

angle

The angle in degrees to rotate the object.

Attributes

Returns

A new instance of the transformable object rotated by the specified angle.

Definition Classes
override def scaleBy(horizontalFactor: Double, verticalFactor: Double): VectorGraphic

Scales this object by given horizontal and vertical factors in relation to its center.

Scales this object by given horizontal and vertical factors in relation to its center.

Value parameters

horizontalFactor

The factor by which to scale the object horizontally.

verticalFactor

The factor by which to scale the object vertically.

Attributes

Returns

A new instance of the transformable object scaled by the specified factors.

Definition Classes
override def scaleBy(horizontalFactor: Double, verticalFactor: Double, relativityPoint: Pos): VectorGraphic

Scales this object by given horizontal and vertical factors in relation to a specified point.

Scales this object by given horizontal and vertical factors in relation to a specified point.

Value parameters

horizontalFactor

The factor by which to scale the object horizontally.

relativityPoint

The point in relation to which the object is scaled.

verticalFactor

The factor by which to scale the object vertically.

Attributes

Returns

A new instance of the transformable object scaled by the specified factors.

Definition Classes

Inherited methods

def addAt(content: Transformable[_], x: Double, y: Double, positionType: PositionType): Picture

Adds another transformable object at a specified position.

Adds another transformable object at a specified position.

Value parameters

content

The content to add.

positionType

The type of position reference.

x

The x-coordinate in pixels for the new position.

y

The y-coordinate in pixels for the new position.

Attributes

Returns

A picture with the added content.

Inherited from:
Transformable
def addAt(contentAndCoordinates: ElementWithCoordinates, positionType: PositionType): Picture

Adds another transformable object at a specified position.

Adds another transformable object at a specified position.

Value parameters

contentAndCoordinates

The element and its position.

positionType

The type of position reference.

Attributes

Returns

A picture with the added content.

Inherited from:
Transformable
def addAt(contentsAndCoordinates: Seq[ElementWithCoordinates], positionType: PositionType): Picture

Adds another transformable object at specified coordinates and position type.

Adds another transformable object at specified coordinates and position type.

Value parameters

contentsAndCoordinates

A sequence of elements with their corresponding positions.

positionType

The type of position reference (e.g., center or upper left corner).

Attributes

Returns

A picture with the added content.

Inherited from:
Transformable
def addTo(targetSide: Side, content: Transformable[_], padding: Double, alignment: SideIndependentAlignment): Picture

Adds content to a specified side of this object, optionally with padding.

Adds content to a specified side of this object, optionally with padding.

Value parameters

alignment

The alignment of the added content relative to the target side.

content

The content to add.

padding

The padding in pixels between the existing content and the added content.

targetSide

The side to add content to (Top, Bottom, Left, Right).

Attributes

Returns

A picture with the content added to the specified side.

Inherited from:
Transformable
def addToBack(toAppend: Transformable[_]): Picture

Adds the given transformable object to the back of this object.

Adds the given transformable object to the back of this object.

Value parameters

toAppend

The object to add to the back.

Attributes

Returns

A picture with the object added to the back.

Inherited from:
Transformable
def addToBottom(content: Transformable[_], padding: Double, alignment: HorizontalAlignment): Picture

Adds content below this object, optionally with padding and horizontal alignment.

Adds content below this object, optionally with padding and horizontal alignment.

Value parameters

alignment

The horizontal alignment of the added content.

content

The content to add below this object.

padding

The padding in pixels below this object.

Attributes

Returns

A picture with the content added below.

Inherited from:
Transformable
def addToFront(toPrepend: Transformable[_]): Picture

Adds the given transformable object to the front of this object.

Adds the given transformable object to the front of this object.

Value parameters

toPrepend

The object to add to the front.

Attributes

Returns

A picture with the object added to the front.

Inherited from:
Transformable
def addToLeft(content: Transformable[_], padding: Double, alignment: VerticalAlignment): Picture

Adds content to the left of this object, optionally with padding and vertical alignment.

Adds content to the left of this object, optionally with padding and vertical alignment.

Value parameters

alignment

The vertical alignment of the added content.

content

The content to add to the left.

padding

The padding in pixels to the left of this object.

Attributes

Returns

A picture with the content added to the left.

Inherited from:
Transformable
def addToRight(content: Transformable[_], padding: Double, alignment: VerticalAlignment): Picture

Adds content to the right of this object, optionally with padding and vertical alignment.

Adds content to the right of this object, optionally with padding and vertical alignment.

Value parameters

alignment

The vertical alignment of the added content.

content

The content to add to the right.

padding

The padding in pixels to the right of this object.

Attributes

Returns

A picture with the content added to the right.

Inherited from:
Transformable
def addToTop(content: Transformable[_], padding: Double, alignment: HorizontalAlignment): Picture

Adds content above this object, optionally with padding and alignment.

Adds content above this object, optionally with padding and alignment.

Value parameters

alignment

The horizontal alignment of the added content.

content

The content to add above this object.

padding

The padding in pixels above this object.

Attributes

Returns

A picture with the content added above.

Inherited from:
Transformable
def alternateDownwardsWith(alternatives: Seq[Transformable[_]], numberOfAlternations: Int, padding: Double, alignment: HorizontalAlignment): Picture

Alternates adding transformable objects downwards from this object.

Alternates adding transformable objects downwards from this object.

Value parameters

alignment

The horizontal alignment for each added object.

alternatives

A sequence of transformable objects to alternate with.

numberOfAlternations

The number of times to alternate additions.

padding

The vertical space between each added object.

Attributes

Returns

A picture with the alternated additions applied.

See also
Inherited from:
Transformable
def alternateLeftwardsWith(alternatives: Seq[Transformable[_]], numberOfAlternations: Int, padding: Double, alignment: VerticalAlignment): Picture

Alternates adding transformable objects leftwards from this object.

Alternates adding transformable objects leftwards from this object.

Value parameters

alignment

The vertical alignment for each added object.

alternatives

A sequence of transformable objects to alternate with.

numberOfAlternations

The number of times to alternate additions.

padding

The horizontal space between each added object.

Attributes

Returns

A picture with the alternated additions applied.

See also
Inherited from:
Transformable
def alternateRightwardsWith(alternatives: Seq[Transformable[_]], numberOfAlternations: Int, padding: Double, alignment: VerticalAlignment): Picture

Alternates adding transformable objects rightwards from this object.

Alternates adding transformable objects rightwards from this object.

Value parameters

alignment

The vertical alignment for each added object.

alternatives

A sequence of transformable objects to alternate with.

numberOfAlternations

The number of times to alternate additions.

padding

The horizontal space between each added object.

Attributes

Returns

A picture with the alternated additions applied.

See also
Inherited from:
Transformable
def alternateUpwardsWith(alternatives: Seq[Transformable[_]], numberOfAlternations: Int, padding: Double, alignment: HorizontalAlignment): Picture

Alternates adding transformable objects upwards from this object.

Alternates adding transformable objects upwards from this object.

Value parameters

alignment

The horizontal alignment for each added object.

alternatives

A sequence of transformable objects to alternate with.

numberOfAlternations

The number of times to alternate additions.

padding

The vertical space between each added object.

Attributes

Returns

A picture with the alternated additions applied.

See also
Inherited from:
Transformable
def alternateWith(alternatives: Seq[Transformable[_]], side: Side, numberOfAlternations: Int, padding: Double, alignment: SideIndependentAlignment): Picture

Alternates adding transformable objects around this object on a specified side, for a given number of alternations. This method allows for creating patterns or sequences of objects around the original object, adding them one after another in a specified direction.

Alternates adding transformable objects around this object on a specified side, for a given number of alternations. This method allows for creating patterns or sequences of objects around the original object, adding them one after another in a specified direction.

Value parameters

alignment

The alignment (either horizontal or vertical, depending on the side) of the added objects relative to the original object. This parameter controls how the added objects are aligned with respect to each other.

alternatives

A sequence of Transformable objects to alternate with. These objects are added in sequence around the original object.

numberOfAlternations

The total number of alternations to perform. This determines how many times objects from the alternatives sequence are added around this object.

padding

The padding in pixels between each added object, with a default value defined by smile.Settings.DefaultPaddingInPixels. This spacing is applied between successive alternations.

side

The side relative to this object where the alternations will be added (Top, Bottom, Left, or Right).

Attributes

Returns

A Picture instance that includes the original object and the alternated additions.

Inherited from:
Transformable
def crop(upperLeftX: Double, upperLeftY: Double, lowerRightX: Double, lowerRightY: Double): Bitmap

Crops this object to a specified area defined by upper left and lower right coordinates.

Crops this object to a specified area defined by upper left and lower right coordinates.

Value parameters

lowerRightX

The x-coordinate of the lower right corner of the crop area.

lowerRightY

The y-coordinate of the lower right corner of the crop area.

upperLeftX

The x-coordinate of the upper left corner of the crop area.

upperLeftY

The y-coordinate of the upper left corner of the crop area.

Attributes

Returns

A bitmap representing the cropped area of the object.

Inherited from:
Transformable
final inline def crop(upperLeftCorner: Pos, width: Double, height: Double): Bitmap

Crops the transformable object using an upper left corner and specified dimensions.

Crops the transformable object using an upper left corner and specified dimensions.

Value parameters

height

The height of the crop area in pixels.

upperLeftCorner

The upper left corner of the crop area.

width

The width of the crop area in pixels.

Attributes

Returns

A Bitmap representing the cropped area of the transformable object.

Inherited from:
Transformable
final inline def crop(upperLeftCorner: Pos, lowerRightCorner: Pos): Bitmap

Crops the transformable object using specified upper left and lower right corners.

Crops the transformable object using specified upper left and lower right corners.

Value parameters

lowerRightCorner

The lower right corner of the crop area.

upperLeftCorner

The upper left corner of the crop area.

Attributes

Returns

A Bitmap representing the cropped area of the transformable object.

Inherited from:
Transformable
final inline def crop(boundary: Bounds): Bitmap

Crops the transformable object to a specified boundary.

Crops the transformable object to a specified boundary.

Value parameters

boundary

The boundary to crop the transformable object to.

Attributes

Returns

A Bitmap representing the cropped area of the transformable object.

Inherited from:
Transformable
def moveBy(xOffset: Double, yOffset: Double): PictureElement

Moves the transformable object by the specified offsets from its current position.

Moves the transformable object by the specified offsets from its current position.

Value parameters

xOffset

The horizontal offset by which to move the object.

yOffset

The vertical offset by which to move the object.

Attributes

Returns

A new instance of TransformableType offset from the original position as specified.

Inherited from:
Transformable
def moveCenterTo(position: Pos): PictureElement

Moves the center of the transformable object to the specified position.

Moves the center of the transformable object to the specified position.

Value parameters

position

The new center position.

Attributes

Returns

A new instance of TransformableType with the center positioned as specified.

Inherited from:
Transformable
def moveCenterTo(x: Double, y: Double): PictureElement

Moves the center of the transformable object to the specified coordinates.

Moves the center of the transformable object to the specified coordinates.

Value parameters

x

The x-coordinate of the new center position.

y

The y-coordinate of the new center position.

Attributes

Returns

A new instance of TransformableType with the center positioned as specified.

Inherited from:
Transformable
def moveTo(x: Double, y: Double, positionType: PositionType): PictureElement

Moves the transformable object to a specified position, with the reference point determined by positionType (center or upper left corner).

Moves the transformable object to a specified position, with the reference point determined by positionType (center or upper left corner).

Value parameters

positionType

The reference point for the new position: center or upper left corner.

x

The x-coordinate of the new position.

y

The y-coordinate of the new position.

Attributes

Returns

A new instance of TransformableType, positioned as specified.

Inherited from:
Transformable

Moves the upper left corner of the transformable object to the specified position.

Moves the upper left corner of the transformable object to the specified position.

Value parameters

position

The new upper left corner position.

Attributes

Returns

A new instance of TransformableType with the upper left corner positioned as specified.

Inherited from:
Transformable
def moveUpperLeftCornerTo(x: Double, y: Double): PictureElement

Moves the upper left corner of the transformable object to the specified coordinates.

Moves the upper left corner of the transformable object to the specified coordinates.

Value parameters

x

The x-coordinate of the new upper left corner.

y

The y-coordinate of the new upper left corner.

Attributes

Returns

A new instance of TransformableType with the upper left corner positioned as specified.

Inherited from:
Transformable
def replicateDownwards(numberOfReplicas: Int, padding: Double, alignment: HorizontalAlignment, transformer: SimpleTransformer): Picture

Replicates this object downwards a specified number of times with padding and alignment.

Replicates this object downwards a specified number of times with padding and alignment.

Value parameters

alignment

The horizontal alignment for each replica.

numberOfReplicas

The number of times to replicate this object.

padding

The vertical space between each replica.

transformer

A function to apply a transformation to each replica.

Attributes

Returns

A picture with the replicated additions applied.

See also
Inherited from:
Transformable
def replicateLeftwards(numberOfReplicas: Int, padding: Double, alignment: VerticalAlignment, transformer: SimpleTransformer): Picture

Replicates this object leftwards a specified number of times with padding and alignment.

Replicates this object leftwards a specified number of times with padding and alignment.

Value parameters

alignment

The horizontal alignment for each replica.

numberOfReplicas

The number of times to replicate this object.

padding

The vertical space between each replica.

transformer

A function to apply a transformation to each replica.

Attributes

Returns

A picture with the replicated additions applied.

See also
Inherited from:
Transformable
def replicateRightwards(numberOfReplicas: Int, padding: Double, alignment: VerticalAlignment, transformer: SimpleTransformer): Picture

Replicates this object rightwards a specified number of times with padding and alignment.

Replicates this object rightwards a specified number of times with padding and alignment.

Value parameters

alignment

The horizontal alignment for each replica.

numberOfReplicas

The number of times to replicate this object.

padding

The vertical space between each replica.

transformer

A function to apply a transformation to each replica.

Attributes

Returns

A picture with the replicated additions applied.

See also
Inherited from:
Transformable
def replicateTo(side: Side, numberOfReplicas: Int, padding: Double, alignment: SideIndependentAlignment, transformer: SimpleTransformer): Picture

Replicates this object to a specified direction a given number of times, each time potentially transforming it and spacing the replicas with specified padding. This method allows for creating sequences or arrays of similar objects with modifications.

Replicates this object to a specified direction a given number of times, each time potentially transforming it and spacing the replicas with specified padding. This method allows for creating sequences or arrays of similar objects with modifications.

Value parameters

alignment

Determines how replicas are aligned relative to each other. This alignment can be horizontal or vertical, depending on the side specified for replication.

numberOfReplicas

The total number of replicas to be created and placed. This number includes the original object in the count.

padding

The space in pixels between each replica. This padding is applied uniformly between replicas to maintain consistent spacing.

side

The side (Top, Bottom, Left, Right) relative to this object where the replicas will be placed.

transformer

A transformation function applied to each replica before it is placed. This allows for dynamic alterations of the replicas, such as scaling, rotation, or color changes, providing versatility in the visual outcomes.

Attributes

Returns

A Picture that represents the combined visual result of all replicas, including the original object and its transformed replicas, arranged in the specified direction with the specified alignment and spacing.

Inherited from:
Transformable
def replicateUpwards(numberOfReplicas: Int, padding: Double, alignment: HorizontalAlignment, transformer: SimpleTransformer): Picture

Replicates this object upwards a specified number of times with padding and alignment.

Replicates this object upwards a specified number of times with padding and alignment.

Value parameters

alignment

The horizontal alignment for each replica.

numberOfReplicas

The number of times to replicate this object.

padding

The vertical space between each replica.

transformer

A function to apply a transformation to each replica.

Attributes

Returns

A picture with the replicated additions applied.

See also
Inherited from:
Transformable
def rotateBy90DegreesCCW(centerOfRotation: Pos): PictureElement

Rotates this object around a given point by 90 degrees counterclockwise.

Rotates this object around a given point by 90 degrees counterclockwise.

Attributes

Inherited from:
Transformable
def rotateBy90DegreesCW(centerOfRotation: Pos): PictureElement

Rotates this object around a given point by 90 degrees clockwise.

Rotates this object around a given point by 90 degrees clockwise.

Attributes

Inherited from:
Transformable
def scaleBy(factor: Double, relativityPoint: Pos): PictureElement

Scales the transformable object uniformly in both horizontal and vertical directions relative to a specified point.

Scales the transformable object uniformly in both horizontal and vertical directions relative to a specified point.

Value parameters

factor

The scaling factor to apply uniformly to both dimensions.

relativityPoint

The point relative to which the scaling is applied.

Attributes

Returns

A new instance of the transformable object scaled by the specified factor around the given point.

Inherited from:
Transformable
def scaleBy(factor: Double): PictureElement

Scales the transformable object uniformly in both horizontal and vertical directions relative to its center.

Scales the transformable object uniformly in both horizontal and vertical directions relative to its center.

Value parameters

factor

The scaling factor to apply uniformly to both dimensions.

Attributes

Returns

A new instance of the transformable object scaled by the specified factor.

Inherited from:
Transformable
def scaleTo(targetWidth: Double, targetHeight: Double, relativityPoint: Pos): PictureElement

Scales this object to given width and height in relation to a given point.

Scales this object to given width and height in relation to a given point.

Value parameters

relativityPoint

The point relative to which the scaling is applied.

targetHeight

The target height in pixels.

targetWidth

The target width in pixels.

Attributes

Returns

A new instance of the transformable object scaled to the specified dimensions.

Inherited from:
Transformable
def scaleTo(targetWidth: Double, targetHeight: Double): PictureElement

Scales the transformable object to a specified width and height relative to its center.

Scales the transformable object to a specified width and height relative to its center.

Value parameters

targetHeight

The target height in pixels.

targetWidth

The target width in pixels.

Attributes

Returns

A new instance of the transformable object scaled to the specified dimensions.

Inherited from:
Transformable

Converts the transformable object to a bitmap representation.

Converts the transformable object to a bitmap representation.

Attributes

Returns

A bitmap representation of the object.

Inherited from:
Transformable

Converts this PictureElement into a Picture by wrapping it within a new Picture instance.

Converts this PictureElement into a Picture by wrapping it within a new Picture instance.

Attributes

Returns

A Picture containing only this PictureElement.

Inherited from:
PictureElement

Concrete fields

val fillStyle: Option[FillStyle]

The style used to fill the vector graphic. If None, the graphic is not filled.

The style used to fill the vector graphic. If None, the graphic is not filled.

Attributes

val strokeStyle: Option[StrokeStyle]

The style used to stroke the outline of the vector graphic. If None, the graphic is not stroked.

The style used to stroke the outline of the vector graphic. If None, the graphic is not stroked.

Attributes

Inherited fields

lazy val boundary: Bounds

The bounding box of the transformable object.

The bounding box of the transformable object.

Attributes

Inherited from:
Transformable
lazy val position: Pos

The center position of the transformable object.

The center position of the transformable object.

Attributes

Inherited from:
Transformable