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);
}
}
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;
}
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;
}
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;
}
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();
}
Aggregations