本文整理了Java中org.eclipse.swt.graphics.Device.getSystemColor()
方法的一些代码示例,展示了Device.getSystemColor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.getSystemColor()
方法的具体详情如下:
包路径:org.eclipse.swt.graphics.Device
类名称:Device
方法名:getSystemColor
[英]Returns the matching standard color for the given constant, which should be one of the color constants specified in class SWT
. Any value other than one of the SWT color constants which is passed in will result in the color black. This color should not be freed because it was allocated by the system, not the application.
[中]返回给定常量的匹配标准颜色,该颜色应为类SWT
中指定的颜色常量之一。除了传入的一个SWT颜色常数之外的任何值都将导致黑色。不应释放此颜色,因为它是由系统而不是应用程序分配的。
代码示例来源: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: rinde/RinSim
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.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: rinde/RinSim
PDPModelRenderer(RoadModel rm, PDPModel pm, Device d, boolean lines) {
roadModel = rm;
pdpModel = pm;
helper = new RenderHelper();
drawDestLines = lines;
black = d.getSystemColor(SWT.COLOR_BLACK);
white = d.getSystemColor(SWT.COLOR_WHITE);
darkGreen = d.getSystemColor(SWT.COLOR_DARK_GREEN);
green = d.getSystemColor(SWT.COLOR_GREEN);
blue = d.getSystemColor(SWT.COLOR_BLUE);
lightGray = new Color(d, LIGHT_GRAY);
orange = new Color(d, ORANGE);
foregroundInfo = white;
backgroundInfo = blue;
}
代码示例来源:origin: rherrmann/eclipse-extras
private Color getSystemColor( int id ) {
return gc.getDevice().getSystemColor( id );
}
代码示例来源:origin: rinde/RinSim
void setForegroundSysCol(int next) {
gc.get().setForeground(gc.get().getDevice().getSystemColor(next));
}
代码示例来源:origin: rinde/RinSim
void setBackgroundSysCol(int next) {
gc.get().setBackground(gc.get().getDevice().getSystemColor(next));
}
代码示例来源:origin: BiglySoftware/BiglyBT
public static Color getSystemColor (Device d, int id) {
if (Utils.isGTK3) {
if (id == SWT.COLOR_INFO_BACKGROUND) {
return ColorCache.getColor(d, 0, 0,0 );
}
if (id == SWT.COLOR_INFO_FOREGROUND) {
return ColorCache.getColor(d, 255, 255,255 );
}
}
return d.getSystemColor(id);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
@Override
public void paint(GC gc, int width, int height) {
Device device = gc.getDevice();
gc.setBackground(device.getSystemColor(SWT.COLOR_BLACK));
gc.fillOval((width - size) / 2, (height - size) / 2, size, size);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
@Override
public void paint(GC gc, int width, int height) {
int centerX = width / 2;
int centerY = height / 2;
int pos = 0;
for (int i = 0; i < POINTS; ++i) {
double r = Math.PI*2 * pos/POINTS;
radial[i*2] = (int)((1+Math.cos(r))*centerX);
radial[i*2+1] = (int)((1+Math.sin(r))*centerY);
pos = (pos + POINTS/2) % POINTS;
}
gc.setFillRule(fillRuleCb.getSelectionIndex() != 0 ? SWT.FILL_WINDING : SWT.FILL_EVEN_ODD);
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_YELLOW));
gc.fillPolygon(radial);
gc.drawPolygon(radial);
}
}
代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt
@Override
public void setBackground ( final RGB color )
{
if ( color != null )
{
this.gc.setBackground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
}
else
{
this.gc.setBackground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_BACKGROUND ) );
}
}
代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt
@Override
public void setForeground ( final RGB color )
{
if ( color != null )
{
this.gc.setForeground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
}
else
{
this.gc.setForeground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_FOREGROUND ) );
}
}
代码示例来源:origin: org.eclipse.neoscada.chart/org.eclipse.scada.chart.swt
@Override
public void setBackground ( final RGB color )
{
if ( color != null )
{
this.gc.setBackground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
}
else
{
this.gc.setBackground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_BACKGROUND ) );
}
}
代码示例来源:origin: org.eclipse.neoscada.chart/org.eclipse.scada.chart.swt
@Override
public void setForeground ( final RGB color )
{
if ( color != null )
{
this.gc.setForeground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
}
else
{
this.gc.setForeground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_FOREGROUND ) );
}
}
代码示例来源:origin: rinde/RinSim
@Override
public void renderStatic(GC gc, ViewPort vp) {
final int xMin = vp.toCoordX(bounds.get(0).x);
final int yMin = vp.toCoordY(bounds.get(0).y);
final int xMax = vp.toCoordX(bounds.get(1).x);
final int yMax = vp.toCoordY(bounds.get(1).y);
final int outerXmin = vp.toCoordX(vp.rect.min.x);
final int outerYmin = vp.toCoordY(vp.rect.min.y);
final int outerXmax = vp.toCoordX(vp.rect.max.x);
final int outerYmax = vp.toCoordY(vp.rect.max.y);
gc.setBackground(
gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
gc.fillRectangle(outerXmin, outerYmin, outerXmax, outerYmax);
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
gc.fillRectangle(xMin, yMin, xMax - xMin, yMax - yMin);
gc.drawRectangle(xMin, yMin, xMax - xMin, yMax - yMin);
}
代码示例来源:origin: BiglySoftware/BiglyBT
/**
* @param image
* @param bounds
*/
public static void obfuscateArea(Image image, Rectangle bounds) {
GC gc = new GC(image);
try {
gc.setBackground(image.getDevice().getSystemColor(SWT.COLOR_WHITE));
gc.setForeground(image.getDevice().getSystemColor(SWT.COLOR_RED));
gc.fillRectangle(bounds);
gc.drawRectangle(bounds);
int x2 = bounds.x + bounds.width;
int y2 = bounds.y + bounds.height;
gc.drawLine(bounds.x, bounds.y, x2, y2);
gc.drawLine(x2, bounds.y, bounds.x, y2);
} finally {
gc.dispose();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
private void drawUnselectedTabBackground(GC gc, Rectangle partHeaderBounds,
int state, boolean vertical, Color defaultBackground) {
if (unselectedTabsColors == null) {
boolean selected = (state & SWT.SELECTED) != 0;
unselectedTabsColors = selected ? parentWrapper.getSelectionGradientColors()
: parentWrapper.getGradientColors();
unselectedTabsPercents = selected ? parentWrapper.getSelectionGradientPercents()
: parentWrapper.getGradientPercents();
}
if (unselectedTabsColors == null) {
unselectedTabsColors = new Color[] { gc.getDevice().getSystemColor(SWT.COLOR_WHITE) };
unselectedTabsPercents = new int[] { 100 };
}
drawBackground(gc, partHeaderBounds.x, partHeaderBounds.y - 1, partHeaderBounds.width,
partHeaderBounds.height, defaultBackground, unselectedTabsColors, unselectedTabsPercents, vertical);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
@Override
public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
Font font = new Font(device, getPlatformFontFace(fontFace), fontSize, fontStyle);
gc.setFont(font);
Point size = gc.stringExtent(text);
textWidth = size.x;
textHeight = size.y;
Path path = new Path(device);
path.addString(text, x, y, font);
gc.setForeground(device.getSystemColor(foreGrdColor));
gc.setBackground(device.getSystemColor(fillColor));
gc.fillPath(path);
gc.drawPath(path);
font.dispose();
path.dispose();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
void createShadow(final Display display) {
if (shadowImage != null) {
shadowImage.dispose();
shadowImage = null;
}
ImageData data = new ImageData(60, 60, 32, new PaletteData(0xFF0000, 0xFF00, 0xFF));
Image tmpImage = shadowImage = new Image(display, data);
GC gc = new GC(tmpImage);
if (shadowColor == null)
shadowColor = gc.getDevice().getSystemColor(SWT.COLOR_GRAY);
gc.setBackground(shadowColor);
drawTabBody(gc, new Rectangle(0, 0, 60, 60));
ImageData blured = blur(tmpImage, 5, 25);
shadowImage = new Image(display, blured);
tmpImage.dispose();
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
void createShadow(final Display display) {
if (shadowImage != null) {
shadowImage.dispose();
shadowImage = null;
}
ImageData data = new ImageData(60, 60, 32, new PaletteData(0xFF0000,
0xFF00, 0xFF));
Image tmpImage = shadowImage = new Image(display, data);
GC gc = new GC(tmpImage);
if (shadowColor == null)
shadowColor = gc.getDevice().getSystemColor(SWT.COLOR_GRAY);
gc.setBackground(shadowColor);
drawTabBody(gc, new Rectangle(0, 0, 60, 60), SWT.None);
ImageData blured = blur(tmpImage, 5, 25);
shadowImage = new Image(display, blured);
tmpImage.dispose();
}
内容来源于网络,如有侵权,请联系作者删除!