本文整理汇总了Java中net.rim.device.api.ui.Graphics.translate方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.translate方法的具体用法?Java Graphics.translate怎么用?Java Graphics.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.rim.device.api.ui.Graphics
的用法示例。
在下文中一共展示了Graphics.translate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setClip
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public void setClip(Object graphics, int x, int y, int width, int height) {
Graphics g = (net.rim.device.api.ui.Graphics) graphics;
net.rim.device.api.ui.Font oldFont = g.getFont();
int oldColor = g.getColor();
int oldAlpha = g.getGlobalAlpha();
while (g.getContextStackSize() > 1) {
g.popContext();
}
g.pushRegion(x, y, width, height, 0, 0);
g.translate(-g.getTranslateX(), -g.getTranslateY());
/**
* applying a clip will automatically
* reset some information that we need to keep track of
* manually (it seems).
*/
g.setFont(oldFont == null ? (net.rim.device.api.ui.Font) getDefaultFont() : oldFont);
g.setColor(oldColor);
g.setGlobalAlpha(oldAlpha);
}
示例2: draw
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public void draw(Graphics g, XYRect rect) {
int[] path = {startColor, startColor, endColor, endColor};
int[] xes = {0x0, rect.width, rect.width, 0};
int[] yes = {0x0, 0x0, rect.height, rect.height};
g.translate(rect.x, rect.y);
g.drawShadedFilledPath(xes, yes, null, path, null);
g.translate(-rect.x, -rect.y);
int oldColor = g.getColor();
if (topBorderHeight > 0) {
g.setColor(topBorderColor);
g.fillRect(rect.x, rect.y, rect.width, topBorderHeight);
}
if (bottomBorderHeight > 0) {
g.setColor(bottomBorderColor);
g.fillRect(rect.x, rect.y - bottomBorderHeight, rect.width, bottomBorderHeight);
}
g.setColor(oldColor);
}
示例3: clipOnLWUITBounds
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
/**
* Clips the RIM native graphics based on the component hierarchy within LWUIT
* so the native RIM component doesn't paint itself above other components such
* as the forms title.
*/
private int clipOnLWUITBounds(Component lwuitComponent, Graphics rimGraphics) {
int result = 0;
Component parent = lwuitComponent;
while (parent != null) {
int x = parent.getAbsoluteX() + parent.getScrollX();
int y = parent.getAbsoluteY() + parent.getScrollY();
rimGraphics.pushRegion(x, y, parent.getWidth(), parent.getHeight(), 0, 0);
rimGraphics.translate(-rimGraphics.getTranslateX(), -rimGraphics.getTranslateY());
parent = parent.getParent();
result++;
}
return result;
}
示例4: clipRect
import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public void clipRect(Object graphics, int x, int y, int width, int height) {
Graphics g = (Graphics) graphics;
g.pushRegion(x, y, width, height, 0, 0);
g.translate(-g.getTranslateX(), -g.getTranslateY());
}