public class Fill extends StackArranger
Extent
s together to completely fill the available space, while preserving aspect
ratio.
Inspired by this Python
implementation by Jesse Crocker, which is in turn apparently inspired originally from https://www.crispymtn.com/stories/the-algorithm-for-a-perfectly-balanced-photo-gallery
collage.py
.
Constructor and Description |
---|
Fill() |
Fill(int rows)
Create with a particular number of rows.
|
Fill(int numberRows,
boolean varyNumberImagesPerRow,
int width,
double widthRatio) |
Modifier and Type | Method and Description |
---|---|
StackArrangement |
arrangeStacks(Iterator<Extent> extents,
OperationContext context)
Arranges stacks to that they fit together in a single raster.
|
void |
checkMisconfigured(BeanInstanceMap defaultInstances)
Checks that a bean's properties conform to expectations.
|
int |
getNumberRows()
The number of rows to use the montage, when sufficient images are available.
|
int |
getWidth()
The width of the combined image in pixels.
|
double |
getWidthRatio()
What fraction of the natural width of the elements should be used to determine the final
width.
|
boolean |
isVaryNumberImagesPerRow()
When true the number of
Extent s per row is allowed vary, to sensibly fill space. |
void |
setNumberRows(int numberRows)
The number of rows to use the montage, when sufficient images are available.
|
void |
setVaryNumberImagesPerRow(boolean varyNumberImagesPerRow)
When true the number of
Extent s per row is allowed vary, to sensibly fill space. |
void |
setWidth(int width)
The width of the combined image in pixels.
|
void |
setWidthRatio(double widthRatio)
What fraction of the natural width of the elements should be used to determine the final
width.
|
combine, combine
describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
public Fill(int rows)
rows
- the number of rows to use the montage, when sufficient images are available.public Fill()
public Fill(int numberRows, boolean varyNumberImagesPerRow, int width, double widthRatio)
public void checkMisconfigured(BeanInstanceMap defaultInstances) throws BeanMisconfiguredException
AnchorBean
checkMisconfigured
in class AnchorBean<StackArranger>
defaultInstances
- all available default instances if the DefaultInstance
annotation is usedBeanMisconfiguredException
- if the bean has not been configured properly as XMLpublic StackArrangement arrangeStacks(Iterator<Extent> extents, OperationContext context) throws ArrangeStackException
StackArranger
arrangeStacks
in class StackArranger
extents
- the size of each respective stack for the arrangement.context
- objects for the operation.RGBStack
in the unified plane.ArrangeStackException
- if a bounding-box cannot be determined for any stack.public int getNumberRows()
public void setNumberRows(int numberRows)
public boolean isVaryNumberImagesPerRow()
Extent
s per row is allowed vary, to sensibly fill space.
When false, the total number of Extent
s per row is kept uniform, apart from the
final occupied row (if there are insufficient images to fully populate it).
In both cases, the sizes of the images are allowed to vary, to maximally fill the available space.
public void setVaryNumberImagesPerRow(boolean varyNumberImagesPerRow)
Extent
s per row is allowed vary, to sensibly fill space.
When false, the total number of Extent
s per row is kept uniform, apart from the
final occupied row (if there are insufficient images to fully populate it).
In both cases, the sizes of the images are allowed to vary, to maximally fill the available space.
public int getWidth()
When 0, this is disabled.
At least one of both width
and widthRatio
must be enabled. If both are,
the minimum width is used.
public void setWidth(int width)
When 0, this is disabled.
At least one of both width
and widthRatio
must be enabled. If both are,
the minimum width is used.
public double getWidthRatio()
The natural width of the elements, is the average-width of an entire row after partitioning.
When 0.0, this is disabled.
At least one of both width
and widthRatio
must be enabled. If both are,
the minimum width is used.
public void setWidthRatio(double widthRatio)
The natural width of the elements, is the average-width of an entire row after partitioning.
When 0.0, this is disabled.
At least one of both width
and widthRatio
must be enabled. If both are,
the minimum width is used.
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.