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


Java Graphics.translate方法代码示例

本文整理汇总了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);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:20,代码来源:BlackBerryImplementation.java

示例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);
}
 
开发者ID:yanex,项目名称:vika,代码行数:25,代码来源:GradientBackground.java

示例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;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:20,代码来源:BlackBerryCanvas.java

示例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());
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryImplementation.java


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