当前位置: 首页>>代码示例>>Java>>正文


Java Canvas.setHeight方法代码示例

本文整理汇总了Java中com.google.gwt.canvas.client.Canvas.setHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Canvas.setHeight方法的具体用法?Java Canvas.setHeight怎么用?Java Canvas.setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.canvas.client.Canvas的用法示例。


在下文中一共展示了Canvas.setHeight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createImage

import com.google.gwt.canvas.client.Canvas; //导入方法依赖的package包/类
public static CanvasElement createImage(int width, int height) {
	Canvas canvas = Canvas.createIfSupported();
	canvas.setWidth(width + "px");
	canvas.setCoordinateSpaceWidth(width);
	canvas.setHeight(height + "px");
	canvas.setCoordinateSpaceHeight(height);
	return canvas.getCanvasElement();
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:9,代码来源:DataStore.java

示例2: setCanvasSize

import com.google.gwt.canvas.client.Canvas; //导入方法依赖的package包/类
private static void setCanvasSize(Canvas canvas, int width, int height)
{
	canvas.setWidth(width + "px");
	canvas.setHeight(height + "px");
	canvas.setCoordinateSpaceWidth(width);
	canvas.setCoordinateSpaceHeight(height);
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:8,代码来源:CanvasBacking.java

示例3: Timeline

import com.google.gwt.canvas.client.Canvas; //导入方法依赖的package包/类
public Timeline(Canvas canvas, ScrollPanel scroll, LayoutPanel viewPanel) {
	logger.setLevel(Level.INFO);

	this.canvas = canvas;
	this.scroll = scroll;
	this.viewPanel = viewPanel;

	landmarks = new Vector<Landmark>();
	landmarkbars = new Vector<LandmarkBar>();

	startTime = new Date();
	currentTime = new Date();

	lenghtOfAMinute = 1000;

	color = CssColor.make("rgba(" + 0 + ", " + 0 + "," + 255 + ", " + 1
			+ ")");

	canvas.setWidth(minWidth + "px");
	canvas.setCoordinateSpaceWidth(minWidth);

	canvas.setHeight(minHeight + "px");
	canvas.setCoordinateSpaceHeight(minHeight);

	timer = new Timer() {
		@Override
		public void run() {
			updateTime();
			drawTimeline();
		}
	};
	timer.scheduleRepeating(5000);

	updateTime();
	drawTimeline();
}
 
开发者ID:metafora-project,项目名称:ReflectionTool,代码行数:37,代码来源:Timeline.java

示例4: measureHeight

import com.google.gwt.canvas.client.Canvas; //导入方法依赖的package包/类
private static int measureHeight(Font font, String text) {
  Canvas canvas = canvas();
  Context2d ctx = canvas.getContext2d();

  ctx.setFont(getFontString(font));
  ctx.setFillStyle("rgb(255, 0, 0)");

  int width = (int) ctx.measureText(text).getWidth();
  int canvasHeight = font.getSize() * 2;
  canvas.setHeight(canvasHeight + "px");
  canvas.setHeight(font.getSize() * 2 + "px");
  canvas.setWidth(width + "px");

  ctx.fillText(text, 0, font.getSize());
  ImageData data = ctx.getImageData(0, 0, width, canvasHeight);
  int firstY = canvasHeight - 1;
  int lastY = 0;
  for (int x = 0; x < width; x++) {
    for (int y = 0; y < canvasHeight; y++) {
      int red = data.getRedAt(x, y);
      if (red != 0) {
        if (firstY > y) {
          firstY = y;
        }
        if (lastY < y) {
          lastY = y;
        }
      }
    }
  }
  return lastY - firstY;
}
 
开发者ID:JetBrains,项目名称:jetpad-projectional-open-source,代码行数:33,代码来源:TextMetricsCalculator.java

示例5: initCanvas

import com.google.gwt.canvas.client.Canvas; //导入方法依赖的package包/类
private void initCanvas(Canvas canvas) {
	canvas.setWidth(width + "px");
	canvas.setHeight(height + "px");
	canvas.setCoordinateSpaceWidth(width);
	canvas.setCoordinateSpaceHeight(height);
}
 
开发者ID:PsiAmp,项目名称:punk-toads,代码行数:7,代码来源:BufferedCanvas.java


注:本文中的com.google.gwt.canvas.client.Canvas.setHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。