private static BufferedImage createShadowImage(ShadowKey key) { int w = key.width; int h = key.height; int arc = 10; int shadowSize = 50; BufferedImage base = GraphicsUtilities.createCompatibleTranslucentImage(w, h); Graphics2D g2 = base.createGraphics(); g2.setColor(Color.WHITE); g2.fillRoundRect(0, 0, w, h, arc, arc); g2.dispose(); ShadowRenderer renderer = new ShadowRenderer(shadowSize, 0.5f, Color.GRAY); return renderer.createShadow(base); }
int arc = 10; BufferedImage image = GraphicsUtilities.createCompatibleTranslucentImage(key.width, key.height); Graphics2D g2 = image.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
/** * <p>Returns a <code>BlendComposite</code> object that uses the specified * blending mode and this object's alpha value. If the newly specified * blending mode is the same as this object's, this object is returned.</p> * * @param mode the blending mode defining the compositing rule * @return a <code>BlendComposite</code> object derived from this object, * that uses the specified blending mode */ public BlendComposite derive(BlendingMode mode) { return this.mode == mode ? this : new BlendComposite(mode, getAlpha()); }
/** * {@inheritDoc} */ public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) { if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) { return new BlendingRgbContext(this); } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) { return new BlendingBgrContext(this); } throw new RasterFormatException("Incompatible color models"); }
/** * <p>Creates a new composite based on the blending mode passed * as a parameter. A default opacity of 1.0 is applied.</p> * * @param mode the blending mode defining the compositing rule * @return a new <code>BlendComposite</code> based on the selected blending * mode, with an opacity of 1.0 */ public static BlendComposite getInstance(BlendingMode mode) { return new BlendComposite(mode); }
/** * <p>Returns the HSL (Hue/Saturation/Luminance) equivalent of a given * RGB color. All three HSL components are between 0.0 and 1.0.</p> * * @param r the red component, between 0 and 255 * @param g the green component, between 0 and 255 * @param b the blue component, between 0 and 255 * @return a new array of 3 floats corresponding to the HSL components */ public static float[] RGBtoHSL(int r, int g, int b) { return RGBtoHSL(r, g, b, null); }
/** * {@inheritDoc} */ public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) { if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) { return new BlendingRgbContext(this); } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) { return new BlendingBgrContext(this); } throw new RasterFormatException("Incompatible color models"); }
/** * <p>Returns a <code>BlendComposite</code> object that uses the specified * blending mode and this object's alpha value. If the newly specified * blending mode is the same as this object's, this object is returned.</p> * * @param mode the blending mode defining the compositing rule * @return a <code>BlendComposite</code> object derived from this object, * that uses the specified blending mode */ public BlendComposite derive(BlendingMode mode) { return this.mode == mode ? this : new BlendComposite(mode, getAlpha()); }
/** * <p>Creates a new composite based on the blending mode passed * as a parameter. A default opacity of 1.0 is applied.</p> * * @param mode the blending mode defining the compositing rule * @return a new <code>BlendComposite</code> based on the selected blending * mode, with an opacity of 1.0 */ public static BlendComposite getInstance(BlendingMode mode) { return new BlendComposite(mode); }
/** * <p>Returns the HSL (Hue/Saturation/Luminance) equivalent of a given * RGB color. All three HSL components are between 0.0 and 1.0.</p> * * @param r the red component, between 0 and 255 * @param g the green component, between 0 and 255 * @param b the blue component, between 0 and 255 * @return a new array of 3 floats corresponding to the HSL components */ public static float[] RGBtoHSL(int r, int g, int b) { return RGBtoHSL(r, g, b, null); }
int cardYOffset = key.cardYOffset; BufferedImage image = GraphicsUtilities.createCompatibleTranslucentImage(key.width, key.height); Graphics2D g2d = image.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
/** * {@inheritDoc} */ @Override public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) { if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) { return new BlendingRgbContext(this); } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) { return new BlendingBgrContext(this); } throw new RasterFormatException("Incompatible color models:\n " + srcColorModel + "\n " + dstColorModel); }
/** * <p>Returns a <code>BlendComposite</code> object that uses the specified * blending mode and this object's alpha value. If the newly specified * blending mode is the same as this object's, this object is returned.</p> * * @param mode the blending mode defining the compositing rule * @return a <code>BlendComposite</code> object derived from this object, * that uses the specified blending mode */ public BlendComposite derive(BlendingMode mode) { return this.mode == mode ? this : new BlendComposite(mode, getAlpha()); }
/** * <p>Creates a new composite based on the blending mode passed * as a parameter. A default opacity of 1.0 is applied.</p> * * @param mode the blending mode defining the compositing rule * @return a new <code>BlendComposite</code> based on the selected blending * mode, with an opacity of 1.0 */ public static BlendComposite getInstance(BlendingMode mode) { return new BlendComposite(mode); }
/** * <p>Returns the HSL (Hue/Saturation/Luminance) equivalent of a given * RGB color. All three HSL components are between 0.0 and 1.0.</p> * * @param r the red component, between 0 and 255 * @param g the green component, between 0 and 255 * @param b the blue component, between 0 and 255 * @return a new array of 3 floats corresponding to the HSL components */ public static float[] RGBtoHSL(int r, int g, int b) { return RGBtoHSL(r, g, b, null); }
/** * Render the card to a new BufferedImage at it's current dimensions * * @return */ private BufferedImage renderCard() { int cardWidth = getCardWidth(); int cardHeight = getCardHeight(); // Create image to render to BufferedImage image = GraphicsUtilities.createCompatibleTranslucentImage(cardWidth, cardHeight); Graphics2D g2d = image.createGraphics(); // Render with Antialialsing g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Attributes CardPanelAttributes attribs = new CardPanelAttributes(cardWidth, cardHeight, isChoosable(), isSelected()); // Draw card itself cardRenderer.draw(g2d, attribs, image); // Done g2d.dispose(); return image; }
/** * <p>Creates a new composite based on the blending mode passed * as a parameter. A default opacity of 1.0 is applied.</p> * * @param mode the blending mode defining the compositing rule * @return a new <code>BlendComposite</code> based on the selected blending * mode, with an opacity of 1.0 */ public static BlendComposite getInstance(BlendingMode mode) { return new BlendComposite(mode); }
/** * <p>Returns the HSL (Hue/Saturation/Luminance) equivalent of a given * RGB color. All three HSL components are between 0.0 and 1.0.</p> * * @param r the red component, between 0 and 255 * @param g the green component, between 0 and 255 * @param b the blue component, between 0 and 255 * @return a new array of 3 floats corresponding to the HSL components */ public static float[] RGBtoHSL(int r, int g, int b) { return RGBtoHSL(r, g, b, null); }
private static BufferedImage createImage(Key key) { Dimension size = new Dimension(key.width, key.height); BufferedImage image = GraphicsUtilities.createCompatibleTranslucentImage(size.width, size.height); Graphics2D g2d = image.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
/** * <p>Creates a new composite based on the blending mode passed * as a parameter. A default opacity of 1.0 is applied.</p> * * @param mode the blending mode defining the compositing rule * @return a new <code>BlendComposite</code> based on the selected blending * mode, with an opacity of 1.0 */ public static BlendComposite getInstance(BlendingMode mode) { return new BlendComposite(mode); }