Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.swt.graphics
Class Pattern

java.lang.Object
  extended by 

org.eclipse.swt.graphics.Resource
      extended by 
org.eclipse.swt.graphics.Pattern

public class Pattern
extends Resource

Instances of this class represent patterns to use while drawing. Patterns can be specified either as bitmaps or gradients.

Application code must explicitly invoke the Pattern.dispose() method to release the operating system resources managed by each instance when those instances are no longer required.

This class requires the operating system's advanced graphics subsystem which may not be available on some platforms.

Since:
3.1
See Also:
Path, Pattern snippets, SWT Example: GraphicsExample, Sample code and further information

Field Summary
 int handle
          the OS resource for the Pattern (Warning: This field is platform dependent) IMPORTANT: This field is not part of the SWT public API.
 
Constructor Summary
Pattern ( Device device, float x1, float y1, float x2, float y2, Color color1, Color color2)
          Constructs a new Pattern that represents a linear, two color gradient.
Pattern ( Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2)
          Constructs a new Pattern that represents a linear, two color gradient.
Pattern ( Device device, Image image)
          Constructs a new Pattern given an image.
 
Method Summary
 boolean isDisposed ()
          Returns true if the Pattern has been disposed, and false otherwise.
  String toString ()
          Returns a string containing a concise, human-readable description of the receiver.
 
Methods inherited from class org.eclipse.swt.graphics. Resource
dispose, getDevice
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

handle

public int handle
the OS resource for the Pattern (Warning: This field is platform dependent)

IMPORTANT: This field is not part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code.

Constructor Detail

Pattern

public Pattern(
Device device,
               
Image image)
Constructs a new Pattern given an image. Drawing with the resulting pattern will cause the image to be tiled over the resulting area.

This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.

Parameters:
device - the device on which to allocate the pattern
image - the image that the pattern will draw
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the device is null and there is no current device, or the image is null
  • ERROR_INVALID_ARGUMENT - if the image has been disposed
SWTException -
  • ERROR_NO_GRAPHICS_LIBRARY - if advanced graphics are not available
SWTError -
  • ERROR_NO_HANDLES if a handle for the pattern could not be obtained
See Also:
Resource.dispose()

Pattern

public Pattern(
Device device,
               float x1,
               float y1,
               float x2,
               float y2,
               
Color color1,
               
Color color2)
Constructs a new Pattern that represents a linear, two color gradient. Drawing with the pattern will cause the resulting area to be tiled with the gradient specified by the arguments.

This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.

Parameters:
device - the device on which to allocate the pattern
x1 - the x coordinate of the starting corner of the gradient
y1 - the y coordinate of the starting corner of the gradient
x2 - the x coordinate of the ending corner of the gradient
y2 - the y coordinate of the ending corner of the gradient
color1 - the starting color of the gradient
color2 - the ending color of the gradient
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the device is null and there is no current device, or if either color1 or color2 is null
  • ERROR_INVALID_ARGUMENT - if either color1 or color2 has been disposed
SWTException -
  • ERROR_NO_GRAPHICS_LIBRARY - if advanced graphics are not available
SWTError -
  • ERROR_NO_HANDLES if a handle for the pattern could not be obtained
See Also:
Resource.dispose()

Pattern

public Pattern(
Device device,
               float x1,
               float y1,
               float x2,
               float y2,
               
Color color1,
               int alpha1,
               
Color color2,
               int alpha2)
Constructs a new Pattern that represents a linear, two color gradient. Drawing with the pattern will cause the resulting area to be tiled with the gradient specified by the arguments.

This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.

Parameters:
device - the device on which to allocate the pattern
x1 - the x coordinate of the starting corner of the gradient
y1 - the y coordinate of the starting corner of the gradient
x2 - the x coordinate of the ending corner of the gradient
y2 - the y coordinate of the ending corner of the gradient
color1 - the starting color of the gradient
alpha1 - the starting alpha value of the gradient
color2 - the ending color of the gradient
alpha2 - the ending alpha value of the gradient
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the device is null and there is no current device, or if either color1 or color2 is null
  • ERROR_INVALID_ARGUMENT - if either color1 or color2 has been disposed
SWTException -
  • ERROR_NO_GRAPHICS_LIBRARY - if advanced graphics are not available
SWTError -
  • ERROR_NO_HANDLES if a handle for the pattern could not be obtained
Since:
3.2
See Also:
Resource.dispose()
Method Detail

isDisposed

public boolean isDisposed()
Returns true if the Pattern has been disposed, and false otherwise.

This method gets the dispose state for the Pattern. When a Pattern has been disposed, it is an error to invoke any other method using the Pattern.

Specified by:
isDisposed in class Resource
Returns:
true when the Pattern is disposed, and false otherwise

toString

public 
String toString()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a string representation of the receiver

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire