Examples of BitMap


Examples of android.graphics.Bitmap

          Bitmap.Config.ARGB_8888);
    }
   
    static public void toDisplay(Context context, RgbImage rgb)
    {
      Bitmap bmp = toBitmap(rgb);
     
    }
View Full Code Here

Examples of android.graphics.Bitmap

    static public void toFile(Context context, RgbImage rgb, int nQuality, String szPath)
      throws IOException
    {
       OutputStream os = new FileOutputStream(szPath);
       try {
         Bitmap bmp = toBitmap(rgb);
         Bitmap.CompressFormat format = Bitmap.CompressFormat.JPEG;
         szPath = szPath.toLowerCase();
         if (szPath.endsWith("jpg") || szPath.endsWith("jpeg")) { //$NON-NLS-1$ //$NON-NLS-2$
           format = Bitmap.CompressFormat.JPEG;
         } else if (szPath.endsWith("png")) { //$NON-NLS-1$
           format = Bitmap.CompressFormat.PNG;
         }
         bmp.compress(format, nQuality, os);
       } finally {
         os.close();
       }
    }
View Full Code Here

Examples of android.graphics.Bitmap

    public boolean onKeyDown(int keyCode, KeyEvent msg) {
      boolean handled = false;
     
      if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
        this.mPreviewThread.interrupt();
        Bitmap bmp = Bitmap.createBitmap(1280, 1024, false);
        Canvas c = new Canvas(bmp);
        this.mCamera.capture(c);
        this.mDhp.setImage(bmp);
        this.mDhp.Push();
      }
View Full Code Here

Examples of android.graphics.Bitmap

    public boolean onKeyDown(int keyCode, KeyEvent msg) {
      boolean handled = false;
     
      if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
        this.mPreviewThread.interrupt();
        Bitmap bmp = Bitmap.createBitmap(1280, 1024, false);
        Canvas c = new Canvas(bmp);
        this.mCamera.capture(c);
        RgbImage inimg = RgbImageAndroid.toRgbImage(bmp);
        DetectBarcode db = new DetectBarcode(20000);
        if (!db.Push(inimg)) {
View Full Code Here

Examples of android.graphics.Bitmap

            public void run() {
              mFaceView.resetFaces();
              mFaceView.resetShowX();
              BitmapFactory.Options opt = new BitmapFactory.Options();
              opt.inSampleSize = 4;
              final Bitmap bmp = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length, opt);
          mFaceView.setImageBitmap(bmp);
            }
          });
         
      try {
        Thread t = new Thread() {
          public void run() {
            for (int nSample = 16; nSample >= 8 && !mFaceView.hasFaces(); nSample /= 2) {
                  BitmapFactory.Options opt = new BitmapFactory.Options();
                  opt.inSampleSize = nSample;
                  final Bitmap bmp = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length, opt);
              mRgbCurrent = RgbImageAndroid.toRgbImage(bmp);
                  mDhp.push(mRgbCurrent);
                    for (Enumeration<jjil.core.Rect> e = mDhp.getResult(); e.hasMoreElements();) {
                      jjil.core.Rect r = e.nextElement();
                      int nTop = (r.getTop() * mFaceView.getHeight()) / mRgbCurrent.getHeight();
View Full Code Here

Examples of android.graphics.Bitmap

        DisplayMetrics metrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metrics);
        final int width = metrics.widthPixels;
        final int height = metrics.heightPixels;

        final Bitmap lBmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        final Canvas lCanvas = new Canvas(lBmp);
        final ImageView lImgView = new ImageView(this);

        lImgView.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        lImgView.setImageBitmap(lBmp);
View Full Code Here

Examples of bdsup2sub.bitmap.Bitmap

        if (w > pic.getWidth() || h > pic.getHeight()) {
            throw new CoreException("Subpicture too large: " + w + "x" + h + " at offset " + ToolBox.toHexLeftZeroPadded(pic.getImageBufferOffsetEven(), 8));
        }

        Bitmap bm = new Bitmap(w, h, (byte)transIdx);

        int sizeEven = pic.getImageBufferOffsetOdd() - pic.getImageBufferOffsetEven();
        int sizeOdd = pic.getImageBufferSize() + pic.getImageBufferOffsetEven() - pic.getImageBufferOffsetOdd();

        if (sizeEven <= 0 || sizeOdd <= 0) {
            throw new CoreException("Corrupt buffer offset information");
        }

        byte evenBuf[] = new byte[sizeEven];
        byte oddBuf[]  = new byte[sizeOdd];

        try {
            // copy buffers
            try {
                for (int i=0; i < evenBuf.length; i++) {
                    evenBuf[i] = (byte)buffer.getByte(pic.getImageBufferOffsetEven() + i);
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
                warnings++;
            }
            try {
                for (int i=0; i < oddBuf.length; i++) {
                    oddBuf[i= (byte)buffer.getByte(pic.getImageBufferOffsetOdd() +i);
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
                warnings++;
            }
            // decode even lines
            try {
                BitStream even = new BitStream(evenBuf);
                decodeLine(bm.getInternalBuffer(), 0, w, w*(h/2+(h&1)), even);
            } catch (ArrayIndexOutOfBoundsException ex) {
                warnings++;
            }
            // decode odd lines
            try {
                BitStream odd  = new BitStream(oddBuf);
                decodeLine(bm.getInternalBuffer(), w, w, (h/2)*w, odd);
            } catch (ArrayIndexOutOfBoundsException ex) {
                warnings++;
            }

            if (warnings > 0) {
View Full Code Here

Examples of cli.System.Drawing.Bitmap

                Util.throwException(new NotSupportedException());
            }
           
        };
        try{
            Bitmap bitmap = new Bitmap(stream);
            int width = bitmap.get_Width();
            int height = bitmap.get_Height();
            int size = width * height;
            int[] pixelData = new int[size];
           
            cli.System.Drawing.Rectangle rect = new cli.System.Drawing.Rectangle(0, 0, width, height);
            cli.System.Drawing.Imaging.BitmapData data = bitmap.LockBits(rect, ImageLockMode.wrap(ImageLockMode.ReadOnly), PixelFormat.wrap(PixelFormat.Format32bppArgb));
            cli.System.IntPtr pixelPtr = data.get_Scan0();
            cli.System.Runtime.InteropServices.Marshal.Copy(pixelPtr, pixelData, 0, size);       
            bitmap.UnlockBits(data);
           
            //source.
           
            setDimensions(width, height);
            ColorModel cm = ColorModel.getRGBdefault();
View Full Code Here

Examples of com.badlogic.gdx.graphics.g2d.freetype.FreeType.Bitmap

    }

    GlyphSlot slot = face.getGlyph();

    // Try to render to bitmap
    Bitmap bitmap;
    if (bitmapped) {
      bitmap = slot.getBitmap();
    } else if (!FreeType.renderGlyph(slot, FreeType.FT_RENDER_MODE_LIGHT)) {
      bitmap = null;
    } else {
      bitmap = slot.getBitmap();
    }

    GlyphMetrics metrics = slot.getMetrics();

    Glyph glyph = new Glyph();
    if (bitmap != null) {
      glyph.width = bitmap.getWidth();
      glyph.height = bitmap.getRows();
    } else {
      glyph.width = 0;
      glyph.height = 0;
    }
    glyph.xoffset = slot.getBitmapLeft();
View Full Code Here

Examples of com.badlogic.gdx.graphics.g2d.freetype.FreeType.Bitmap

        Gdx.app.log("FreeTypeFontGenerator", "Couldn't render char '" + c + "'");
        continue;
      }
      GlyphSlot slot = face.getGlyph();
      GlyphMetrics metrics = slot.getMetrics();
      Bitmap bitmap = slot.getBitmap();
      Pixmap pixmap = bitmap.getPixmap(Format.RGBA8888);
      Glyph glyph = new Glyph();
      glyph.id = (int)c;
      glyph.width = pixmap.getWidth();
      glyph.height = pixmap.getHeight();
      glyph.xoffset = slot.getBitmapLeft();
      glyph.yoffset = parameter.flip ? -slot.getBitmapTop() + (int)baseLine : -(glyph.height - slot.getBitmapTop())
        - (int)baseLine;
      glyph.xadvance = FreeType.toInt(metrics.getHoriAdvance());

      if (bitmapped) {
        pixmap.setColor(Color.CLEAR);
        pixmap.fill();
        ByteBuffer buf = bitmap.getBuffer();
        for (int h = 0; h < glyph.height; h++) {
          int idx = h * bitmap.getPitch();
          for (int w = 0; w < (glyph.width + glyph.xoffset); w++) {
            int bit = (buf.get(idx + (w / 8)) >>> (7 - (w % 8))) & 1;
            pixmap.drawPixel(w, h, ((bit == 1) ? Color.WHITE.toIntBits() : Color.CLEAR.toIntBits()));
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.