public class SWTGraphicUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addDisposer(org.eclipse.swt.widgets.Widget widget,
org.eclipse.swt.graphics.Resource resource)
Dispose safely any SWT resource when a widget is disposed
|
static void |
applyHTMLFormating(org.eclipse.swt.custom.StyledText styledText)
Apply a very basic pseudo-HTML formating to a text stored in a StyledText
widget.
|
static org.eclipse.swt.graphics.ImageData |
blur(org.eclipse.swt.graphics.ImageData originalImageData,
int radius) |
static org.eclipse.swt.graphics.Font |
buildFontFrom(org.eclipse.swt.widgets.Control control,
int style)
Build a font from a given control.
|
static org.eclipse.swt.graphics.Font |
buildFontFrom(org.eclipse.swt.widgets.Control control,
int style,
int size)
Build a font from a given control.
|
static void |
centerShell(org.eclipse.swt.widgets.Shell shell)
Center a shell on the primary monitor
|
static int |
computeWidth(java.lang.String text) |
static org.eclipse.swt.graphics.Image |
createImageFromFile(java.lang.String fileName)
Loads an image and create a SWT Image corresponding to this file
|
static org.eclipse.swt.graphics.Image |
createReflectedImage(org.eclipse.swt.graphics.Image source)
Create a reflected image of a source Inspired by Daniel Spiewak work
(http://www.eclipsezone.com/eclipse/forums/t91013.html)
|
static org.eclipse.swt.graphics.Image |
createReflectedResizedImage(org.eclipse.swt.graphics.Image source,
int newWidth,
int newHeight)
Create a reflected and resized version of an image
|
static void |
disableAllChildrenWidgets(org.eclipse.swt.widgets.Control control)
Disable all widgets of a control
|
static void |
enableAllChildrenWidgets(org.eclipse.swt.widgets.Control control)
Enable all widgets of a control
|
static org.eclipse.swt.graphics.Rectangle |
getBoundsOfMonitorOnWhichShellIsDisplayed(org.eclipse.swt.widgets.Shell shell) |
static org.eclipse.swt.graphics.Color |
getColorSafely(int r,
int g,
int b)
Create a color that is disposed automatically
|
static org.eclipse.swt.graphics.Color |
getDefaultColor(org.eclipse.swt.widgets.Control control,
int red,
int green,
int blue) |
static boolean |
isMacOS() |
static org.eclipse.swt.graphics.Image |
resize(org.eclipse.swt.graphics.Image source,
int newWidth,
int newHeight)
Returns a new scaled image.
|
static void |
safeDispose(org.eclipse.swt.graphics.Resource resource)
Dispose safely any SWT resource
|
public static void addDisposer(org.eclipse.swt.widgets.Widget widget, org.eclipse.swt.graphics.Resource resource)
widget
- widget attached to the resourceresource
- the resource to disposepublic static void safeDispose(org.eclipse.swt.graphics.Resource resource)
resource
- the resource to disposepublic static org.eclipse.swt.graphics.Color getColorSafely(int r, int g, int b)
r
- red componentg
- green componentb
- blue componentpublic static org.eclipse.swt.graphics.Image createImageFromFile(java.lang.String fileName)
fileName
- file name of the imageImage
public static org.eclipse.swt.graphics.Image createReflectedImage(org.eclipse.swt.graphics.Image source)
source
- source to be reflectedpublic static org.eclipse.swt.graphics.Image resize(org.eclipse.swt.graphics.Image source, int newWidth, int newHeight)
source
- the image to be scalednewWidth
- new width of the imagenewHeight
- new height of the imagepublic static org.eclipse.swt.graphics.Image createReflectedResizedImage(org.eclipse.swt.graphics.Image source, int newWidth, int newHeight)
source
- source image to be scaled and reflectednewWidth
- new width of the scaled imagenewHeight
- new height of the scaled imagepublic static void centerShell(org.eclipse.swt.widgets.Shell shell)
shell
- shell to centerpublic static org.eclipse.swt.graphics.Rectangle getBoundsOfMonitorOnWhichShellIsDisplayed(org.eclipse.swt.widgets.Shell shell)
shell
- public static void applyHTMLFormating(org.eclipse.swt.custom.StyledText styledText)
styledText
- styled text that contains an HTML textpublic static org.eclipse.swt.graphics.ImageData blur(org.eclipse.swt.graphics.ImageData originalImageData, int radius)
originalImageData
- The ImageData to be average blurred. Transparency
information will be ignored.radius
- the number of radius pixels to consider when blurring image.SimpleImageEffectsForSWT/index.html
public static void enableAllChildrenWidgets(org.eclipse.swt.widgets.Control control)
control
- control to enable/disableenable
- true
to enable, false
to disablepublic static void disableAllChildrenWidgets(org.eclipse.swt.widgets.Control control)
control
- control to enable/disableenable
- true
to enable, false
to disablepublic static org.eclipse.swt.graphics.Font buildFontFrom(org.eclipse.swt.widgets.Control control, int style)
control
- control that handle the default fontstyle
- new stylepublic static org.eclipse.swt.graphics.Font buildFontFrom(org.eclipse.swt.widgets.Control control, int style, int size)
control
- control that handle the default fontstyle
- new stylepublic static boolean isMacOS()
true
if the operating system is MacOS, false otherwisepublic static org.eclipse.swt.graphics.Color getDefaultColor(org.eclipse.swt.widgets.Control control, int red, int green, int blue)
control
- red
- green
- blue
- control
is disposedpublic static int computeWidth(java.lang.String text)
text
-