Search in sources :

Example 1 with GraphicsEnvironment

use of java.awt.GraphicsEnvironment in project darkFunction-Editor by darkFunction.

the class AnimationCell method draw.

public void draw(final Graphics g, final Rectangle destRect) {
    if (vImage == null)
        return;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
    int valid = vImage.validate(gc);
    if (valid == VolatileImage.IMAGE_INCOMPATIBLE) {
        rebuild();
    }
    if (vImage != null) {
        Rectangle r = destRect;
        g.drawImage(vImage, r.x, r.y, r.width, r.height, null);
    }
}
Also used : Rectangle(java.awt.Rectangle) GraphicsEnvironment(java.awt.GraphicsEnvironment) Point(java.awt.Point) GraphicsConfiguration(java.awt.GraphicsConfiguration)

Example 2 with GraphicsEnvironment

use of java.awt.GraphicsEnvironment in project darkFunction-Editor by darkFunction.

the class ImageUtil method createVolatileImage.

public static VolatileImage createVolatileImage(int width, int height, int transparency) {
    if (width == 0 || height == 0)
        return null;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
    VolatileImage image = null;
    image = gc.createCompatibleVolatileImage(width, height, transparency);
    int valid = image.validate(gc);
    if (valid == VolatileImage.IMAGE_INCOMPATIBLE) {
        image = createVolatileImage(width, height, transparency);
    }
    return image;
}
Also used : VolatileImage(java.awt.image.VolatileImage) GraphicsEnvironment(java.awt.GraphicsEnvironment) GraphicsConfiguration(java.awt.GraphicsConfiguration)

Example 3 with GraphicsEnvironment

use of java.awt.GraphicsEnvironment in project darkFunction-Editor by darkFunction.

the class ImageUtil method createVolatileImage.

public static VolatileImage createVolatileImage(BufferedImage bi) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
    VolatileImage vimage = createVolatileImage(bi.getWidth(), bi.getHeight(), java.awt.Transparency.TRANSLUCENT);
    java.awt.Graphics2D g = null;
    try {
        g = vimage.createGraphics();
        // clear to transparent
        g.setComposite(AlphaComposite.Src);
        g.setColor(new Color(0, 0, 0, 0));
        g.fillRect(0, 0, vimage.getWidth(), vimage.getHeight());
        g.drawImage(bi, null, 0, 0);
    } finally {
        g.dispose();
    }
    return vimage;
}
Also used : VolatileImage(java.awt.image.VolatileImage) Color(java.awt.Color) GraphicsEnvironment(java.awt.GraphicsEnvironment) GraphicsConfiguration(java.awt.GraphicsConfiguration)

Example 4 with GraphicsEnvironment

use of java.awt.GraphicsEnvironment in project screenbird by adamhub.

the class ScreenUtil method isMultipleScreen.

/**
     * Checks for presence of multiple screens/monitors on the current computer.
     * @return True if more than one screen is detected.
     */
public static boolean isMultipleScreen() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] screens = ge.getScreenDevices();
    return screens.length > 1;
}
Also used : GraphicsDevice(java.awt.GraphicsDevice) GraphicsEnvironment(java.awt.GraphicsEnvironment)

Example 5 with GraphicsEnvironment

use of java.awt.GraphicsEnvironment in project nutz by nutzam.

the class OS method refreshFonts.

private static void refreshFonts() {
    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    // 获得系统字体
    _fonts = environment.getAvailableFontFamilyNames();
}
Also used : GraphicsEnvironment(java.awt.GraphicsEnvironment)

Aggregations

GraphicsEnvironment (java.awt.GraphicsEnvironment)87 GraphicsDevice (java.awt.GraphicsDevice)44 GraphicsConfiguration (java.awt.GraphicsConfiguration)41 BufferedImage (java.awt.image.BufferedImage)22 VolatileImage (java.awt.image.VolatileImage)21 Dimension (java.awt.Dimension)16 Graphics2D (java.awt.Graphics2D)16 Point (java.awt.Point)11 Font (java.awt.Font)10 Rectangle (java.awt.Rectangle)9 Insets (java.awt.Insets)7 File (java.io.File)7 Frame (java.awt.Frame)6 Toolkit (java.awt.Toolkit)6 AffineTransform (java.awt.geom.AffineTransform)6 HeadlessException (java.awt.HeadlessException)4 Color (java.awt.Color)3 Container (java.awt.Container)3 DisplayMode (java.awt.DisplayMode)3 GradientPaint (java.awt.GradientPaint)3