Package ca.eandb.jmist.framework.loader.openexr.attribute

Examples of ca.eandb.jmist.framework.loader.openexr.attribute.Channel


  private synchronized Buffer getChannelBufferSync(String name) {
    Buffer buf = data.get(name);
    if (buf == null) {
      ChannelList chlist = getChannelList();
      Channel channel = chlist.getChannel(name);
      Box2i dataWindow = getDataWindow();
      int w = dataWindow.getXSize();
      int h = dataWindow.getYSize();
      int sx = 1 + (w - 1) / channel.getxSampling();
      int sy = 1 + (h - 1) / channel.getySampling();
      PixelType pt = channel.getPixelType();

      switch (pt) {
      case UINT:
        buf = IntBuffer.allocate(sx * sy);
        break;
View Full Code Here


    setFloat(x, y, "G", (float) rgb.g());
    setFloat(x, y, "B", (float) rgb.b());
  }

  public long getUnsignedInt(int x, int y, String c) {
    Channel ch = getChannelList().getChannel(c);
    Box2i dw = getDataWindow();
    int xmin = dw.getXMin();
    int ymin = dw.getYMin();
    int sx = ch.getxSampling();
    int sy = ch.getySampling();
    int x0 = (x - xmin) / sx;
    int y0 = (y - ymin) / sy;
    int w0 = dw.getXSize() / sx;
    int index = y0 * w0 + x0;

    switch (ch.getPixelType()) {
    case UINT:
      IntBuffer ibuf = (IntBuffer) getChannelBuffer(c);
      return ((long) ibuf.get(index)) & 0xffffffffL;

    case HALF:
View Full Code Here

    }
  }

  public Half getHalf(int x, int y, String c) {
    Channel ch = getChannelList().getChannel(c);
    Box2i dw = getDataWindow();
    int sx = ch.getxSampling();
    int sy = ch.getySampling();
    int xmin = dw.getXMin();
    int ymin = dw.getYMin();
    int x0 = (x - xmin) / sx;
    int y0 = (y - ymin) / sy;
    int w0 = dw.getXSize() / sx;
    int index = y0 * w0 + x0;

    switch (ch.getPixelType()) {
    case UINT:
      IntBuffer ibuf = (IntBuffer) getChannelBuffer(c);
      return Half.valueOf((double) (((long) ibuf.get(index)) & 0xffffffffL));

    case HALF:
View Full Code Here

    }
  }

  public float getFloat(int x, int y, String c) {
    Channel ch = getChannelList().getChannel(c);
    Box2i dw = getDataWindow();
    int sx = ch.getxSampling();
    int sy = ch.getySampling();
    int xmin = dw.getXMin();
    int ymin = dw.getYMin();
    int x0 = (x - xmin) / sx;
    int y0 = (y - ymin) / sy;
    int w0 = dw.getXSize() / sx;
    int index = y0 * w0 + x0;

    switch (ch.getPixelType()) {
    case UINT:
      IntBuffer ibuf = (IntBuffer) getChannelBuffer(c);
      return (float) (((long) ibuf.get(index)) & 0xffffffffL);

    case HALF:
View Full Code Here

    }
  }

  public void setUnsignedInt(int x, int y, String c, long value) {
    Channel ch = getChannelList().getChannel(c);
    Box2i dw = getDataWindow();
    int sx = ch.getxSampling();
    int sy = ch.getySampling();
    int xmin = dw.getXMax();
    int ymin = dw.getYMin();
    int x0 = (x - xmin) / sx;
    int y0 = (y - ymin) / sy;
    int w0 = dw.getXSize() / sx;
    int index = y0 * w0 + x0;

    switch (ch.getPixelType()) {
    case UINT:
      IntBuffer ibuf = (IntBuffer) getChannelBuffer(c);
      ibuf.put(index, (int) value);
      break;

View Full Code Here

      throw new UnexpectedException("invalid pixel type");
    }
  }

  public void setHalf(int x, int y, String c, Half value) {
    Channel ch = getChannelList().getChannel(c);
    Box2i dw = getDataWindow();
    int sx = ch.getxSampling();
    int sy = ch.getySampling();
    int x0 = x / sx;
    int y0 = y / sy;
    int w0 = dw.getXSize() / sx;
    int index = y0 * w0 + x0;

    switch (ch.getPixelType()) {
    case UINT:
      IntBuffer ibuf = (IntBuffer) getChannelBuffer(c);
      ibuf.put(index, (int) MathUtil.clamp(value.longValue(), 0, (0x1L << 32) - 1));
      break;

View Full Code Here

      throw new UnexpectedException("Invalid pixel type");
    }
  }

  public void setFloat(int x, int y, String c, float value) {
    Channel ch = getChannelList().getChannel(c);
    Box2i dw = getDataWindow();
    int sx = ch.getxSampling();
    int sy = ch.getySampling();
    int x0 = x / sx;
    int y0 = y / sy;
    int w0 = dw.getXSize() / sx;
    int index = y0 * w0 + x0;

    switch (ch.getPixelType()) {
    case UINT:
      IntBuffer ibuf = (IntBuffer) getChannelBuffer(c);
      ibuf.put(index, (int) MathUtil.clamp((long) value, 0, (0x1L << 32) - 1));
      break;

View Full Code Here

    try {


//      OpenEXRImage image = new OpenEXRImage(new FileImageInputStream(new File("/home/brad/Downloads/openexr-images-1.5.0/ScanLines/Blobbies.exr")));
      OpenEXRImage image = new OpenEXRImage(640, 480);
      image.getChannelList().addChannel(new Channel("R", PixelType.FLOAT));
      image.getChannelList().addChannel(new Channel("G", PixelType.FLOAT));
      image.getChannelList().addChannel(new Channel("B", PixelType.FLOAT));
      image.setCompressionMethod(CompressionMethod.ZIP);
      image.setRGB(320, 240, new RGB(1,0,0));
//      image.attributes.put("compression", CompressionMethod.NONE);

//      PrintStream out = new PrintStream(new FileOutputStream("/home/brad/Downloads/openexr-images-1.5.0/ScanLines/Blobbies2.test"));
View Full Code Here

    ChannelList chlist = image.getChannelList();

    if (rawPixelType != null) {
      for (int i = 0, n = colorModel.getNumChannels(); i < n; i++) {
        String name = colorModel.getChannelName(i);
        chlist.addChannel(new Channel(name, rawPixelType));
      }
    }

    if (rgbPixelType != null) {
      chlist.addChannel(new Channel("R", rgbPixelType));
      chlist.addChannel(new Channel("G", rgbPixelType));
      chlist.addChannel(new Channel("B", rgbPixelType));
    }
  }
View Full Code Here

TOP

Related Classes of ca.eandb.jmist.framework.loader.openexr.attribute.Channel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.