use of sun.awt.image.ImageRepresentation in project jdk8u_jdk by JetBrains.
the class ToolkitImage method flush.
public void flush() {
if (src != null) {
src.checkSecurity(null, false);
}
ImageRepresentation ir;
synchronized (this) {
availinfo &= ~ImageObserver.ERROR;
ir = imagerep;
imagerep = null;
}
if (ir != null) {
ir.abort();
}
if (src != null) {
src.flush();
}
}
use of sun.awt.image.ImageRepresentation in project jdk8u_jdk by JetBrains.
the class ToolkitImage method setAccelerationPriority.
public void setAccelerationPriority(float priority) {
super.setAccelerationPriority(priority);
ImageRepresentation imageRep = getImageRep();
imageRep.setAccelerationPriority(accelerationPriority);
}
use of sun.awt.image.ImageRepresentation in project jdk8u_jdk by JetBrains.
the class DrawImage method transformImage.
public boolean transformImage(SunGraphics2D sg, Image img, AffineTransform atfm, ImageObserver observer) {
if (!(img instanceof ToolkitImage)) {
transformImage(sg, img, 0, 0, atfm, sg.interpolationType);
return true;
} else {
ToolkitImage sunimg = (ToolkitImage) img;
if (!imageReady(sunimg, observer)) {
return false;
}
ImageRepresentation ir = sunimg.getImageRep();
return ir.drawToBufImage(sg, sunimg, atfm, observer);
}
}
use of sun.awt.image.ImageRepresentation in project jdk8u_jdk by JetBrains.
the class DrawImage method copyImage.
public boolean copyImage(SunGraphics2D sg, Image img, int x, int y, Color bgColor, ImageObserver observer) {
if (!(img instanceof ToolkitImage)) {
return copyImage(sg, img, x, y, bgColor);
} else {
ToolkitImage sunimg = (ToolkitImage) img;
if (!imageReady(sunimg, observer)) {
return false;
}
ImageRepresentation ir = sunimg.getImageRep();
return ir.drawToBufImage(sg, sunimg, x, y, bgColor, observer);
}
}
use of sun.awt.image.ImageRepresentation in project jdk8u_jdk by JetBrains.
the class XIconWindow method setIconImage.
void setIconImage(Image img) {
if (img == null) {
//if image is null, reset to default image
replaceImage(null);
replaceMask(null);
} else {
//get image size
int width;
int height;
if (img instanceof ToolkitImage) {
ImageRepresentation ir = ((ToolkitImage) img).getImageRep();
ir.reconstruct(ImageObserver.ALLBITS);
width = ir.getWidth();
height = ir.getHeight();
} else {
width = img.getWidth(null);
height = img.getHeight(null);
}
Dimension iconSize = getIconSize(width, height);
if (iconSize != null) {
if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Icon size: {0}", iconSize);
}
iconWidth = iconSize.width;
iconHeight = iconSize.height;
} else {
log.finest("Error calculating image size");
iconWidth = 0;
iconHeight = 0;
}
replaceImage(img);
replaceMask(img);
}
//create icon window and set XWMHints
XToolkit.awtLock();
try {
AwtGraphicsConfigData adata = parent.getGraphicsConfigurationData();
awtImageData awtImage = adata.get_awtImage(0);
XVisualInfo visInfo = adata.get_awt_visInfo();
XWMHints hints = parent.getWMHints();
window = hints.get_icon_window();
if (window == 0) {
log.finest("Icon window wasn't set");
XCreateWindowParams params = getDelayedParams();
params.add(BORDER_PIXEL, Long.valueOf(XToolkit.getAwtDefaultFg()));
params.add(BACKGROUND_PIXMAP, iconPixmap);
params.add(COLORMAP, adata.get_awt_cmap());
params.add(DEPTH, awtImage.get_Depth());
params.add(VISUAL_CLASS, (int) XConstants.InputOutput);
params.add(VISUAL, visInfo.get_visual());
params.add(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWColormap | XConstants.CWBackPixmap);
params.add(PARENT_WINDOW, XlibWrapper.RootWindow(XToolkit.getDisplay(), visInfo.get_screen()));
params.add(BOUNDS, new Rectangle(0, 0, iconWidth, iconHeight));
params.remove(DELAYED);
init(params);
if (getWindow() == 0) {
log.finest("Can't create new icon window");
} else {
log.finest("Created new icon window");
}
}
if (getWindow() != 0) {
XlibWrapper.XSetWindowBackgroundPixmap(XToolkit.getDisplay(), getWindow(), iconPixmap);
XlibWrapper.XClearWindow(XToolkit.getDisplay(), getWindow());
}
// Provide both pixmap and window, WM or Taskbar will use the one they find more appropriate
long newFlags = hints.get_flags() | XUtilConstants.IconPixmapHint | XUtilConstants.IconMaskHint;
if (getWindow() != 0) {
newFlags |= XUtilConstants.IconWindowHint;
}
hints.set_flags(newFlags);
hints.set_icon_pixmap(iconPixmap);
hints.set_icon_mask(iconMask);
hints.set_icon_window(getWindow());
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), parent.getShell(), hints.pData);
log.finest("Set icon window hint");
} finally {
XToolkit.awtUnlock();
}
}
Aggregations