-
Enhancement
-
Resolution: Fixed
-
P3
-
1.0, 1.1, 1.1.3, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 5.0, 6, 6u4, 6u10
-
b12
-
generic, x86, sparc
-
generic, linux, solaris_2.4, windows_95, windows_2000, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2172125 | 7 | Artem Ananiev | P4 | Closed | Fixed | b55 |
package com.sun.awt;
/**
* <b>WARNING</b>: This class is an implementation detail and only meant
* for use within the core platform. You should NOT depend upon it! This
* API may change drastically between dot dot release, and it may even be
* removed.
*/
public final class AWTUtilities {
/**
* The AWTUtilities class should not be instantiated
*/
private AWTUtilities() {
}
public static enum Translucency {
/**
* Represents image data that is guaranteed to be completely opaque,
* meaning that all pixels have an alpha value of 1.0.
*/
OPAQUE,
/**
* Represents image data each pixel of which is guaranteed to be either
* completely opaque, with an alpha value of 1.0, or completely transparent,
* with an alpha value of 0.0.
*/
PERPIXEL_OPAQUE,
/**
* Represents image data all of the pixels of which have the same alpha value
* between or including 0.0 and 1.0.
*/
TRANSLUCENT,
/**
* Represents image data that contains or might contain pixels with arbitrary
* alpha values between and including 0.0 and 1.0.
*/
PERPIXEL_TRANSLUCENT;
}
/**
* Returns whether the given level of translucency is supported by
* the current configuration.
*
* The translucencyKind argument is one of the OPAQUE, PERPIXEL_OPAQUE,
* TRANSLUCENT, or PERPIXEL_TRANSLUCENT constants. Passing any other value
* (or any bitwise combination of the constants) results in
* return value of false.
*
* The level of support depends on the capabilities of the native system.
*
* Note that this method may sometimes return the value
* indicating that the particular level is supported, but
* the native windowing system may still not support the
* given level of translucency (due to the bugs in
* the windowing system).
*
* @param translucencyKind a kind of translucency support
* (either OPAQUE, PERPIXEL_OPAQUE,
* TRANSLUCENT, or PERPIXEL_TRANSLUCENT)
* @return whether the given translucency kind is supported
* @throws IllegalArgumentException if the translucencyKind argument is not one of the defined constants.
*/
public static boolean isTranslucencySupported(Translucency translucencyKind);
/**
* Set the opacity of the window. The opacity is at the range [0..1].
* Note that setting the opacity level of 0 may or may not disable
* the mouse event handling on this window. This is
* a platform-dependent behavior.
*
* In order for this method to enable the translucency effect,
* the isTranslucencySupported() method should indicate that the
* TRANSLUCENT level of translucency is supported.
*
* @param window the window to set the opacity level to
* @param opacity the opacity level to set to the window
* @throws NullPointerException if the window argument is null
* @throws IllegalArgumentException if the opacity is out of the range [0..1]
* @throws UnsupportedOperationException if the TRANSLUCENT translucency kind is not supported
*/
public static void setWindowOpacity(Window window, float opacity);
/**
* Get the opacity of the window. If the opacity has not
* yet being set, this method returns 1.0.
*
* @param window the window to get the opacity level from
* @throws NullPointerException if the window argument is null
*/
public static float getWindowOpacity(Window window);
/**
* Returns the object implementing the Shape interface previously
* set with the call to the setWindowShape() method.
* If no shape has been set yet, this method returns null.
* @param window the window to get the shape from
* @throws NullPointerException if the window argument is null
*/
public static Shape getWindowShape(Window window);
/**
* Sets a shape object for the given window.
* If the shape argument is null, this methods restores
* the default shape making the window rectangular.
* Note that in order to set a shape, the window must be undecorated.
* @param window the window to set the shape to
* @param shape the shape to set to the window
* @throws NullPointerException if the window argument is null
* @throws UnsupportedOperationException if the PERPIXEL_OPAQUE translucency kind is not supported
*/
public static void setWindowShape(Window window, Shape shape);
/**
* Enables the per-pixel alpha support for the given window.
* Once the window becomes non-opaque (the isOpaque is set to false),
* the drawing sub-system is starting to respect the alpha value of each
* separate pixel. If a pixel gets painted with alpha color component
* equal to zero, it becomes visually transparent, if the alpha of the
* pixel is equal to 255, the pixel is fully opaque. Interim values
* of the alpha color component make the pixel semi-transparent (i.e.
* translucent).
* <p>Note that in order for the window to support the per-pixel alpha
* mode, the window must be created using the GraphicsConfiguration
* obtained with the {@link getTranslucencyCompatibleGraphicsConfiguration}
* method.
* <p>Also note that some native systems enable the per-pixel translucency
* mode for any window created using the translucency-compatible
* graphics configuration. However, it is highly recommended to always
* invoke the setWindowOpaque() method for these windows, at least for the sake of
* cross-platform compatibility reasons.
*
* @param window the window to set the shape to
* @param isOpaque whether the window must be opaque (true), or translucent (false)
* @throws NullPointerException if the window argument is null
* @throws IllegalArgumentException if the window uses a GraphicsConfiguration other than returned by the getTranslucencyCompatibleGraphicsConfiguration() method.
* @throws UnsupportedOperationException if the PERPIXEL_TRANSLUCENT translucency kind is not supported
*/
public static void setWindowOpaque(Window window, boolean isOpaque);
/**
* Returns whether the window is opaque or translucent.
*
* @param window the window to set the shape to
* @return whether the window is currently opaque (true) or translucent (false)
* @throws NullPointerException if the window argument is null
*/
public static boolean isWindowOpaque(Window window);
/**
* Returns a GraphicsConfigurations that are capable of displaying translucent windows.
* All windows that are intended to be used with setWindowOpaque() method
* must be created using one of the GraphicsConfiguration returned with this method.
* <p>Note that some native systems enable the per-pixel translucency
* mode for any window created using the translucency-compatible
* graphics configuration. However, it is highly recommended to always
* invoke the setWindowOpaque() method for these windows, at least for the sake of
* cross-platform compatibility reasons.
*
* @return a GraphicsConfiguration capable of displaying translucent windows.
*/
public static Set<GraphicsConfiguration> getTranslucencyCompatibleGraphicsConfigurations();
}
- backported by
-
JDK-2172125 Need to support shaped/translucent windows
- Closed
- duplicates
-
JDK-4735828 1.4 REGRESSION: Swing Transparency Problem-user defined ColorUIResource getRGB()
- Closed
-
JDK-6594127 Provide a non-public API to support shaped windows
- Closed
-
JDK-6594131 Provide a non-public API to support translucent windows
- Closed
-
JDK-4479178 RFE: Support for Transparent windows required
- Closed
-
JDK-5062995 AWT needs to support Shaped windows and components.
- Closed
- relates to
-
JDK-6648996 Frame.printAll() invoked on a non-opaque window prints black background
- Resolved
-
JDK-6702458 6u10 support for translucent windows doesn't check for XRENDER extension before using it.
- Resolved
-
JDK-6661319 PIT: Setting background color on top levels do not work
- Closed
-
JDK-6661484 FullScreen tests failing with NullPointer Exception in 6u10b12 PIT
- Closed
-
JDK-6661455 Toplevel windows are not curve like native in windows
- Closed
-
JDK-6687141 perpixel translucent windows are not hw-accelerated, updates are slow on Windows
- Closed
-
JDK-6800023 API for window's graphics configuration changes
- Open
-
JDK-6802853 API: shaped & translucent windows
- Closed
-
JDK-6656412 Uninitialized libXrender.so crashes AWT
- Resolved
-
JDK-6662532 Descendants of JWindow/JFrame/JDialog can not be made translucent
- Resolved
-
JDK-6680240 Two regression testcases fails from 1.6.0_10 b12 onwards
- Resolved
-
JDK-6725365 Per-pixel transparency must only be available for undecorated frames/windows
- Resolved
-
JDK-6655001 D3D/OGL: Window translucency doesn't work with accelerated pipelines
- Closed
-
JDK-6661657 shape doesn't work with nonOpaque in Vista
- Closed
-
JDK-6722162 Translucent frame is printed as Opaque
- Closed
-
JDK-6797195 Forward-port enhancements for hw/lw mixing from 6u12 to 7
- Closed
-
JDK-2151902 Enhance Region object to perform pixel-oriented CAG operations
- Resolved
-
JDK-2151903 need a mechanism to create a Region from a Shape
- Resolved
-
JDK-6646289 Add proper z-order support to new Java Plug-In
- Closed
-
JDK-2177803 Printing of AWT components on windows is not working
- Closed