Class IndexImage.Counter

  • Enclosing class:
    IndexImage

    private static class IndexImage.Counter
    extends java.lang.Object
    Used to track a color and the number of pixels of that colors
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int count
      the number of image-pixels with this color.
      (package private) int val
      contains the 'packed' rgb-color for this point.
    • Constructor Summary

      Constructors 
      Constructor Description
      Counter​(int val)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) boolean add​(int val)  
      (package private) int[] getRgb​(int[] rgb)
      convert the color-point of this counter to an rgb-array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • val

        final int val
        contains the 'packed' rgb-color for this point. Must not change after construction!
      • count

        int count
        the number of image-pixels with this color.
    • Constructor Detail

      • Counter

        Counter​(int val)
    • Method Detail

      • add

        boolean add​(int val)
      • getRgb

        int[] getRgb​(int[] rgb)
        convert the color-point of this counter to an rgb-array. To avoid creating lots of arrays, the caller passes the array to store the result.
        Parameters:
        rgb - an int[ 3 ] to store the result.
        Returns:
        an int-array with rgb-color-values (same as rgb-parameter)