Class Device
public class Device
{
// Fields
public static final int BLTALIGNMENT;
public final static int CC_CHORD;
public final static int CC_CIRCLES;
public final static int CC_ELLIPSES;
public final static int CC_INTERIORS;
public final static int CC_NONE;
public final static int CC_PIE;
public final static int CC_ROUNDRECT;
public final static int CC_STYLED;
public final static int CC_WIDE;
public final static int CC_WIDESTYLED;
public final static int CP_NONE;
public final static int CP_RECTANGLE;
public final static int CP_REGION;
public static final int DESKTOPHORZRES;
public static final int DESKTOPVERTRES;
public final static int DT_CHARSTREAM;
public final static int DT_DISPFILE;
public final static int DT_METAFILE;
public final static int DT_PLOTTER;
public final static int DT_RASCAMERA;
public final static int DT_RASDISPLAY;
public final static int DT_RASPRINTER;
public final static int LC_INTERIORS;
public final static int LC_MARKER;
public final static int LC_NONE;
public final static int LC_POLYLINE;
public final static int LC_POLYMARKER;
public final static int LC_STYLED;
public final static int LC_WIDE;
public final static int LC_WIDESTYLED;
public final static int PC_INTERIORS;
public final static int PC_NONE;
public final static int PC_PATHS;
public final static int PC_POLYGON;
public final static int PC_POLYPOLYGON;
public final static int PC_RECTANGLE;
public final static int PC_SCANLINE;
public final static int PC_STYLED;
public final static int PC_TRAPEZOID;
public final static int PC_WIDE;
public final static int PC_WIDESTYLED;
public final static int PC_WINDPOLYGON;
public final static int RC_BANDING;
public final static int RC_BIGFONT;
public final static int RC_BITBLT;
public final static int RC_BITMAP64;
public final static int RC_DEVBITS;
public final static int RC_DI_BITMAP;
public final static int RC_DIBTODEV;
public final static int RC_FLOODFILL;
public final static int RC_GDI20_OUTPUT;
public final static int RC_GDI20_STATE;
public final static int RC_NONE;
public final static int RC_OP_DX_OUTPUT;
public final static int RC_PALETTE;
public final static int RC_SAVEBITMAP;
public final static int RC_SCALING;
public final static int RC_STRETCHBLT;
public final static int RC_STRETCHDIB;
public final static int TC_CP_STROKE;
public final static int TC_CR_90;
public final static int TC_CR_ANY;
public final static int TC_EA_DOUBLE;
public final static int TC_IA_ABLE;
public final static int TC_OP_CHARACTER;
public final static int TC_OP_STROKE;
public final static int TC_RA_ABLE;
public final static int TC_RESERVED;
public final static int TC_SA_CONTIN;
public final static int TC_SA_DOUBLE;
public final static int TC_SA_INTEGER;
public final static int TC_SCROLLBLT;
public final static int TC_SF_X_YINDEP;
public final static int TC_SO_ABLE;
public final static int TC_UA_ABLE;
public final static int TC_VA_ABLE;
public static final int VREFRESH;
// Constructors
protected Device();
// Methods
public Dimension getAspectRatio();
public int getAspectRatioXY();
public void getBasics(int hdc) throws DeviceException;
public int getBitsPerPixel();
public int getClipCapabilities();
public int getColorResolution();
public int getCurveCapabilities();
public final static Device getDeviceFromGraphics(
Graphics g) throws DeviceException;
public Dimension getDeviceSize();
protected int getDisplayContext(Graphics g)
throws DeviceException;
public int getDriverVersion();
public int getLineCapabilities();
public Dimension getLogicalPixelsPerInch();
public int getNumberOfBrushes();
public int getNumberOfColors();
public int getNumberOfFonts();
public int getNumberOfMarkers();
public int getNumberOfPens();
public int getPaletteReserved();
public int getPaletteSize();
public Dimension getPixelRes();
public int getPlanes();
public int getPolygonCapabilities();
public int getRasterCapabilities();
public int getTechnology();
public int getTextCapabilities();
}
This class manages information associated with a generic device.
The DisplayDevice and PrinterDevice classes are derived from the Device class.
protected Device();
A constructor for the abstract class.
public Dimension getAspectRatio();
Retrieves the device aspect ratio.
Return Value:
Returns a Dimension that defines the device aspect ratio.
public int getAspectRatioXY();
public void getBasics(int hdc) throws DeviceException;
Retrieves the basic information set (common to all devices types) from the native system. The information set includes the driver version, pixel resolution, curve, line, polygon, and raster capabilities, color resolution, logical pixels per inch, and so on.
Return Value:
No return value.
Parameter | Description |
hdc
| The device context.
|
Exceptions:
com.ms.awt.DeviceException
public int getBitsPerPixel();
Retrieves the device number of bits per pixel.
Return Value:
Returns the bits per pixel.
public int getClipCapabilities();
Retrieves the clipping capabilities of the device.
Return Value:
Returns one of the clipping capabilities flags as shown in the following table.
public int getColorResolution();
Retrieves a device's color resolution.
Return Value:
Returns the color resolution.
public int getCurveCapabilities();
Retrieves the curve capabilities of the device.
Return Value:
Returns one or a combination of the following curve capabilities flags:
public final static Device getDeviceFromGraphics(Graphics g)
throws DeviceException;
Retrieves a device, given a graphics context. The device created is an instance of the DisplayDevice or the PrinterDevice class.
Parameter | Description |
g
| An extended graphics context, either an FxGraphics or a GraphicsX object.
|
Exceptions:
com.ms.awt.DeviceException
if the graphics context is not valid.
public Dimension getDeviceSize();
Retrieves the physical device size as a Dimension.
Return Value:
Returns a Dimension that defines the physical size of the device.
protected int getDisplayContext(Graphics g) throws DeviceException;
Retrieves a display context usable on the device. If the display device is something other than a monitor (a printer, for example), the device context is obtained from the native peer object.
Return Value:
Returns zero if the device is the screen; otherwise, returns the handle of the device context.
Parameter | Description |
g
| The Graphics object to get the context for.
|
Exceptions:
com.ms.awt.DeviceException
if the graphics context is not an instance of the FxGraphics or GraphicsX graphics classes.
public int getDriverVersion();
Retrieves the device driver version number.
Return Value:
Returns the driver version.
public int getLineCapabilities();
Retrieves the line capabilities of the device.
Return Value:
Returns one or a combination of the following line capabilities flags:
public Dimension getLogicalPixelsPerInch();
Retrieves a device's logical pixels per inch.
Return Value:
Returns a device's logical pixels per inch.
public int getNumberOfBrushes();
Retrieves the number of brushes used by the device.
Return Value:
Returns the number of brushes.
public int getNumberOfColors();
Retrieves the number of colors used by the device.
Return Value:
Returns the number of colors.
public int getNumberOfFonts();
Retrieves the number of fonts used by the device.
Return Value:
Returns the number of fonts.
public int getNumberOfMarkers();
Retrieves the number of markers used by the device.
Return Value:
Returns the number of markers.
public int getNumberOfPens();
Retrieves the number of pens used by the device.
Return Value:
Returns the number of pens.
public int getPaletteReserved();
Retrieves a reserved device palette.
Return Value:
Returns the reserved palette.
public int getPaletteSize();
Retrieves a device palette size.
Return Value:
Returns the size of the palette.
public Dimension getPixelRes();
Retrieves the device's pixel resolution (in pixels per inch).
Return Value:
Returns the pixel resolution.
public int getPlanes();
Retrieves the number of planes used by the device.
Return Value:
Returns the number of planes.
public int getPolygonCapabilities();
Retrieves the polygon capabilities of the device.
Return Value:
Returns one or a combination of the polygon capabilities flags shown in the following table.
public int getRasterCapabilities();
Retrieves the device raster capabilities.
Return Value:
Returns one or a combination of the raster capabilities flags shown in the following table.
public int getTechnology();
Retrieves the device technology.
Return Value:
Returns one of the following device technology flags:
public int getTextCapabilities();
Retrieves the text capabilities of the device.
Return Value:
Returns one or a combination of the text capabilities flags shown in the following table.
- BLTALIGNMENT
- The preferred blit alignment.
- CC_CHORD
- A curve capabilities flag that indicates chord arcs are supported.
- CC_CIRCLES
- A curve capabilities flag that indicates circles are supported.
- CC_ELLIPSES
- A curve capabilities flag that indicates ellipses are supported.
- CC_INTERIORS
- A curve capabilities flag that indicates interiors are supported.
- CC_NONE
- A curve capabilities flag that indicates curves are not supported.
- CC_PIE
- A curve capabilities flag that indicates pie wedge shapes are supported.
- CC_ROUNDRECT
- A curve capabilities flag that indicates rounded rectangles are supported.
- CC_STYLED
- A curve capabilities flag that indicates styled lines are supported.
- CC_WIDE
- A curve capabilities flag that indicates wide lines are supported.
- CC_WIDESTYLED
- A curve capabilities flag that indicates wide styled lines are supported.
- CP_NONE
- A clipping capabilities flag that indicates clipping of output is not supported.
- CP_RECTANGLE
- A clipping capabilities flag that indicates output is clipped to rectangles.
- CP_REGION
- A clipping capabilities flag that indicates output is clipped to Regions.
- DESKTOPHORZRES
- The desktop's horizontal resolution.
- DESKTOPVERTRES
- The desktop's vertical resolution.
- DT_CHARSTREAM
- The device technology flag for a character stream.
- DT_DISPFILE
- The device technology flag for a display file.
- DT_METAFILE
- The device technology flag for a metafile.
- DT_PLOTTER
- The device technology flag for a vector plotter (typically used in CAD).
- DT_RASCAMERA
- The device technology flag for a raster camera.
- DT_RASDISPLAY
- The device technology flag for a raster display.
- DT_RASPRINTER
- The device technology flag for a raster printer.
- LC_INTERIORS
- A line capabilities flag that indicates interiors are supported.
- LC_MARKER
- A line capabilities flag that indicates marker lines are supported.
- LC_NONE
- A line capabilities flag that indicates lines are not supported.
- LC_POLYLINE
- A line capabilities flag that indicates polylines are supported.
- LC_POLYMARKER
- A line capabilities flag that indicates polylinemarkers are supported.
- LC_STYLED
- A line capabilities flag that indicates styled lines are supported.
- LC_WIDE
- A line capabilities flag that indicates wide lines are supported.
- LC_WIDESTYLED
- A line capabilities flag that indicates wide styled lines are supported.
- PC_INTERIORS
- A polygonal capabilities flag that indicates interiors are supported.
- PC_NONE
- A polygonal capabilities flag that indicates polygonals are not supported.
- PC_PATHS
- A polygonal capabilities flag that indicates paths are supported.
- PC_POLYGON
- A polygonal capabilities flag that indicates polygons are supported.
- PC_POLYPOLYGON
- A polygonal capabilities flag that indicates poly-polygons are supported.
- PC_RECTANGLE
- A polygonal capabilities flag that indicates rectangles are supported.
- PC_SCANLINE
- A polygonal capabilities flag that indicates scan lines are supported.
- PC_STYLED
- A polygonal capabilities flag that indicates styled borders are supported.
- PC_TRAPEZOID
- A polygonal capabilities flag that indicates trapezoids are supported.
- PC_WIDE
- A polygonal capabilities flag that indicates wide borders are supported.
- PC_WIDESTYLED
- A polygonal capabilities flag that indicates wide styled borders are supported.
- PC_WINDPOLYGON
- A polygonal capabilities flag that indicates winding polygonals are supported.
- RC_BANDING
- A raster capabilities flag that indicates the device requires banding support.
- RC_BIGFONT
- A raster capabilities flag that indicates the device supports fonts greater than 64K.
- RC_BITBLT
- A raster capabilities flag that indicates the device can transfer bitmaps.
- RC_BITMAP64
- A raster capabilities flag that indicates the device can support bitmaps larger than 64K.
- RC_DEVBITS
- A raster capabilities flag that indicates the device supports device bitmaps.
- RC_DI_BITMAP
- A raster capabilities flag that indicates the device supports setDIBits and getDIBits Windows functions.
- RC_DIBTODEV
- A raster capabilities flag that indicates the device supports the SetDIBitsToDevice and getDIBitsToDevice Windows function.
- RC_FLOODFILL
- A raster capabilities flag that indicates the device supports flood fill operations.
- RC_GDI20_OUTPUT
- A raster capabilities flag that indicates the device supports Windows version 2.0 features.
- RC_GDI20_STATE
- A raster capabilities flag that indicates the device includes a state block in the device context.
- RC_NONE
- A raster capabilities flag that indicates the device has no raster capabilities.
- RC_OP_DX_OUTPUT
- A raster capabilities flag that indicates the device supports device opaque and dx arrays.
- RC_PALETTE
- A raster capabilities flag that specifies a palette-based device.
- RC_SAVEBITMAP
- A raster capabilities flag that indicates the device can save bitmaps locally.
- RC_SCALING
- A raster capabilities flag that indicates the device supports scaling.
- RC_STRETCHBLT
- A raster capabilities flag that indicates the device supports StretchBlt operations.
- RC_STRETCHDIB
- A raster capabilities flag that indicates the device supports the StretchDIBits Windows function.
- TC_CP_STROKE
- A text capabilities flag that indicates the device can clip device fonts to a pixel boundary.
- TC_CR_90
- A text capabilities flag that indicates 90-degree character rotation is supported. Fonts are rotated only 90 degrees at a time.
- TC_CR_ANY
- A text capabilities flag that indicates any degree character rotation is supported.
- TC_EA_DOUBLE
- A text capabilities flag that indicates the device can make device fonts bold. If this bit is not set for printer drivers, the GDI (graphics device interface) attempts to create bold device fonts by printing them twice.
- TC_IA_ABLE
- A text capabilities flag that indicates the device can make device fonts italic. If this bit is not set, the GDI assumes that italics are not available.
- TC_OP_CHARACTER
- A text capabilities flag that indicates the device can place device fonts at any pixel location. This is required for any device with device fonts.
- TC_OP_STROKE
- A text capabilities flag that indicates the device can omit any stroke of a device font.
- TC_RA_ABLE
- A text capabilities flag that indicates that the GDI should enumerate any raster or TrueType fonts that are available for this device in response to a call to the EnumFonts or EnumFontFamilies Microsoft® Windows® functions. If this bit is not set, GDI-supplied raster or TrueType fonts are not enumerated when these functions are called.
- TC_RESERVED
- A reserved text capabilities flag.
- TC_SA_CONTIN
- A text capabilities flag that indicates the device can scale device fonts by any amount, but still preserve the x and y ratios.
- TC_SA_DOUBLE
- A text capabilities flag that indicates can double the size of device fonts.
- TC_SA_INTEGER
- A text capabilities flag that the device can scale device fonts in any integer multiple.
- TC_SCROLLBLT
- A text capabilities flag that indicates text scrolling is not performed with blitting operations.
- TC_SF_X_YINDEP
- A text capabilities flag that indicates the device can scale device fonts separately in x and y directions.
- TC_SO_ABLE
- A text capabilities flag that indicates the device can strikeout device fonts. If this bit is not set, GDI creates strikethroughs for device fonts.
- TC_UA_ABLE
- A text capabilities flag that indicates the device can underline device fonts. If this bit is not set, the GDI creates underlines for device fonts.
- TC_VA_ABLE
- A text capabilities flag that indicates that GDI should enumerate any vector fonts available for this device in response to a call to the EnumFonts or EnumFontFamilies Windows functions. This is significant for vector devices only (that is, for plotters). Display drivers (which must be able to use raster fonts) and raster printer drivers always enumerate vector fonts, because GDI rasterizes vector fonts before sending them to the driver.
- VREFRESH
- The current vertical refresh rate of the display device.