Java Code Examples for com.google.zxing.PlanarYUVLuminanceSource#renderThumbnail()

The following examples show how to use com.google.zxing.PlanarYUVLuminanceSource#renderThumbnail() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DecodeHandler.java    From myapplication with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 2
Source File: DecodeHandler.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
	int[] pixels = source.renderThumbnail();
	int width = source.getThumbnailWidth();
	int height = source.getThumbnailHeight();
	Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
	ByteArrayOutputStream out = new ByteArrayOutputStream();
	bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
	bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 3
Source File: DecodeHandler.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
/**
 * create thumbnail
 *
 * @param source
 * @param bundle
 */

private void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.RGB_565);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 4
Source File: DecodeHandler.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 5
Source File: DecodeHandler.java    From AirFree-Client with GNU General Public License v3.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 6
Source File: DecodeHandler.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
    bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
 
Example 7
Source File: DecodeHandler.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
  int[] pixels = source.renderThumbnail();
  int width = source.getThumbnailWidth();
  int height = source.getThumbnailHeight();
  Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
  ByteArrayOutputStream out = new ByteArrayOutputStream();    
  bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
  bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
  bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
 
Example 8
Source File: QRCodeCameraDecode.java    From ZxingSupport with Apache License 2.0 5 votes vote down vote up
private static byte[] bundleThumbnail(PlanarYUVLuminanceSource source) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    return  out.toByteArray();
}
 
Example 9
Source File: DecodeHandler.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
	int[] pixels = source.renderThumbnail();
	int width = source.getThumbnailWidth();
	int height = source.getThumbnailHeight();
	Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
	ByteArrayOutputStream out = new ByteArrayOutputStream();
	bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
	bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 10
Source File: DecodeHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
  int[] pixels = source.renderThumbnail();
  int width = source.getThumbnailWidth();
  int height = source.getThumbnailHeight();
  Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
  ByteArrayOutputStream out = new ByteArrayOutputStream();    
  bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
  bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
  bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
 
Example 11
Source File: DecodeHandler.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
	int[] pixels = source.renderThumbnail();
	int width = source.getThumbnailWidth();
	int height = source.getThumbnailHeight();
	Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
	ByteArrayOutputStream out = new ByteArrayOutputStream();
	bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
	bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 12
Source File: DecodeHandler.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
  int[] pixels = source.renderThumbnail();
  int width = source.getThumbnailWidth();
  int height = source.getThumbnailHeight();
  Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
  ByteArrayOutputStream out = new ByteArrayOutputStream();    
  bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
  bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
  bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
 
Example 13
Source File: DecodeHandler.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
  int[] pixels = source.renderThumbnail();
  int width = source.getThumbnailWidth();
  int height = source.getThumbnailHeight();
  Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
  ByteArrayOutputStream out = new ByteArrayOutputStream();    
  bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
  bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
  bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
 
Example 14
Source File: DecodeHandler.java    From QRScanner with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 15
Source File: DecodeHandler.java    From Gizwits-SmartSocket_Android with MIT License 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
	int[] pixels = source.renderThumbnail();
	int width = source.getThumbnailWidth();
	int height = source.getThumbnailHeight();
	Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
	ByteArrayOutputStream out = new ByteArrayOutputStream();
	bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
	bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
}
 
Example 16
Source File: DecodeHandler.java    From CodeScaner with MIT License 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
  int[] pixels = source.renderThumbnail();
  int width = source.getThumbnailWidth();
  int height = source.getThumbnailHeight();
  Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
  bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
  bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
 
Example 17
Source File: DecodeHandler.java    From ScanZxing with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source,
		Bundle bundle) {
	int[] pixels = source.renderThumbnail();
	int width = source.getThumbnailWidth();
	int height = source.getThumbnailHeight();
	Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height,
			Bitmap.Config.ARGB_8888);
	ByteArrayOutputStream out = new ByteArrayOutputStream();
	bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
	bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
	bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width
			/ source.getWidth());
}
 
Example 18
Source File: DecodeHandler.java    From FoodOrdering with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source,
		Bundle bundle) {
	int[] pixels = source.renderThumbnail();
	int width = source.getThumbnailWidth();
	int height = source.getThumbnailHeight();
	Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height,
			Bitmap.Config.ARGB_8888);
	ByteArrayOutputStream out = new ByteArrayOutputStream();
	bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
	bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
	bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width
			/ source.getWidth());
}
 
Example 19
Source File: DecodeHandler.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 处理缩略图
 * @param source {@link PlanarYUVLuminanceSource}
 * @param bundle 存储数据 {@link Bundle}
 */
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeConfig.BARCODE_BITMAP, out.toByteArray());
}
 
Example 20
Source File: DecodeHandler.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
    int[] pixels = source.renderThumbnail();
    int width = source.getThumbnailWidth();
    int height = source.getThumbnailHeight();
    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
    bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}