• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Bitmap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.rim.device.api.system.Bitmap的典型用法代码示例。如果您正苦于以下问题:Java Bitmap类的具体用法?Java Bitmap怎么用?Java Bitmap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Bitmap类属于net.rim.device.api.system包,在下文中一共展示了Bitmap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: sublayout

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public void sublayout(int w, int h) {
    //super.sublayout(w, h);
    // the alternative undeprecated API requires a signature
    if(net.rim.device.api.ui.Graphics.getScreenWidth() != screenWidth ||
            net.rim.device.api.ui.Graphics.getScreenHeight() != screenHeight) {
        screenWidth = net.rim.device.api.ui.Graphics.getScreenWidth();
        screenHeight = net.rim.device.api.ui.Graphics.getScreenHeight();
        if(screenWidth > 0 && screenHeight > 0) {
            screen = new Bitmap(screenWidth, screenHeight);
            globalGraphics = new Graphics(screen);
            if(impl != null) {
                impl.sizeChanged(screenWidth, screenHeight);
            }
        }
    }
    super.sublayout(w, h);
    
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:BlackBerryCanvas.java


示例2: scale

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public Object scale(Object nativeImage, int width, int height) {
    Bitmap image = (Bitmap) nativeImage;
    int srcWidth = image.getWidth();
    int srcHeight = image.getHeight();

    // no need to scale
    if (srcWidth == width && srcHeight == height) {
        return image;
    }

    int[] currentArray = new int[srcWidth];
    int[] destinationArray = new int[width * height];
    scaleArray(image, srcWidth, srcHeight, height, width, currentArray, destinationArray);

    return createImage(destinationArray, width, height);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:20,代码来源:BlackBerryImplementation.java


示例3: scaleArray

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
private void scaleArray(Bitmap currentImage, int srcWidth, int srcHeight, int height, int width, int[] currentArray, int[] destinationArray) {
    // Horizontal Resize
    int yRatio = (srcHeight << 16) / height;
    int xRatio = (srcWidth << 16) / width;
    int xPos = xRatio / 2;
    int yPos = yRatio / 2;

    // if there is more than 16bit color there is no point in using mutable
    // images since they won't save any memory
    for (int y = 0; y < height; y++) {
        int srcY = yPos >> 16;
        getRGB(currentImage, currentArray, 0, 0, srcY, srcWidth, 1);
        for (int x = 0; x < width; x++) {
            int srcX = xPos >> 16;
            int destPixel = x + y * width;
            if ((destPixel >= 0 && destPixel < destinationArray.length) && (srcX < currentArray.length)) {
                destinationArray[destPixel] = currentArray[srcX];
            }
            xPos += xRatio;
        }
        yPos += yRatio;
        xPos = xRatio / 2;
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:25,代码来源:BlackBerryImplementation.java


示例4: BitmapLuminanceSource

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
/**
 * Construct luminance source for specified Bitmap 
 * @param bitmap
 */
public BitmapLuminanceSource(Bitmap bitmap) {
	super(bitmap.getWidth(), bitmap.getHeight());
	int width = bitmap.getWidth();
	int height = bitmap.getHeight();
	_bitmap = bitmap;

	int area = width * height;
	_matrix = new byte[area];
	int[] rgb = new int[area];

	_bitmap.getARGB(rgb, 0, width, 0, 0, width, height);

	for (int y = 0; y < height; y++) {
		int offset = y * width;
		for (int x = 0; x < width; x++) {
			int pixel = rgb[offset + x];
			int luminance = (306 * ((pixel >> 16) & 0xFF) + 601
					* ((pixel >> 8) & 0xFF) + 117 * (pixel & 0xFF)) >> 10;
			_matrix[offset + x] = (byte) luminance;
		}
	}

	rgb = null;

}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:30,代码来源:BitmapLuminanceSource.java


示例5: FileItem

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public FileItem(FileSystemObject fso) {
    this.fso = fso;

    Pair bitmaps = fetchBitmaps(fso);
    bitmapNormal = (Bitmap) bitmaps.first;
    bitmapHover = (Bitmap) bitmaps.second;

    label = new CustomLabelField(
            (fso == null) ? tr(VikaResource.Back) : fso.displayName,
            DrawStyle.ELLIPSIS | Field.FIELD_VCENTER, THEME);
    icon = new ImageField(bitmapNormal, DP12, DP12, Field.FIELD_VCENTER, false);

    HorizontalFieldManager hfm = new HorizontalFieldManager();
    hfm.add(icon);
    hfm.add(label);
    add(hfm);

    addingCompleted();
}
 
开发者ID:yanex,项目名称:vika,代码行数:20,代码来源:FileItem.java


示例6: drawPixels

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
private static void drawPixels(Bitmap src, int[][] m, int destX, int destY) {
    int[] data = new int[m.length * m.length];
    src.getARGB(data, 0, m.length, destX, destY, m.length, m.length);

    for (int y = destY; y < destY + m.length; ++y) {
        for (int x = destX; x < destX + m[y - destY].length; ++x) {
            int pos = m.length * (y - destY) + x - destX;
            int b = data[pos] % RoundAngles.E1;
            int g = (data[pos] - b) / 256 % RoundAngles.E1;
            int r = (data[pos] - b - RoundAngles.E1 * g) / RoundAngles.E2 % RoundAngles.E1;
            data[pos] = m[y - destY][x - destX] * RoundAngles.E3 + b + g * RoundAngles.E1 + r
                    * RoundAngles.E2;
        }
    }

    src.setARGB(data, 0, m.length, destX, destY, m.length, m.length);
}
 
开发者ID:yanex,项目名称:vika,代码行数:18,代码来源:RoundAngles.java


示例7: roundAngles

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public static void roundAngles(Bitmap src, int radius) {
    if (radius < 2) {
        radius = 2;
    }
    if (radius > maps.length) {
        radius = maps.length;
    }

    int[][] m0 = RoundAngles.maps[radius];
    int[][] m1 = RoundAngles.swapHorizontal(RoundAngles.maps[radius]);
    int[][] m2 = RoundAngles.swapVertical(RoundAngles.maps[radius]);
    int[][] m3 = RoundAngles.swapHorizontal(m2);

    RoundAngles.drawPixels(src, m0, 0, 0);
    RoundAngles.drawPixels(src, m1, src.getWidth() - radius, 0);
    RoundAngles.drawPixels(src, m2, 0, src.getHeight() - radius);
    RoundAngles.drawPixels(src, m3, src.getWidth() - radius, src.getHeight() - radius);
}
 
开发者ID:yanex,项目名称:vika,代码行数:19,代码来源:RoundAngles.java


示例8: AbstractBitmapField

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public AbstractBitmapField(Bitmap bmp, XYDimension size, boolean scale,
                           boolean roundAngles) {
    int newHeight = size.height, newWidth = size.width;
    Bitmap newBmp;

    if (bmp.getWidth() > newWidth || bmp.getHeight() > newHeight || scale) {
        newBmp = GPATools.ResizeTransparentBitmap(bmp, newWidth, newHeight,
                Bitmap.FILTER_LANCZOS, Bitmap.SCALE_TO_FIT);
    } else {
        newBmp = bmp;
    }

    this.height = newHeight;
    this.width = newWidth;

    if (roundAngles) {
        RoundAngles.roundAngles(newBmp, 3);
    }

    this.bmp = newBmp;
}
 
开发者ID:yanex,项目名称:vika,代码行数:22,代码来源:AbstractBitmapField.java


示例9: ImageSelectorField

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public ImageSelectorField(Bitmap defaultBmp, Bitmap focusBmp, Bitmap activeBmp,
                          Bitmap selectedBmp,
                          int width, int height, long style, Theme theme, boolean scale) {
    super(style, theme);

    this.scale = scale;

    XYEdges padding = theme.getPaddingEdges();

    fullWidth = width;
    imageWidth = fullWidth - padding.left - padding.right;
    fullHeight = height;
    imageHeight = fullHeight - padding.top - padding.bottom;

    XYDimension dim = new XYDimension(imageWidth, imageHeight);
    this.defaultBmp = new AbstractBitmapField(defaultBmp, dim, scale);
    this.focusBmp = new AbstractBitmapField(focusBmp, dim, scale);
    this.activeBmp = new AbstractBitmapField(activeBmp, dim, scale);

    if (activeBmp != selectedBmp) {
        this.selectedBmp = new AbstractBitmapField(selectedBmp, dim, scale);
    } else {
        this.selectedBmp = this.activeBmp;
    }
}
 
开发者ID:yanex,项目名称:vika,代码行数:26,代码来源:ImageSelectorField.java


示例10: CompoundButtonField

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public CompoundButtonField(String text, Bitmap b) {
    super(0, CompoundButtonField.THEME);

    VerticalFieldManager vfm = new VerticalFieldManager();
    vfm.setPadding(DP2, DP2, DP2, DP2);

    BitmapField bitmap = new BitmapField(b, Field.FIELD_HCENTER);
    vfm.add(bitmap);

    String[] lines = StringUtils.split(text, "\n");
    for (int i = 0; i < lines.length; ++i) {
        CustomLabelField label = new CustomLabelField(lines[i],
                DrawStyle.HCENTER | Field.FIELD_HCENTER,
                CompoundButtonField.LABEL_THEME);
        vfm.add(label);
    }

    add(vfm);

    addingCompleted();
}
 
开发者ID:yanex,项目名称:vika,代码行数:22,代码来源:CompoundButtonField.java


示例11: DisplayStory

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
DisplayStory(EncodedImage original, Bitmap img, UiApplication app, int time) {
	_original = original; 
	int direction = Display.DIRECTION_NORTH;
	Ui.getUiEngineInstance().setAcceptableDirections(direction);

	monApp = app;
	_img = img;
	
	//this.setTitle(Caption);
	this.addMenuItem(_ScreenShootitem);
	this.addMenuItem(_Nextstoryitem);
	this.addMenuItem(_EndStoryitem);
	// afficher l'image.
	HorizontalFieldManager SnapManager = new HorizontalFieldManager();
	bmp = new BitmapField();
	SnapManager.add(bmp);
	this.add(SnapManager);
	
	t = new Timer();
	t.schedule(new Chronometer(time, img), 0, 1000);
}
 
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:22,代码来源:DisplayStory.java


示例12: run

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public void run() {
	synchronized (UiApplication.getEventLock()) {
		if (_time > 0) {
			Bitmap _bmp = new Bitmap(Display.getWidth(),
					Display.getHeight());
			Graphics g = new Graphics(_bmp);
			g.setColor(Color.BLACK);
			g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
			g.drawBitmap(
					((_bmp.getWidth() / 2) - (_img.getWidth() / 2)), 0,
					_img.getWidth(), _img.getHeight(), _img, 0, 0);
			g.setColor(Color.WHITE);
			g.drawText(_time + "s", Display.getWidth() - 60,
					Display.getHeight() - 50);
			bmp.setBitmap(_bmp);
			_time--;				
		} else {
			t.cancel();
			quit();			
		}
	}
}
 
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:23,代码来源:DisplayStory.java


示例13: DisplaySnap

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
DisplaySnap(EncodedImage original, Bitmap img, int time, UiApplication app, JSONObject Current, String key) {
	_original = original;
	int direction = Display.DIRECTION_NORTH;
	Ui.getUiEngineInstance().setAcceptableDirections(direction);
	monApp = app;
	_img = img;
	_Current = Current;
	_key = key;
	
	// afficher l'image.
	
	this.addMenuItem(_ScreenShootitem);
	
	HorizontalFieldManager SnapManager = new HorizontalFieldManager();
	bmp = new BitmapField();
	SnapManager.add(bmp);
	this.add(SnapManager);
	
	t = new Timer();
	t.schedule(new Chronometer(time, img), 0, 1000);
}
 
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:22,代码来源:DisplaySnap.java


示例14: run

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public void run() {
	synchronized (UiApplication.getEventLock()) {
		if (_time > 0) {
			Bitmap _bmp = new Bitmap(Display.getWidth(),
					Display.getHeight());
			Graphics g = new Graphics(_bmp);
			g.setColor(Color.BLACK);
			g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
			g.drawBitmap(
					((_bmp.getWidth() / 2) - (_img.getWidth() / 2)), 0,
					_img.getWidth(), _img.getHeight(), _img, 0, 0);
			g.setColor(Color.WHITE);
			g.drawText(_time + "s", Display.getWidth() - 60,
					Display.getHeight() - 50);
			bmp.setBitmap(_bmp);
			_time--;				
		} else {
			t.cancel();
			quit();
						
		}
	}
}
 
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:24,代码来源:DisplaySnap.java


示例15: ViewStory

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
ViewStory(JSONObject Current, UiApplication monApp) {
	int direction = Display.DIRECTION_NORTH;
	Ui.getUiEngineInstance().setAcceptableDirections(direction);
	_monApp = monApp;
	_Current = Current;
	this.setTitle(" CrapSnap - View Stories");
	Bitmap back = EncodedImage.getEncodedImageResource("snapBack.png")
			.getBitmap();
	this.setBackground(BackgroundFactory.createBitmapBackground(back));

	// {
	// username: "youraccount",
	// timestamp: 1373207221,
	// req_token: create_token(auth_token, 1373207221)
	// }

	populate();

}
 
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:20,代码来源:ViewStory.java


示例16: CheckCodeScreen

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public CheckCodeScreen(String user) {
  mUser = user;
  setTitle(sResources.getString(CHECK_CODE_TITLE));
  mCheckCodeTextView = new RichTextField();
  mCheckCodeTextView.setText(sResources.getString(CHECK_CODE));

  mCodeArea = new HorizontalFieldManager(FIELD_HCENTER);

  Bitmap bitmap = Bitmap.getBitmapResource("ic_lock_lock.png");
  BitmapField icon = new BitmapField(bitmap, FIELD_VCENTER);

  mCodeTextView = new LabelField("", FIELD_VCENTER);
  mCodeArea.add(icon);
  mCodeArea.add(mCodeTextView);

  ApplicationDescriptor applicationDescriptor = ApplicationDescriptor
      .currentApplicationDescriptor();
  String version = applicationDescriptor.getVersion();
  mVersionText = new LabelField(version, FIELD_RIGHT | FIELD_BOTTOM);

  add(mCheckCodeTextView);
  add(mCodeArea);
  add(mVersionText);
}
 
开发者ID:google,项目名称:google-authenticator,代码行数:25,代码来源:CheckCodeScreen.java


示例17: createImage

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public Object createImage(InputStream i) throws IOException {
    java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
    byte[] buf = new byte[2048];
    int len;
    while ((len = i.read(buf)) > -1) {
        out.write(buf, 0, len);
    }
    out.close();
    i.close();
    byte[] b = out.toByteArray();
    return Bitmap.createBitmapFromBytes(b, 0, b.length, 1);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:13,代码来源:BlackBerryImplementation.java


示例18: createMutableImage

import net.rim.device.api.system.Bitmap; //导入依赖的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


示例19: getByHexString

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public Bitmap getByHexString(String s) {
    int i1 = 0, i2 = 0;
    if (s.length() == 8) {
        String s1 = s.substring(0, 4);
        String s2 = s.substring(4);
        i1 = Integer.parseInt(s1, 16);
        i2 = Integer.parseInt(s2, 16);
    } else if (s.length() == 4) {
        i1 = Integer.parseInt(s, 16);
        i2 = 0;
    }

    s = Emoticons.getEmoticonString(i1, i2);
    return getEmoticon(s);
}
 
开发者ID:yanex,项目名称:vika,代码行数:16,代码来源:Emoticons.java


示例20: getEmoticon

import net.rim.device.api.system.Bitmap; //导入依赖的package包/类
public Bitmap getEmoticon(String t) {
    Object o = Emoticons.emoticons.get(t);
    if (o == null) {
        return null;
    }

    return (Bitmap) o;
}
 
开发者ID:yanex,项目名称:vika,代码行数:9,代码来源:Emoticons.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConditionalOnResource类代码示例发布时间:2022-05-22
下一篇:
Java CellConfigAttributes类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap