本文整理了Java中org.eclipse.swt.graphics.Device
类的一些代码示例,展示了Device
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device
类的具体详情如下:
包路径:org.eclipse.swt.graphics.Device
类名称:Device
[英]This class is the abstract superclass of all device objects, such as the Display device and the Printer device. Devices can have a graphics context (GC) created for them, and they can be drawn on by sending messages to the associated GC.
[中]此类是所有设备对象(如显示设备和打印机设备)的抽象超类。设备可以为它们创建一个图形上下文(GC),并且可以通过向相关GC发送消息来绘制它们。
代码示例来源:origin: pentaho/pentaho-kettle
public Point getDeviceBounds() {
org.eclipse.swt.graphics.Rectangle p = gc.getDevice().getBounds();
return new Point( p.width, p.height );
}
代码示例来源:origin: pentaho/pentaho-kettle
public static void setGCFont( GC gc, Device device, FontData fontData ) {
if ( Const.getOS().startsWith( "Windows" ) ) {
Font font = new Font( device, fontData );
gc.setFont( font );
font.dispose();
} else {
gc.setFont( device.getSystemFont() );
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Disposes of the operating system resources associated with
* the receiver. After this method has been invoked, the receiver
* will answer <code>true</code> when sent the message
* <code>isDisposed()</code>.
*
* @see #release
* @see #destroy
* @see #checkDevice
*/
public void dispose() {
synchronized( deviceLock ) {
if( !isDisposed() ) {
checkDevice();
release();
destroy();
disposed = true;
}
}
}
代码示例来源:origin: com.github.rinde/rinsim-example
UavRenderer(CollisionPlaneRoadModel r, Device d, ImmutableSet<Opts> opts) {
rm = r;
red = d.getSystemColor(SWT.COLOR_RED);
black = d.getSystemColor(SWT.COLOR_BLACK);
darkGray = d.getSystemColor(SWT.COLOR_GRAY);
labelFont = new Font(d, "arial", FONT_SIZE, SWT.NORMAL);
vizOptions = opts;
colorMap = new LinkedHashMap<>();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Disposes of the operating system resources associated with
* this resource. Applications must dispose of all resources
* which they allocate.
* This method does nothing if the resource is already disposed.
*/
public void dispose() {
if (device == null) return;
if (device.isDisposed()) return;
destroy();
if (device.tracking) device.dispose_Object(this);
device = null;
}
代码示例来源:origin: BiglySoftware/BiglyBT
for (int i = 0; i < systemColorNames.length; i++) {
String name = systemColorNames[i];
if (name.equals(u_value) && device != null && !device.isDisposed()) {
return device.getSystemColor(i + SYSTEMCOLOR_INDEXSTART);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns the bit depth of the screen, which is the number of
* bits it takes to represent the number of unique colors that
* the screen is currently capable of displaying. This number
* will typically be one of 1, 8, 15, 16, 24 or 32.
*
* @return the depth of the screen
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public int getDepth () {
checkDevice ();
return 0;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
DeviceGC( Device device ) {
this.device = device;
this.background = device.getSystemColor( SWT.COLOR_WHITE );
this.foreground = device.getSystemColor( SWT.COLOR_BLACK );
this.font = device.getSystemFont();
this.alpha = 255;
this.lineWidth = 0;
this.lineCap = SWT.CAP_FLAT;
this.lineJoin = SWT.JOIN_MITER;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Returns a point whose x coordinate is the horizontal
* dots per inch of the display, and whose y coordinate
* is the vertical dots per inch of the display.
*
* @return the horizontal and vertical DPI
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public Point getDPI () {
checkDevice ();
return getScreenDPI();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
this.dpi = getDPI();
this.scaleFactor = getDeviceZoom ();
DPIUtil.setDeviceZoom (scaleFactor);
Point dpi = getDPI(), screenDPI = getScreenDPI();
if (dpi.y != screenDPI.y) {
int size = OS.pango_font_description_get_size(defaultFont);
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Returns a rectangle which describes the area of the receiver which is
* capable of displaying data.
*
* @return the client area
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
* @see #getBounds
* @since 1.2
*/
public Rectangle getClientArea() {
checkDevice();
return getBounds();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Releases any internal state prior to destroying this printer.
* This method is called internally by the dispose
* mechanism of the <code>Device</code> class.
*/
@Override
protected void release() {
super.release();
data = null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns a rectangle describing the receiver's size and location.
*
* @return the bounding rectangle
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public Rectangle getBounds() {
checkDevice ();
return DPIUtil.autoScaleDown(getBoundsInPixels());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns a point whose x coordinate is the horizontal
* dots per inch of the display, and whose y coordinate
* is the vertical dots per inch of the display.
*
* @return the horizontal and vertical DPI
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public Point getDPI () {
checkDevice ();
int /*long*/ hDC = internal_new_GC (null);
int dpiX = OS.GetDeviceCaps (hDC, OS.LOGPIXELSX);
int dpiY = OS.GetDeviceCaps (hDC, OS.LOGPIXELSY);
internal_dispose_GC (hDC, null);
return DPIUtil.autoScaleDown(new Point (dpiX, dpiY));
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Returns the bit depth of the screen, which is the number of
* bits it takes to represent the number of unique colors that
* the screen is currently capable of displaying. This number
* will typically be one of 1, 8, 15, 16, 24 or 32.
*
* @return the depth of the screen
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public int getDepth () {
checkDevice ();
return (int)/*64*/OS.NSBitsPerPixelFromDepth(getPrimaryScreen().depth());
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
Point getIndependentDPI() {
return super.getDPI();
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
Point dpi = this.dpi = getDPI(), screenDPI = getScreenDPI();
NSFont font = NSFont.systemFontOfSize(systemFontSize * dpi.y / screenDPI.y);
font.retain();
代码示例来源:origin: org.xworker/xworker_swt
if(registor.resource.isDisposed() || registor.resource.getDevice().isDisposed()){
resources.put(path, null);
}else{
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
systemFont = getSystemFont();
int /*long*/ hDC = internal_new_GC (null);
int rc = OS.GetDeviceCaps (hDC, OS.RASTERCAPS);
int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
internal_dispose_GC (hDC, null);
return;
colorRefCount [numEntries - 1 - i] = 1;
internal_dispose_GC (hDC, null);
hPalette = OS.CreatePalette (logPalette);
代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer
private void init() {
_instance_hash = new HashMap();
// system fonts
String system_font_family = _device.getSystemFont().getFontData()[0].getName();
_default_fonts = new HashMap();
// system font is likely to be a good default sans serif font
_default_fonts.put("sans-serif", system_font_family);
for (int i = 0; i < _defaults_serif.length; i++) {
if (_device.getFontList(_defaults_serif[i], true).length > 0) {
_default_fonts.put("serif", _defaults_serif[i]);
break;
}
}
if (_default_fonts.get("serif") == null) {
_default_fonts.put("serif", system_font_family);
}
for (int i = 0; i < _defaults_monospace.length; i++) {
if (_device.getFontList(_defaults_monospace[i], true).length > 0) {
_default_fonts.put("monospace", _defaults_monospace[i]);
break;
}
}
if (_default_fonts.get("monospace") == null) {
_default_fonts.put("monospace", system_font_family);
}
// last resort font
Font systemFont = _device.getSystemFont();
_system_font = new SWTFSFont(systemFont, systemFont.getFontData()[0].getHeight(), true);
}
内容来源于网络,如有侵权,请联系作者删除!