Package ca.eandb.jmist.framework.color

Examples of ca.eandb.jmist.framework.color.ColorModel.fromRGB()


    int      y    = MathUtil.clamp((int) Math.floor(v * (double) h), 0, h - 1);
    ColorModel  cm    = lambda.getColorModel();

    switch (picture.getFormat()) {
      case RGBE:
        return cm.fromRGB(picture.getPixelRGB(x, y)).sample(lambda);
      case XYZE:
        return cm.fromXYZ(picture.getPixelXYZ(x, y)).sample(lambda);
      default:
        return cm.getBlack(lambda);
    }
View Full Code Here


    } else {
      switch (pixel.length) {
      case 1:
        return cm.getGray(pixel[0], lambda);
      case 3:
        return cm.fromRGB(pixel[0]/255.0, pixel[1]/255.0, pixel[2]/255.0).sample(lambda);
      case 4:
      {
        double alpha = pixel[3] / 255.0;
        if (MathUtil.equal(alpha, 1.0)) {
          return cm.fromRGB(pixel[0]/255.0, pixel[1]/255.0, pixel[2]/255.0).sample(lambda);
View Full Code Here

        return cm.fromRGB(pixel[0]/255.0, pixel[1]/255.0, pixel[2]/255.0).sample(lambda);
      case 4:
      {
        double alpha = pixel[3] / 255.0;
        if (MathUtil.equal(alpha, 1.0)) {
          return cm.fromRGB(pixel[0]/255.0, pixel[1]/255.0, pixel[2]/255.0).sample(lambda);
        } else if (MathUtil.equal(alpha, 0.0)) {
          return background.evaluate(p, lambda);
        } else {
          Color bg = background.evaluate(p, lambda);
          Color fg = cm.fromRGB(pixel[0]/255.0, pixel[1]/255.0, pixel[2]/255.0).sample(lambda);
View Full Code Here

          return cm.fromRGB(pixel[0]/255.0, pixel[1]/255.0, pixel[2]/255.0).sample(lambda);
        } else if (MathUtil.equal(alpha, 0.0)) {
          return background.evaluate(p, lambda);
        } else {
          Color bg = background.evaluate(p, lambda);
          Color fg = cm.fromRGB(pixel[0]/255.0, pixel[1]/255.0, pixel[2]/255.0).sample(lambda);
          return fg.times(alpha).plus(bg.times(1.0 - alpha));
        }
      }
      default:
        throw new RuntimeException("Raster has unrecognized number of bands.");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.