Solandra class

The main class for Solandra. Contains some state such as random number seed and some Paints

Constructors

Solandra(Canvas canvas, Size size, {int seed = 0})

Properties

aspectRatio double
Canvas aspect ratio
no setter
c int
final
canvas Canvas
getter/setter pair
center Point<double>
Center of Canvas
no setter
fillPaint Paint
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
height double
Canvas height
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
seed int
Set the RNG seed
no getter
size Size
getter/setter pair
strokePaint Paint
getter/setter pair
width double
Canvas width
no setter

Methods

aroundCircle({Point<double>? at, required double radius, required int n, required dynamic callback(Point<double>, int)}) → void
Defaults to rotating around center of Canvas
background(double h, double s, double l, [double a = 100]) → void
Fill the background. Color is hsl(a), h goes from 0 to 360, others from 0 to 100.
clipped() → dynamic
Clip your drawing to the Canvas size
doProportion(double proportion, dynamic callback()) → void
Do the callback a proportion of times
draw(SPath path) → void
Draw a Solandra SPath (shape/path) with the current strokePaint
drawPath(Path path) → void
Draw (stroke) a conventional Dart Path with the current strokePaint
fill(SPath path) → void
Fill a Solandra SPath (shape/path) with the current fillPaint
fillPath(Path path) → void
Fill a conventional Dart Path with the current fillPaint
forFrame({required dynamic callback(Area area), double? margin}) → void
Get a drawable Area for painting after adding a margin (proportionate)
forGrid({int minX = 0, required int maxX, int minY = 0, required int maxY, bool columnFirst = true, required dynamic callback(Point<int> point, int index)}) → void
Iteration over an integer grid
forHorizontal({required int n, double margin = 0.0, required dynamic callback(Area area)}) → void
Go across canvas in chunks, with optional margin
forTiling({required int n, bool square = true, double margin = 0, bool columnFirst = true, required dynamic callback(Area area)}) → void
Helper for tiling a canvas
forVertical({required int n, double margin = 0.0, required dynamic callback(Area area)}) → void
Go down canvas in chunks, with optional margin
gaussian({double mean = 0, double sd = 1}) double
Get a random Gaussian value
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
perturb({required Point<double> at, required double magnitude}) Point<double>
Perturb a point (by uniform amount in 2D)
poisson(int lambda) int
Get a random Poisson value
proportionately(List<Case> cases) → void
Give a bunch of cases, do one with probability in proportion to proportion given.
random() double
Get a random number
randomAngle() double
Get a random angle
randomBool() bool
Get a random boolean
randomInt(int max) int
Get a random integer
randomPoint() Point<double>
Get a random point on the canvas
sample<T>(List<T> items) → T
Pick an item from a list at random
samples<T>(List<T> items, int count) List<T>
Pick many items from a list at random (with replacement)
setFillColor(double h, double s, double l, [double a = 100]) → void
Set the color for fillPaint. Color is hsl(a), h goes from 0 to 360, others from 0 to 100.
setStrokeColor(double h, double s, double l, [double a = 1.0]) → void
Set the color for strokePaint. Color is hsl(a), h goes from 0 to 360, others from 0 to 100.
shuffle<T>(List<T> items) List<T>
Shuffle a List, importantly uses same RNG as other random code.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited