Examples of ColorModel


Examples of ae.java.awt.image.ColorModel

     * @since 1.4
     */
    public DisplayMode getDisplayMode() {
        GraphicsConfiguration gc = getDefaultConfiguration();
        Rectangle r = gc.getBounds();
        ColorModel cm = gc.getColorModel();
        return new DisplayMode(r.width, r.height, cm.getPixelSize(), 0);
    }
View Full Code Here

Examples of ca.eandb.jmist.framework.color.ColorModel

   * @return A <code>Color</code> whose channel values represent the
   *     reflectances at the interface.
   * @see ca.eandb.jmist.math.Vector3#opposite()
   */
  public static Color reflectance(Vector3 in, Color n1, Color n2, Vector3 normal) {
    ColorModel colorModel = n1.getColorModel();
    WavelengthPacket lambda = n1.getWavelengthPacket();

    double[] n1d = n1.toArray();
    double[] n2d = n2.toArray();

    for (int i = 0; i < n1d.length; i++) {
      n1d[i] = Optics.reflectance(in, n1d[i], n2d[i], normal);
    }

    return colorModel.fromArray(n1d, lambda);
  }
View Full Code Here

Examples of com.google.code.appengine.awt.image.ColorModel

     * @param image
     * @return
     */
    private int getSourceCSType(RenderedImage image) {
        int type = JPEGConsts.JCS_UNKNOW;
        ColorModel cm = image.getColorModel();

        if (null == cm) {
            return type;
        }

        if (cm instanceof IndexColorModel) {
            // TODO: implement
            throw new UnsupportedOperationException(Messages.getString("imageio.80"));
        }

        boolean hasAlpha = cm.hasAlpha();
        ColorSpace cs = cm.getColorSpace();
        switch(cs.getType()) {
            case ColorSpace.TYPE_GRAY:
                type = JPEGConsts.JCS_GRAYSCALE;
                break;
           case ColorSpace.TYPE_RGB:
View Full Code Here

Examples of com.jgraph.gaeawt.java.awt.image.ColorModel

            Block[] mcu = allocateMCUMemory();
            Block[] scaledMCU = new Block[mcu.length];
            for (int i = 0; i < scaledMCU.length; i++)
                scaledMCU[i] = new Block(hSize, vSize);
            int[] preds = new int[sofnSegment.numberOfComponents];
            ColorModel colorModel;
            WritableRaster raster;
            if (sofnSegment.numberOfComponents == 3)
            {
                colorModel = new DirectColorModel(24,
                        0x00ff0000, 0x0000ff00, 0x000000ff);
View Full Code Here

Examples of com.narirelays.ems.utils.excel.ColorModel

       * 需要检查web sheet返回的结果中为什么没有border-top和border-bottom
       */
      if(styleMap.containsKey("border-top-style")){
        style.setBorderTop(HSSFCellStyle.BORDER_THIN);
        if(styleMap.containsKey("border-top-color")){
          ColorModel color = ColorModel.parseRGBString(styleMap.get("border-top-color"));
          if (color != null) {
            HSSFColor hssfColor = palette.findColor((byte) color.r,
                (byte) color.g, (byte) color.b);
            if (hssfColor == null) {
              short index = styleContainer.getNextColorIndex();
              palette.setColorAtIndex(index,(byte) color.r,
                  (byte) color.g, (byte) color.b);
              style.setTopBorderColor(index);
            }else{
              style.setTopBorderColor(hssfColor.getIndex());
            }
          }else{
            style.setTopBorderColor(IndexedColors.BLACK.getIndex());
          }
        }else{
          style.setTopBorderColor(IndexedColors.BLACK.getIndex());
        }
      }else{
        style.setBorderTop(HSSFCellStyle.BORDER_NONE);
      }
      if(styleMap.containsKey("border-bottom-style")){
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        if(styleMap.containsKey("border-bottom-color")){
          ColorModel color = ColorModel.parseRGBString(styleMap.get("border-bottom-color"));
          if (color != null) {
            HSSFColor hssfColor = palette.findColor((byte) color.r,
                (byte) color.g, (byte) color.b);
            if (hssfColor == null) {
              short index = styleContainer.getNextColorIndex();
              palette.setColorAtIndex(index,(byte) color.r,
                  (byte) color.g, (byte) color.b);
              style.setBottomBorderColor(index);
            }else{
              style.setBottomBorderColor(hssfColor.getIndex());
            }
          }else{
            style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
          }
        }else{
          style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
        }
      }else{
        style.setBorderBottom(HSSFCellStyle.BORDER_NONE);
      }
      if(styleMap.containsKey("border-left-style")){
        style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        if(styleMap.containsKey("border-left-color")){
          ColorModel color = ColorModel.parseRGBString(styleMap.get("border-left-color"));
          if (color != null) {
            HSSFColor hssfColor = palette.findColor((byte) color.r,
                (byte) color.g, (byte) color.b);
            if (hssfColor == null) {
              short index = styleContainer.getNextColorIndex();
              palette.setColorAtIndex(index,(byte) color.r,
                  (byte) color.g, (byte) color.b);
              style.setLeftBorderColor(index);
            }else{
              style.setLeftBorderColor(hssfColor.getIndex());
            }
          }else{
            style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
          }
        }else{
          style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
        }
      }else{
        style.setBorderLeft(HSSFCellStyle.BORDER_NONE);
      }     
      if(styleMap.containsKey("border-right-style")){
        style.setBorderRight(HSSFCellStyle.BORDER_THIN);
        if(styleMap.containsKey("border-right-color")){
          ColorModel color = ColorModel.parseRGBString(styleMap.get("border-right-color"));
          if (color != null) {
            HSSFColor hssfColor = palette.findColor((byte) color.r,
                (byte) color.g, (byte) color.b);
            if (hssfColor == null) {
              short index = styleContainer.getNextColorIndex();
              palette.setColorAtIndex(index,(byte) color.r,
                  (byte) color.g, (byte) color.b);
              style.setRightBorderColor(index);
            }else{
              style.setRightBorderColor(hssfColor.getIndex());
            }
          }else{
            style.setRightBorderColor(IndexedColors.BLACK.getIndex());
          }
        }else{
          style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
        }
      }else{
        style.setBorderRight(HSSFCellStyle.BORDER_NONE);
     
     
      if(styleMap.containsKey("border-style")){
        style.setBorderTop(HSSFCellStyle.BORDER_THIN);
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        style.setBorderRight(HSSFCellStyle.BORDER_THIN);
        style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        if(styleMap.containsKey("border-color")){
          ColorModel color = ColorModel.parseRGBString(styleMap.get("border-color"));
          if (color != null) {
            HSSFColor hssfColor = palette.findColor((byte) color.r,
                (byte) color.g, (byte) color.b);
            if (hssfColor == null) {
              short index = styleContainer.getNextColorIndex();
              palette.setColorAtIndex(index,(byte) color.r,
                  (byte) color.g, (byte) color.b);
              style.setTopBorderColor(index);
              style.setBottomBorderColor(index);
              style.setRightBorderColor(index);
              style.setLeftBorderColor(index);
            }else{
              style.setTopBorderColor(hssfColor.getIndex());
              style.setBottomBorderColor(hssfColor.getIndex());
              style.setRightBorderColor(hssfColor.getIndex());
              style.setLeftBorderColor(hssfColor.getIndex());
            }
          }else{
            style.setTopBorderColor(IndexedColors.BLACK.getIndex());
            style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
            style.setRightBorderColor(IndexedColors.BLACK.getIndex());
            style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
          }
        }else{
          style.setTopBorderColor(IndexedColors.BLACK.getIndex());
          style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
          style.setRightBorderColor(IndexedColors.BLACK.getIndex());
          style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
        }
      }
     
//      style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//      style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
//      style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//      style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
//      style.setBorderRight(HSSFCellStyle.BORDER_THIN);
//      style.setRightBorderColor(IndexedColors.BLACK.getIndex());
//      style.setBorderTop(HSSFCellStyle.BORDER_THIN);
//      style.setTopBorderColor(IndexedColors.BLACK.getIndex());
     
      // 设置相关值
      // 背景色 background-color
     
     
      if (styleMap.containsKey("background-color")) {
        String colorValue = styleMap.get("background-color");
        ColorModel color = ColorModel.parseRGBString(colorValue);
        if (color != null) {
          HSSFColor hssfColor = palette.findColor((byte) color.r,
              (byte) color.g, (byte) color.b);
          if (hssfColor == null) {
            short index = styleContainer.getNextColorIndex();
            palette.setColorAtIndex(index,(byte) color.r,
                (byte) color.g, (byte) color.b);
            style.setFillForegroundColor(index);
          }else{
            style.setFillForegroundColor(hssfColor.getIndex());
          }
          style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        }
      }
     
      if (td.hasAttr("bgcolor")) {
        String colorValue = td.attr("bgcolor");
        ColorModel color = ColorModel.parseRGBString(colorValue);
        if (color != null) {
          HSSFColor hssfColor = palette.findColor((byte) color.r,
              (byte) color.g, (byte) color.b);
          if (hssfColor == null) {
            short index = styleContainer.getNextColorIndex();
            palette.setColorAtIndex(index,(byte) color.r,
                  (byte) color.g, (byte) color.b);
            style.setFillForegroundColor(index);
          }else{
            style.setFillForegroundColor(hssfColor.getIndex());
          }
          style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        }
      }

      // 设置字体相关
      // font-family
      if (styleMap.containsKey("font-family")) {
        String font_family = styleMap.get("font-family");
        font.setFontName(font_family);
      }
      // 字体颜色
      if (styleMap.containsKey("color")) {
        String colorValue = styleMap.get("color");
        ColorModel color = ColorModel.parseRGBString(colorValue);
        if (color != null) {
          HSSFColor hssfColor = palette.findColor((byte) color.r,
              (byte) color.g, (byte) color.b);
          if (hssfColor == null) {
            short index = styleContainer.getNextColorIndex();
View Full Code Here

Examples of de.binfalse.martin.tools.ColorModel

    Vector<String> err = new Vector<String> ();
    String infile = null, outfile = null;
    int width = 500, height = 500;
    double startTime = 0, endTime = 60*60, startMz = 0, endMz = 1000;
    Scaler scaler = null;
    ColorModel cm = null;
    Map2D mapper = null;
    BufferedImage bi;
   
    for (int i = 0; i < args.length; i++)
    {
View Full Code Here

Examples of de.mpi.rgblab.color.ColorModel

    // Iterator it_map_matrix2;
    // Iterator it_tmp = it_map_matrix1;

    double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
    Vector<Double> key_row, key_row2, value_row;
    ColorModel tmp;
    double z = 0;

    Vector<ColorModel> labColors = new Vector<ColorModel>();
    rgbToLabColors(rgbColors, labColors);
View Full Code Here

Examples of java.awt.image.ColorModel

                outname = fileName.substring(0, fileName.length() - 4) + ".jpg";
            } else {
                outname = fileName + ".jpg";
            }
            RenderedOp img = JAI.create("fileload", fileName);
            ColorModel cm = img.getColorModel();
            WritableRaster imgRaster = img.copyData();
            BufferedImage bi = new BufferedImage(cm, imgRaster, false, new Hashtable());
            ImageIO.write((RenderedImage) bi, "jpg", new File(outname));
            System.out.println("...done, " + outname);
        } catch (Exception e) {
View Full Code Here

Examples of java.awt.image.ColorModel

    {
      image = (BufferedImage) img;
    }
    else
    {
      final ColorModel cm = img.getColorModel();
      final int width = img.getWidth();
      final int height = img.getHeight();
      final WritableRaster raster = cm.createCompatibleWritableRaster(width, height);
      final boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
      final Hashtable properties = new Hashtable();
      final String[] keys = img.getPropertyNames();
      if (keys != null)
      {
        final int keyCount = keys.length;
View Full Code Here

Examples of java.awt.image.ColorModel

  public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
      BufferedImage image = null;
      if (img instanceof BufferedImage) {
          image = (BufferedImage)img;
      } else {
          ColorModel cm = img.getColorModel();
          int width = img.getWidth();
          int height = img.getHeight();
          WritableRaster raster = cm.createCompatibleWritableRaster(width, height);
          boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          String[] keys = img.getPropertyNames();
          if (keys!=null) {
              for (int i = 0; i < keys.length; i++) {
                  properties.put(keys[i], img.getProperty(keys[i]));
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.