Class ChooserMetrics
java.lang.Object
com.iizigo.prop.editor.color.swt.ChooserMetrics
The size arithmetic of the SWT color chooser (CC-COLOR-CHOOSER-SWT-PANELS, 2026-10-10). Every size is in SWT points: SWT scales them by the monitor's zoom, so no zoom arithmetic happens here. The one input is the height of the dialog font's metrics (
ApplicationUI.fontCY, 15 points for the standard Windows dialog font), from which the swatch cell follows (ruling SC-D-2 of CC-FIX-COLOR-CHOOSER: 10 points at 15).Pure functions, tested headless.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe gap between two cells, in points.static final intThe largest swatch cell as a multiple of the cell at the dialog font (cellSize(int)): the Swatches tab grows its cells with its size up to three times that cell, 30 points at the reference font (CC-FIX-SWATCHES-SCALE, 2026-10-28), so that a maximized dialog does not make tiles of a palette.static final intThe smallest swatch cell, in points.static final intThe swatch cell at the reference font height, in points.static final intThe side of the color diagrams at the reference font height, in points.static final intThe reference height of the dialog font's metrics in points (Segoe UI 9 pt: 15).static final intThe width of the hue strip at the reference font height, in points.Method Summary
Modifier and TypeMethodDescriptionstatic intcellSize(int fontHeight) Gets the swatch cell size for a dialog font height: the reference cell of 10 at the reference height of 15 points, proportional otherwise, never belowMIN_CELL.static intgridExtent(int cells, int cellSize) Gets the extent of a grid of cells along one axis: the cells with the gaps between them.static intpitch(int cellSize) Gets the pitch of a grid: a cell and its gap.static intscaled(int reference, int fontHeight) Scales a reference size (at the reference font height) to a font height, at least 1.
Field Details
REFERENCE_CELL
public static final int REFERENCE_CELLThe swatch cell at the reference font height, in points.- See Also:
REFERENCE_FONT_HEIGHT
public static final int REFERENCE_FONT_HEIGHTThe reference height of the dialog font's metrics in points (Segoe UI 9 pt: 15).- See Also:
MIN_CELL
public static final int MIN_CELLThe smallest swatch cell, in points.- See Also:
MAX_CELL_SCALE
public static final int MAX_CELL_SCALEThe largest swatch cell as a multiple of the cell at the dialog font (cellSize(int)): the Swatches tab grows its cells with its size up to three times that cell, 30 points at the reference font (CC-FIX-SWATCHES-SCALE, 2026-10-28), so that a maximized dialog does not make tiles of a palette.- See Also:
GAP
public static final int GAPThe gap between two cells, in points.- See Also:
REFERENCE_DIAGRAM
public static final int REFERENCE_DIAGRAMThe side of the color diagrams at the reference font height, in points.- See Also:
REFERENCE_STRIP
public static final int REFERENCE_STRIPThe width of the hue strip at the reference font height, in points.- See Also:
Method Details
cellSize
public static int cellSize(int fontHeight) Gets the swatch cell size for a dialog font height: the reference cell of 10 at the reference height of 15 points, proportional otherwise, never belowMIN_CELL.- Parameters:
fontHeight- The height of the dialog font's metrics in points (fontCY), a value below 1 for the reference.- Returns:
- The cell size in points.
pitch
public static int pitch(int cellSize) Gets the pitch of a grid: a cell and its gap.gridExtent
public static int gridExtent(int cells, int cellSize) Gets the extent of a grid of cells along one axis: the cells with the gaps between them.- Parameters:
cells- The number of cells.cellSize- The cell size.
scaled
public static int scaled(int reference, int fontHeight) Scales a reference size (at the reference font height) to a font height, at least 1.- Parameters:
reference- The size at the reference font height.fontHeight- The height of the dialog font's metrics, a value below 1 for the reference.