本文整理匯總了Java中com.google.gwt.canvas.dom.client.Context2d.rect方法的典型用法代碼示例。如果您正苦於以下問題:Java Context2d.rect方法的具體用法?Java Context2d.rect怎麽用?Java Context2d.rect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.canvas.dom.client.Context2d
的用法示例。
在下文中一共展示了Context2d.rect方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: render
import com.google.gwt.canvas.dom.client.Context2d; //導入方法依賴的package包/類
@Override
public void render(Context2d g, double timestamp) {
if (!isVisible()) {
return;
}
resizeContent();
content.x = scrollOffset.x = Math.min(0, Math.max(width - content.width, scrollOffset.x));
content.y = scrollOffset.y = Math.min(0, Math.max(height - content.height, scrollOffset.y));
g.save();
g.beginPath();
g.translate(x, y);
g.rect(0, 0, width, height);
g.clip();
g.translate(scrollOffset.x, scrollOffset.y);
for (UiElement c : children) {
c.render(g, timestamp);
}
g.restore();
redrawNeeded = false;
}
示例2: repaint
import com.google.gwt.canvas.dom.client.Context2d; //導入方法依賴的package包/類
public void repaint(Tool tool, int x, int y, int tileSize){
Context2d context = canvasLayer.getContext();
context.clearRect(0, 0, canvasLayer.getWidth(), canvasLayer.getHeight());
if (tool == Tool.BRUSH) {
} else if (tool == Tool.ERASER) {
Eraser eraser = ToolBox.getInstance().getEraser();
int size = eraser.getSize()*tileSize;
context.save();
context.setLineWidth(1.0);
context.setStrokeStyle(CssColors.RED);
context.setFillStyle(CssColors.LIGHT_GREY);
context.rect(x, y, size, size);
context.stroke();
context.setGlobalAlpha(0.25);
context.fill();
context.restore();
}
}
示例3: redrawIfNecessary
import com.google.gwt.canvas.dom.client.Context2d; //導入方法依賴的package包/類
@Override
public void redrawIfNecessary(Context2d g, double timestamp) {
if (!isVisible()) {
return;
}
if (redrawNeeded) {
clearRect(g);
render(g, timestamp);
} else {
g.save();
g.beginPath();
g.rect(x, y, width, height);
g.clip();
g.translate(x + scrollOffset.x, y + scrollOffset.y);
for (UiElement c : children) {
c.redrawIfNecessary(g, timestamp);
}
g.restore();
}
}
示例4: render
import com.google.gwt.canvas.dom.client.Context2d; //導入方法依賴的package包/類
@Override
public void render(Context2d g, double timestamp) {
if (!isVisible()) {
return;
}
redrawNeeded = false;
g.save();
g.translate(x, y);
if (redrawBufferNeeded) {
buffer.render();
redrawBufferNeeded = false;
}
if (null != backgroundColor) {
g.beginPath();
g.rect(0, 0, width, height);
g.setFillStyle(backgroundColor);
g.fill();
}
buffer.flip(g);
g.restore();
}
示例5: render
import com.google.gwt.canvas.dom.client.Context2d; //導入方法依賴的package包/類
@Override
public void render(Context2d g, double timestamp) {
if (!isVisible()) {
return;
}
redrawNeeded = false;
g.save();
g.translate(x, y);
if (clip) {
g.beginPath();
g.rect(0, 0, width, height);
g.clip();
}
for (UiElement c : children) {
c.render(g, timestamp);
}
g.restore();
}
示例6: render
import com.google.gwt.canvas.dom.client.Context2d; //導入方法依賴的package包/類
@Override
public void render(Context2d g, double timestamp) {
g.save();
{
if (textClip == TextClip.HIDDEN) {
g.beginPath();
g.rect(0, 0, width, height);
g.clip();
}
setTextAlign(g, textAlign, width);
setTextBaseline(g, textBaseline, height);
g.setFont(font);
g.setTextAlign(textAlign);
g.setTextBaseline(textBaseline);
g.setFillStyle(color);
String text = this.text;
if (textClip == TextClip.ELLIPSE) {
text = fitEllipse(g, text, width);
}
if (textClip == TextClip.FIT) {
g.fillText(text, 0, 0, width);
} else {
g.fillText(text, 0, 0);
}
}
g.restore();
}