/** * Retrieves crayons image for the crayon panel of color chooser. * * @return Crayons image. */ public static Image getCrayonsImage() { int iw = 195; int ih = 208; Image image = SubstanceCoreUtilities.getBlankImage(iw, ih); Graphics2D graphics = (Graphics2D) image.getGraphics().create(); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.setColor(new Color(240, 240, 240)); graphics.fillRect(0, 0, iw, ih); for (int i = 0; i < SubstanceImageCreator.crayonColors.length; i++) { Color crayonColor = new Color( 0xff000000 | SubstanceImageCreator.crayonColors[i]); Image crayonImage = SubstanceImageCreator.getSingleCrayon( crayonColor, 22, 120); graphics.drawImage(crayonImage, SubstanceImageCreator.crayonX(i), SubstanceImageCreator.crayonY(i), null); } graphics.setColor(new Color(190, 190, 190)); graphics.drawRoundRect(0, 1, iw - 1, ih - 2, 4, 4); graphics.dispose(); return image; }
/** * Retrieves crayons image for the crayon panel of color chooser. * * @return Crayons image. */ public static Image getCrayonsImage() { int iw = 195; int ih = 208; Image image = SubstanceCoreUtilities.getBlankImage(iw, ih); Graphics2D graphics = (Graphics2D) image.getGraphics().create(); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.setColor(new Color(240, 240, 240)); graphics.fillRect(0, 0, iw, ih); for (int i = 0; i < SubstanceImageCreator.crayonColors.length; i++) { Color crayonColor = new Color( 0xff000000 | SubstanceImageCreator.crayonColors[i]); Image crayonImage = SubstanceImageCreator.getSingleCrayon( crayonColor, 22, 120); graphics.drawImage(crayonImage, SubstanceImageCreator.crayonX(i), SubstanceImageCreator.crayonY(i), null); } graphics.setColor(new Color(190, 190, 190)); graphics.drawRoundRect(0, 1, iw - 1, ih - 2, 4, 4); graphics.dispose(); return image; }