org.eclipse.swt.graphics.Transform.rotate()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.eclipse.swt.graphics.Transform.rotate()方法的一些代码示例,展示了Transform.rotate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transform.rotate()方法的具体详情如下:
包路径:org.eclipse.swt.graphics.Transform
类名称:Transform
方法名:rotate

Transform.rotate介绍

[英]Modifies the receiver so that it represents a transformation that is equivalent to its previous transformation rotated by the specified angle. The angle is specified in degrees and for the identity transform 0 degrees is at the 3 o'clock position. A positive value indicates a clockwise rotation while a negative value indicates a counter-clockwise rotation.
[中]修改接收器,使其表示的变换等效于按指定角度旋转的前一个变换。角度以度为单位指定,对于身份转换,0度位于3点钟位置。正值表示顺时针旋转,负值表示逆时针旋转。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 protected Image renderRotated( Device device, int width, int height, double angleRadians ) {
  Image result = new Image( device, width * 2, height * 2 );

  GC gc = new GC( result );

  int bw = bitmap.getBounds().width;
  int bh = bitmap.getBounds().height;
  Transform affineTransform = new Transform( device );
  affineTransform.translate( width, height );
  affineTransform.rotate( (float) Math.toDegrees( angleRadians ) );
  affineTransform.scale( (float) 1.0 * width / bw, (float) 1.0 * height / bh );
  gc.setTransform( affineTransform );

  gc.drawImage( bitmap, 0, 0, bw, bh, -bw / 2, -bh / 2, bw, bh );

  gc.dispose();

  return result;
 }
}

代码示例来源:origin: rinde/RinSim

transform.rotate(
 (float) (ROTATION_OFFSET_DEG + angle * ROTATION_MAX_DEG / Math.PI));
transform.translate(

代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
public void drawText ( final String string, final int x, final int y, final Float rotate )
{
  final Transform t;
  if ( rotate != null )
  {
    t = new Transform ( this.gc.getDevice () );
    t.rotate ( rotate );
    this.gc.setTransform ( t );
  }
  else
  {
    t = null;
  }
  this.gc.drawText ( string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB | SWT.DRAW_TRANSPARENT );
  if ( t != null )
  {
    this.gc.setTransform ( null );
    t.dispose ();
  }
}

代码示例来源:origin: org.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
public void drawText ( final String string, final int x, final int y, final Float rotate )
{
  final Transform t;
  if ( rotate != null )
  {
    t = new Transform ( this.gc.getDevice () );
    t.rotate ( rotate );
    this.gc.setTransform ( t );
  }
  else
  {
    t = null;
  }
  this.gc.drawText ( string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB | SWT.DRAW_TRANSPARENT );
  if ( t != null )
  {
    this.gc.setTransform ( null );
    t.dispose ();
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

transform = new Transform(event.display);
transform.translate(TrimUtil.TRIM_DEFAULT_HEIGHT, 0);
transform.rotate(90);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

transform.rotate(rotateSpinner.getSelection());
transform.translate(-rect.width/2, -rect.height/2);

代码示例来源:origin: org.xworker/xworker_swt

tr.rotate((float) secondAngle);	        
gc.setTransform(tr);            
gc.drawPath(secondHand);
tr.rotate((float) -secondAngle);	
tr.rotate((float)minuteAngle);
gc.setTransform(null);
gc.setTransform(tr);
tr.rotate((float) -minuteAngle);	
hourHand.close();
tr.rotate((int) angle);
gc.setTransform(null);

代码示例来源:origin: org.xworker/xworker_swt

t.rotate(1f * degree);
gc.setTransform(t);

代码示例来源:origin: org.xworker/xworker_swt

tr.rotate((float) secondAngle);	        
gc.setTransform(tr);            
gc.drawPath(secondHand);
tr.rotate((float) -secondAngle);	
tr.rotate((float)minuteAngle);
gc.setTransform(null);
gc.setTransform(tr);
tr.rotate((float) -minuteAngle);	
hourHand.close();
tr.rotate((int) angle);
gc.setTransform(null);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

Transform tr = new Transform(display);
tr.translate(rect.width / 4, rect.height / 2);
tr.rotate(-30);
if (image != null) {
  gc.drawImage(image, 0, 0, rect.width, rect.height, 0, 0, rect.width, rect.height);

代码示例来源:origin: org.xworker/xworker_swt

if(degree != 0){
  Transform t = new Transform(targetImage.getDevice());
  t.rotate(1f * degree);
  gc.setTransform(t);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

transform.rotate(angle);
gc.setTransform(transform);
gc.setForeground(device.getSystemColor(SWT.COLOR_RED));

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

transform = new Transform(device);
transform.translate(width/2, height/2);
transform.rotate(-(angle + 360/n * i));
gc.setTransform(transform);
gc.drawArc(0, 0, width/3, height/6, 0, 180);

代码示例来源:origin: com.github.rinde/rinsim-example

transform.translate(offsetX + image.getBounds().width / 2, offsetY
 + image.getBounds().height / 2);
transform.rotate(rotation);
transform.translate(-(offsetX + image.getBounds().width / 2),
 -(offsetY + image.getBounds().height / 2));

代码示例来源:origin: rinde/RinSim

transform.translate(offsetX + image.getBounds().width / 2, offsetY
 + image.getBounds().height / 2);
transform.rotate(rotation);
transform.translate(-(offsetX + image.getBounds().width / 2),
 -(offsetY + image.getBounds().height / 2));

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

transform.rotate(-angle);
transform.translate(-width/2, -height/2);
gc.setTransform(transform);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

transform.rotate(45);
transform.translate(-rect.width/2, -rect.height/2);
gc.setTransform(transform);
transform.rotate(-45);
transform.translate(-rect.width/2, -rect.height/2);
gc.setTransform(transform);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

transform.rotate(rotationAngle);
transform.translate(-rect.width/2, -rect.height/2);

代码示例来源:origin: org.xworker/xworker_swt

int hh = getHeight() / 2;
transform.translate(hw, hh);;
transform.rotate(rotate);
transform.translate(-hw, -hh);

相关文章