Interface RasterDepthPixBuff


  • public interface RasterDepthPixBuff
    This is a hook to do custom pixel computation with RasterDepthGraphics. In particular, pixels having translucency may be handled in a special way.
    See Also:
    RasterDepthGraphics
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clearScanLine​(int beginIndex, int length, int color)
      The invocation of this method is triggered by a call to RasterDepthGraphics.clear().
      void drawPixel​(int index, int color, int zDepth)
      Is told to "paint" the specified pixel location with the specified color (which is in ARGB, or 0xaarrggbb format), where the pixel's sampling point has the specified z depth.
      boolean getAccurateZ()
      Tells the 3D rendering context whether to employ a more accurate z computation strategy, the added expense being a slightly more significant CPU utilization.
      int getHeight()
      Reports back the height in pixels.
      int getWidth()
      Reports back the width in pixels.
      double getZBack()
      Returns the quantity zBack which is described in the plain vanilla constructor for RasterDepthGraphics.
      int getZBits()
      This needs to return a value between RasterDepthGraphics.ZBITS_0 and RasterDepthGraphics.ZBITS_24, inclusive.
      double getZFront()
      Returns the quantity zFront which is described in the plain vanilla constructor for RasterDepthGraphics.
    • Method Detail

      • getWidth

        int getWidth()
        Reports back the width in pixels. This is polled once during construction of the 3D rendering graphics context.
      • getHeight

        int getHeight()
        Reports back the height in pixels. This is polled once during construction of the 3D rendering graphics context.
      • getZBits

        int getZBits()
        This needs to return a value between RasterDepthGraphics.ZBITS_0 and RasterDepthGraphics.ZBITS_24, inclusive. It tells the 3D rendering context how many bits for the z buffering strategy to employ. This method is polled once during construction of the graphics context.
      • getZFront

        double getZFront()
        Returns the quantity zFront which is described in the plain vanilla constructor for RasterDepthGraphics. This is polled once during construction of the graphics context.
        See Also:
        RasterDepthGraphics(int[],int,int,double,double)
      • getZBack

        double getZBack()
        Returns the quantity zBack which is described in the plain vanilla constructor for RasterDepthGraphics. This is polled once during construction of the graphics context.
        See Also:
        RasterDepthGraphics(int[],int,int,double,double)
      • getAccurateZ

        boolean getAccurateZ()
        Tells the 3D rendering context whether to employ a more accurate z computation strategy, the added expense being a slightly more significant CPU utilization. This method is polled once during construction of the graphics context.

        Two things will happen when the accurate z computation method is chosen: (1) the "native" internal z space where computations take place will be shifted/translated to be centered around the origin [or the x/y plane in three dimensions], and (2) 64 bit to 32 bit aliasing will be employed as part of an attempt to chop away excessive computational/accumulation errors as pertaining to z buffer buckets.

        The default, less accurate internally employed z space spans from z equals zero (that being the "back") to z equals two to the power of getZBits() (that being the "front"). When the accurate z computation method is employed, that space is simply shifted by half its span in the negative z direction, to make the z region centered around zero. These are automatic computations that the developer need not be concerned about. In order to minimize the errors introduced into z computations, developers may choose to match the zFront and zBack clipping planes with the internal ones just described.

      • drawPixel

        void drawPixel​(int index,
                       int color,
                       int zDepth)
        Is told to "paint" the specified pixel location with the specified color (which is in ARGB, or 0xaarrggbb format), where the pixel's sampling point has the specified z depth. Obviously if there is an opaque color already set at a z value which is in front of the specified z depth, then this paint operation will probably do nothing. How translucent pixels are handled is up to the implementation of this interface.

        The value zDepth will fall between zero and a power of two minus one (the "upper bound"), inclusive. If getZBits() reports RasterDepthGraphics.ZBITS_16 then the upper inclusive bound for zDepth is 0x0000ffff. On the other hand if getZBits() reports ZBITS_24 then the upper inclusive bound for zDepth is 0x00ffffff, etc. The z value zero is at the furthest distance from the viewer. Orientation: index = y*getWidth() + x for pixel (x,y).

      • clearScanLine

        void clearScanLine​(int beginIndex,
                           int length,
                           int color)
        The invocation of this method is triggered by a call to RasterDepthGraphics.clear(). Therefore all pixels in the underlying pixel buffer should be set to the specified color, and all z buffer data should be zeroed out as a result of this call, on the scan line specified. (The clear() operation is subject to clipping rectangle.)