Skip to content

Commit

Permalink
Correct order of arguments in GridColorChart constructor #30
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsacha committed May 16, 2020
1 parent 149b589 commit 89f9d9a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}

name := "ijp-color-project"

val _version = "0.8.0.4-SNAPSHOT"
val _version = "0.8.0.6-SNAPSHOT"
val _scalaVersions = Seq("2.13.1")
val _scalaVersion = _scalaVersions.head

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Image/J Plugins
* Copyright (C) 2002-2019 Jarek Sacha
* Copyright (C) 2002-2020 Jarek Sacha
* Author's email: jpsacha at gmail dot com
*
* This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -62,8 +62,8 @@ object ColorCharts {
("Neutral 3.5", Lab(36.19, -0.71, -0.30)),
("Black", Lab(20.68, -0.03, -0.50))
),
ReferenceWhite.D65,
chipMargin = 0
chipMargin = 0,
refWhite = ReferenceWhite.D65
)

/** X-Rite Passport ColorChecker chart, based on the values from "ColorChecker Passport Technical Review"
Expand Down Expand Up @@ -98,8 +98,8 @@ object ColorCharts {
("Neutral 3.5", Lab(36.20, -0.59, -0.73)),
("Black", Lab(20.44, 0.12, -0.54))
),
ReferenceWhite.D65,
chipMargin = 0
chipMargin = 0,
refWhite = ReferenceWhite.D65
)

/** Image Science ColorGauge Matte Neutral Patch Versions
Expand Down Expand Up @@ -141,8 +141,8 @@ object ColorCharts {
("29", Lab(72.50, -22.92, 56.08)),
("30", Lab(30.32, 22.13, -19.02)),
),
ReferenceWhite.D50,
chipMargin = 0
chipMargin = 0,
refWhite = ReferenceWhite.D50
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import scala.collection.immutable
* @param chips chip names and CIE L*a*b* / D65 color values, row by row, starting at (0,0) or top left corner.
* @param chipMargin reduction of chip from their maximum size on the grid (as fraction of its width or height).
* Value of the margin must be between 0 and 0.5.
* @param enabled which chips are active. If value is 'true' chip is active' if 'false' not used in computations.
*/
final class GridColorChart(val name: String,
nbColumns: Int,
Expand All @@ -58,6 +59,7 @@ final class GridColorChart(val name: String,
require(nbColumns > 0)
require(nbRows > 0)
require(nbColumns * nbRows == chips.size)
require(chips.size == enabled.size)
require(refWhite != null)
require(alignmentTransform != null)

Expand All @@ -72,11 +74,11 @@ final class GridColorChart(val name: String,
nbColumns: Int,
nbRows: Int,
chips: List[(String, Lab)],
refWhite: ReferenceWhite,
chipMargin: Double = 0,
perspectiveTransform: PerspectiveTransform = new PerspectiveTransform()) = {
refWhite: ReferenceWhite,
alignmentTransform: PerspectiveTransform = new PerspectiveTransform()) = {
this(name, nbColumns, nbRows, chips, chipMargin, List.fill(nbColumns * nbRows)(true), refWhite,
perspectiveTransform)
alignmentTransform)
}

private val n = nbColumns * nbRows
Expand Down Expand Up @@ -163,9 +165,9 @@ final class GridColorChart(val name: String,

/** Creates a copy of this chart with different `chipMargin`. Value of the margin must be between 0 and 0.5. */
override def copyWithNewChipMargin(newChipMargin: Double): GridColorChart =
new GridColorChart(name, nbColumns, nbRows, chips, refWhite, newChipMargin, alignmentTransform)
new GridColorChart(name, nbColumns, nbRows, chips, newChipMargin, refWhite, alignmentTransform)

/** Creates a copy of this chart with different `alignmentTransform`. */
override def copyWith(newAlignmentTransform: PerspectiveTransform): GridColorChart =
new GridColorChart(name, nbColumns, nbRows, chips, refWhite, chipMargin, newAlignmentTransform)
new GridColorChart(name, nbColumns, nbRows, chips, chipMargin, refWhite, newAlignmentTransform)
}

0 comments on commit 89f9d9a

Please sign in to comment.