Exemplo n.º 1
0
  /** Generate a tiled image that contains a view of the mask. */
  @SuppressWarnings("restriction")
  public TiledImage getMaskImage() {
    TiledImage ti =
        new TiledImage(
            0,
            0,
            mwidth,
            mheight,
            0,
            0,
            new PixelInterleavedSampleModel(
                DataBuffer.TYPE_BYTE, mwidth, mheight, 1, mwidth, Transform.bandstride),
            new ComponentColorModel(
                ColorSpace.getInstance(ColorSpace.CS_GRAY),
                false,
                false,
                ComponentColorModel.OPAQUE,
                DataBuffer.TYPE_BYTE));

    WritableRaster gradRaster = ti.getWritableTile(0, 0);
    DataBufferByte gradDB = (DataBufferByte) gradRaster.getDataBuffer();
    byte[] gradImageData = gradDB.getData();

    int maskwh = mwidth * mheight;
    for (int i = 0; i < maskwh; i++) gradImageData[i] = (byte) mask[i];

    return ti;
  }
Exemplo n.º 2
0
  public int getValue(int pos) {
    int b = (int) (pos / (width * height));
    pos -= b * width * height;
    int y = (int) (pos / width);
    int x = pos % width;

    return outImage.getSample(x, y, b);
  }
Exemplo n.º 3
0
  protected void setValue(int pos, int val) {

    int b = (int) (pos / (width * height));
    pos -= b * width * height;
    int y = (int) (pos / width);
    int x = pos % width;

    outImage.setSample(x, y, b, val);
  }
Exemplo n.º 4
0
  protected void setValue(int pos, int sign, int tt) {
    int s = (sign == QuadOutputStream.PLUS) ? 1 : -1;

    int b = (int) (pos / (width * height));
    pos -= b * width * height;
    int y = (int) (pos / width);
    int x = pos % width;

    outImage.setSample(x, y, b, s * tt);
  }