java.awt.image.BufferedImage.getWritableTile()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中java.awt.image.BufferedImage.getWritableTile()方法的一些代码示例,展示了BufferedImage.getWritableTile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedImage.getWritableTile()方法的具体详情如下:
包路径:java.awt.image.BufferedImage
类名称:BufferedImage
方法名:getWritableTile

BufferedImage.getWritableTile介绍

暂无

代码示例

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageUPredBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int u;
      u = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.U, ((x/2)%8)/4, ((y/2)%8)/4).getPredict()[(x/2)%4][(y/2)%4];
      c[0] = u;
       c[1] = u;
       c[2] = u;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageUBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int u;
      u = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.U, ((x/2)%8)/4, ((y/2)%8)/4).getDest()[(x/2)%4][(y/2)%4];
      c[0] = u;
       c[1] = u;
       c[2] = u;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageVPredBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int v;
      v = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.V, ((x/2)%8)/4, ((y/2)%8)/4).getPredict()[(x/2)%4][(y/2)%4];
      c[0] = v;
       c[1] = v;
       c[2] = v;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageYPredBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int yy;
      yy = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.Y1, (x%16)/4, (y%16)/4).getPredict()[x%4][y%4];
       c[0] = yy;
       c[1] = yy;
       c[2] = yy;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageVDiffBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int v;
      v = 127+this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.V, ((x/2)%8)/4, ((y/2)%8)/4).getDiff()[(x/2)%4][(y/2)%4];
      c[0] = v;
       c[1] = v;
       c[2] = v;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}
public BufferedImage getDebugImageVPredBuffer() {

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageUDiffBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int u;
      u = 127+this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.U, ((x/2)%8)/4, ((y/2)%8)/4).getDiff()[(x/2)%4][(y/2)%4];
      c[0] = u;
       c[1] = u;
       c[2] = u;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageVBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int v;
      v = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.V, ((x/2)%8)/4, ((y/2)%8)/4).getDest()[(x/2)%4][(y/2)%4];
      c[0] = v;
       c[1] = v;
       c[2] = v;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageYBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int yy;
      yy = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.Y1, (x%16)/4, (y%16)/4).getDest()[x%4][y%4];
       c[0] = yy;
       c[1] = yy;
       c[2] = yy;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageYDiffBuffer() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int yy;
      yy = 127+this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.Y1, (x%16)/4, (y%16)/4).getDiff()[x%4][y%4];
       c[0] = yy;
       c[1] = yy;
       c[2] = yy;
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImagePredict() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int yy, u, v;
      yy = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.Y1, (x%16)/4, (y%16)/4).getPredict()[x%4][y%4];
      u = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.U, ((x/2)%8)/4, ((y/2)%8)/4).getPredict()[(x/2)%4][(y/2)%4];
      v = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.V, ((x/2)%8)/4, ((y/2)%8)/4).getPredict()[(x/2)%4][(y/2)%4];
       c[0] = (int)( 1.164*(yy-16)+1.596*(v-128) );
       c[1] = (int)( 1.164*(yy-16)-0.813*(v-128)-0.391*(u-128) );
       c[2] = (int)( 1.164*(yy-16)+2.018*(u-128) );
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public BufferedImage getDebugImageDiff() {
  BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
  WritableRaster imRas = bi.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int yy, u, v;
      yy = 127+this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.Y1, (x%16)/4, (y%16)/4).getDiff()[x%4][y%4];
      u = 127+this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.U, ((x/2)%8)/4, ((y/2)%8)/4).getDiff()[(x/2)%4][(y/2)%4];
      v = 127+this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.V, ((x/2)%8)/4, ((y/2)%8)/4).getDiff()[(x/2)%4][(y/2)%4];
       c[0] = (int)( 1.164*(yy-16)+1.596*(v-128) );
       c[1] = (int)( 1.164*(yy-16)-0.813*(v-128)-0.391*(u-128) );
       c[2] = (int)( 1.164*(yy-16)+2.018*(u-128) );
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
  bufferCount++;
  return bi;
}

代码示例来源:origin: plantuml/plantuml

public void useBufferedImage(BufferedImage dst) {
  WritableRaster imRas = dst.getWritableTile(0, 0);
  for(int x = 0; x< getWidth(); x++) {
    for(int y = 0; y< getHeight(); y++) {
      int c[] = new int[3];
      int yy, u, v;
      yy = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.Y1, (x%16)/4, (y%16)/4).getDest()[x%4][y%4];
      u = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.U, ((x/2)%8)/4, ((y/2)%8)/4).getDest()[(x/2)%4][(y/2)%4];
      v = this.getMacroBlock(x/16, y/16).getSubBlock(SubBlock.PLANE.V, ((x/2)%8)/4, ((y/2)%8)/4).getDest()[(x/2)%4][(y/2)%4];
       c[0] = (int)( 1.164*(yy-16)+1.596*(v-128) );
       c[1] = (int)( 1.164*(yy-16)-0.813*(v-128)-0.391*(u-128) );
       c[2] = (int)( 1.164*(yy-16)+2.018*(u-128) );
      for(int z=0; z<3; z++) {
        if(c[z]<0)
          c[z]=0;
        if(c[z]>255)
          c[z]=255;
      }
      imRas.setPixel(x, y, c);
    }
    fireRGBProgressUpdate(100.0F*x/getWidth());
  }
}
public void setFrame(ImageInputStream frame) {

代码示例来源:origin: stackoverflow.com

edgesImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
edgesImage.getWritableTile(0, 0).setDataElements(0, 0, width, height, pixels);

代码示例来源:origin: padreati/rapaio

private void writeEdges(int pixels[]) {
  //NOTE: There is currently no mechanism for obtaining the edge data
  //in any other format other than an INT_ARGB type BufferedImage.
  //This may be easily remedied by providing alternative accessors.
  if (edgesImage == null) {
    edgesImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  }
  edgesImage.getWritableTile(0, 0).setDataElements(0, 0, width, height, pixels);
}

代码示例来源:origin: MarginallyClever/Makelangelo-software

private void writeEdges(int pixels[]) {
  //NOTE: There is currently no mechanism for obtaining the edge data
  //in any other format other than an INT_ARGB type BufferedImage.
  //This may be easily remedied by providing alternative accessors.
  if (edgesImage == null) {
    edgesImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  }
  edgesImage.getWritableTile(0, 0).setDataElements(0, 0, width, height, pixels);
}

代码示例来源:origin: lbalazscs/Pixelitor

private void writeEdges(int[] pixels) {
    //NOTE: There is currently no mechanism for obtaining the edge data
    //in any other format other than an INT_ARGB type BufferedImage.
    //This may be easily remedied by providing alternative accessors.
    if (edgesImage == null) {
      edgesImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    }
    edgesImage.getWritableTile(0, 0).setDataElements(0, 0, width, height, pixels);
  }
}

代码示例来源:origin: net.java.dev.jai-imageio/jai-imageio-jpeg2000

public Raster readAsRaster() throws IOException {
  BufferedImage image = j2krparam.getDestination();
  WritableRaster raster = null;
  if (image == null) {
    raster = Raster.createWritableRaster(
      sampleModel.createCompatibleSampleModel(destinationRegion.x +
                          destinationRegion.width,
                          destinationRegion.y +
                          destinationRegion.height),
      new Point(0, 0));
  } else
    raster = image.getWritableTile(0, 0);
  readSubsampledRaster(raster);
  return raster;
}

代码示例来源:origin: com.github.jai-imageio/jai-imageio-jpeg2000

public Raster readAsRaster() throws IOException {
  BufferedImage image = j2krparam.getDestination();
  WritableRaster raster = null;
  if (image == null) {
    raster = Raster.createWritableRaster(
      sampleModel.createCompatibleSampleModel(destinationRegion.x +
                          destinationRegion.width,
                          destinationRegion.y +
                          destinationRegion.height),
      new Point(0, 0));
  } else
    raster = image.getWritableTile(0, 0);
  readSubsampledRaster(raster);
  return raster;
}

代码示例来源:origin: org.openmicroscopy/ome-jai

public Raster readAsRaster() throws IOException {
  BufferedImage image = j2krparam.getDestination();
  WritableRaster raster = null;
  if (image == null) {
    sampleModel = getSampleModel();
    raster = Raster.createWritableRaster(
      sampleModel.createCompatibleSampleModel(destinationRegion.x +
                          destinationRegion.width,
                          destinationRegion.y +
                          destinationRegion.height),
      new Point(0, 0));
  } else
    raster = image.getWritableTile(0, 0);
  readSubsampledRaster(raster);
  return raster;
}

代码示例来源:origin: io.scif/scifio-jai-imageio

public Raster readAsRaster() throws IOException {
  BufferedImage image = j2krparam.getDestination();
  WritableRaster raster = null;
  if (image == null) {
    sampleModel = getSampleModel();
    raster = Raster.createWritableRaster(
      sampleModel.createCompatibleSampleModel(destinationRegion.x +
                          destinationRegion.width,
                          destinationRegion.y +
                          destinationRegion.height),
      new Point(0, 0));
  } else
    raster = image.getWritableTile(0, 0);
  readSubsampledRaster(raster);
  return raster;
}

相关文章