Class ContourPlot.Pixel

  • All Implemented Interfaces:
    ContourPlot.PixelBase
    Enclosing class:
    ContourPlot

    public class ContourPlot.Pixel
    extends java.lang.Object
    implements ContourPlot.PixelBase
    Pixel class for retrieving a value from an ContourPlot.Img. A Pixel object stores a position and can be used to get and set values of an Img. It is NOT the value and changing its position will not change the image, instead it will reference a different value of the image as the pixel object is a pointer to a value in the Img's data array.

    The Pixel class also provides a set of static methods for color decomposition and recombination from color channels like argb(int, int, int, int) or a(int), r(int), g(int), b(int).

    Since:
    1.0
    Author:
    hageldave
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private ContourPlot.Img img
      Img this pixel belongs to
      private int index
      index of the value this pixel references
    • Constructor Summary

      Constructors 
      Constructor Description
      Pixel​(ContourPlot.Img img, int index)
      Creates a new Pixel object referencing the value of specified Img at specified index.
      Pixel​(ContourPlot.Img img, int x, int y)
      Creates a new Pixel object referencing the value of specified Img at specified position.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int a()  
      int a​(int color)  
      double a_asDouble()
      Returns the alpha value of this pixel at its current position.
      double a_normalized​(int color)  
      int argb​(int a, int r, int g, int b)
      Packs 8bit ARGB color components into a single 32bit integer value.
      int argb_bounded​(int a, int r, int g, int b)
      Packs 8bit ARGB color components into a single 32bit integer value.
      int argb_fast​(int a, int r, int g, int b)
      Packs 8bit ARGB color components into a single 32bit integer value.
      int argb_fromNormalized​(double a, double r, double g, double b)
      Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value.
      int b()  
      int b​(int color)  
      double b_asDouble()
      Returns the blue value of this pixel at its current position.
      double b_normalized​(int color)  
      int g()  
      int g​(int color)  
      double g_asDouble()
      Returns the green value of this pixel at its current position.
      double g_normalized​(int color)  
      int getGrey​(int redWeight, int greenWeight, int blueWeight)
      Calculates the grey value of this pixel using specified weights.
      int getGrey​(int color, int redWeight, int greenWeight, int blueWeight)
      Calculates a grey value from an RGB or ARGB value using specified weights for each R,G and B channel.
      int getIndex()
      Returns this pixel's index.
      int getLuminance()  
      int getLuminance​(int color)  
      ContourPlot.Img getSource()
      Returns the underlying image of this pixel (the image referenced by this pixel)
      int getValue()
      Gets the value of the Img at the position currently referenced by this Pixel.
      int getX()  
      int getY()  
      int r()  
      int r​(int color)  
      double r_asDouble()
      Returns the red value of this pixel at its current position.
      double r_normalized​(int color)  
      int rgb​(int r, int g, int b)
      Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).
      int rgb_bounded​(int r, int g, int b)
      Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).
      int rgb_fast​(int r, int g, int b)
      Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).
      int rgb_fromNormalized​(double r, double g, double b)
      Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value with alpha=255 (opaque).
      ContourPlot.Pixel setA​(int a)
      Sets alpha channel value of this Pixel.
      ContourPlot.PixelBase setA_fromDouble​(double a)
      Sets the alpha value of this pixel at its current position with 0.0 as fully transparent and 1.0 as fully opaque.
      void setARGB​(int a, int r, int g, int b)
      Sets an ARGB value at the position currently referenced by this Pixel.
      ContourPlot.Pixel setARGB_fromDouble​(double a, double r, double g, double b)
      Sets an ARGB value at the position currently referenced by this Pixel.
      ContourPlot.Pixel setB​(int b)
      Sets blue channel value of this Pixel.
      ContourPlot.PixelBase setB_fromDouble​(double b)
      Sets the blue value of this pixel at its current position with 0.0 as no blue contribution and 1.0 as full blue contribution.
      ContourPlot.Pixel setG​(int g)
      Sets green channel value of this Pixel.
      ContourPlot.PixelBase setG_fromDouble​(double g)
      Sets the green value of this pixel at its current position with 0.0 as no green contribution and 1.0 as full green contribution.
      ContourPlot.Pixel setIndex​(int index)
      Sets the index of the Img value this Pixel references.
      ContourPlot.Pixel setPosition​(int x, int y)
      Sets the position of the Img value this Pixel references.
      ContourPlot.Pixel setR​(int r)
      Sets red channel value of this Pixel.
      ContourPlot.PixelBase setR_fromDouble​(double r)
      Sets the red value of this pixel at its current position with 0.0 as no red contribution and 1.0 as full red contribution.
      void setRGB​(int r, int g, int b)
      Sets an opaque RGB value at the position currently referenced by this Pixel.
      ContourPlot.Pixel setRGB_fromDouble​(double r, double g, double b)
      Sets an opaque RGB value at the position currently referenced by this Pixel.
      ContourPlot.Pixel setRGB_fromDouble_preserveAlpha​(double r, double g, double b)
      Sets an RGB value at the position currently referenced by this Pixel.
      void setRGB_preserveAlpha​(int r, int g, int b)
      Sets an RGB value at the position currently referenced by this Pixel.
      ContourPlot.Pixel setValue​(int pixelValue)
      Sets the value of the Img at the position currently referenced by this Pixel.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait