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


Java Graphics.clear方法代码示例

本文整理汇总了Java中net.rim.device.api.ui.Graphics.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.clear方法的具体用法?Java Graphics.clear怎么用?Java Graphics.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.rim.device.api.ui.Graphics的用法示例。


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

示例1: paint

import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public void paint(Graphics g) {
    int f = getFieldCount();
    if(f > 0) {
        g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);

        Form currentForm = Display.getInstance().getCurrent();
        for(int iter = 0 ; iter < f ; iter++) {
            Field fld = getField(iter);
            int pops = 0;
            if(currentForm != null) {
                PeerComponent p = findPeer(currentForm.getContentPane(), fld);
                if(p != null) {
                    pops = clipOnLWUITBounds(p, g);
                } else {
                    Component cmp = currentForm.getFocused();

                    // we are now editing an edit field
                    if(cmp != null && cmp instanceof TextArea && cmp.hasFocus() && fld instanceof EditField) {
                        pops = clipOnLWUITBounds(cmp, g);
                        int x = fld.getLeft();
                        int y = fld.getTop();
                        g.clear(x, y, Math.max(cmp.getWidth(), fld.getWidth()),
                                Math.max(cmp.getHeight(), fld.getHeight()));
                    }
                }
            }
            paintChild(g, fld);
            while(pops > 0) {
                g.popContext();
                pops--;
            }
        }
    } else {
        g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);
    }
    g.setColor(0);
    g.drawText(debug, 0, 0);
    painted = true;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:40,代码来源:BlackBerryCanvas.java

示例2: createMutableImage

import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
public Object createMutableImage(int width, int height, int fillColor) {
    Bitmap b = new Bitmap(width, height);
    Graphics g = new Graphics(b);
    if ((fillColor & 0xff000000) != 0xff000000) {
        g.setColor(fillColor & 0xffffff);
        int oldAlpha = g.getGlobalAlpha();
        g.setGlobalAlpha((fillColor >> 24) & 0xff);
        g.clear();
        g.setGlobalAlpha(oldAlpha);
    } else {
        g.setColor(fillColor & 0xffffff);
        g.fillRect(0, 0, width, height);
    }
    return b;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:16,代码来源:BlackBerryImplementation.java

示例3: paintTransformedBitmap

import net.rim.device.api.ui.Graphics; //导入方法依赖的package包/类
/**
 * Paint the transformed Bitmap using the given Graphics context. Paints the
 * area transparent before painting the bitmap.
 * 
 * @param g
 *            the {@link Graphics} context to use - from a screen or bitmap,
 *            etc.
 * @param textureOriginX
 *            x value in the original bitmap to start drawing from
 * @param textureOriginY
 *            y value in the original bitmap to start drawing from
 * @since 1.1
 */
private void paintTransformedBitmap(Graphics g, int textureOriginX, int textureOriginY) {
	// Make the drawing space transparent first before painting
	g.setGlobalAlpha(getBackgroundAlpha());
	g.setBackgroundColor(getBackgroundColor());
	g.clear();
	g.setGlobalAlpha(255);
	/**
	 * Keep the precision of our transformation and Scale the drawing as
	 * well. Scale is applied as though a matrix of the form
	 * 
	 * <pre>
	 * | ScaleX  0     0|
	 * | 0    ScaleY   0|
	 * | 0       0     1|
	 * </pre>
	 * 
	 * is multiplied by the Transformation matrix
	 **/

	int dux = Fixed32.div(transformMatrix[UX], resultantScaleX);
	int dvx = Fixed32.div(transformMatrix[VX], resultantScaleY);
	int duy = Fixed32.div(transformMatrix[UY], resultantScaleX);
	int dvy = Fixed32.div(transformMatrix[VY], resultantScaleY);
	
   // Needed for alpha changes in 6.0 with Graphics.clear()
   g.setColor(Graphics.WHITE);
	g.drawFilledPath(bitmapXPts, bitmapYPts, null, null);
	
	g.drawTexturedPath(bitmapXPts, bitmapYPts, null, null, textureOriginX, textureOriginY, dux, dvx, duy, dvy, bitmap);
}
 
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:44,代码来源:ImageManipulator.java


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