Package android.graphics

Examples of android.graphics.Canvas


      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();
      }
      return handled;
View Full Code Here


            // asked to quit.
            SurfaceHolder holder = mHolder;
            while (!mDone) {
                // Lock the surface, this returns a Canvas that can
                // be used to render into.
                Canvas canvas = holder.lockCanvas();

                // Capture directly into the Surface
                if (mCamera != null) {
                    mCamera.capture(canvas);
                }
View Full Code Here

      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

            // asked to quit.
            SurfaceHolder holder = mHolder;
            while (!mDone) {
                // Lock the surface, this returns a Canvas that can
                // be used to render into.
                Canvas canvas = holder.lockCanvas();

                // Capture directly into the Surface
                if (mCamera != null) {
                    //mCamera.capture(canvas);
                }
View Full Code Here

        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);
        lImgView.setScaleType(ImageView.ScaleType.CENTER);
        lImgView.setPadding(0, 0, 0, 0);

        final Paint bck = new Paint();
        bck.setARGB(0xff, 0x80, 0x80, 0x80);
        lCanvas.drawRect(0, 0, width, height, bck);

        final Paint p = new Paint();
        p.setARGB(0xff, 0xff, 0x00, 0xff);
 
        mLinearLayout.addView(lImgView);
        setContentView(mLinearLayout);

        lImgView.setOnTouchListener(new OnTouchListener() {

            // start and end coordinates for a single line
            float sx, sy, ex, ey;

            public boolean onTouch(View aView, MotionEvent aME) {

                Rect lRect = new Rect();
                Window lWindow = getWindow();
                lWindow.getDecorView().getWindowVisibleDisplayFrame(lRect);
                int lStatusBarHeight = lRect.top;
                int lContentViewTop =
                        lWindow.findViewById(Window.ID_ANDROID_CONTENT).getTop();
                final int lTitleBarHeight = lContentViewTop - lStatusBarHeight;

                int lAction = aME.getAction();

                float lX = aME.getX();
                float lY = aME.getY();

                switch (lAction) {
                    case MotionEvent.ACTION_DOWN:
                        ex = lX;
                        ey = lY + lTitleBarHeight;
                        break;
                    case MotionEvent.ACTION_MOVE:
                        sx = ex;
                        sy = ey;
                        ex = lX;
                        ey = lY + lTitleBarHeight;
                        lCanvas.drawLine(sx, sy, ex, ey, p);
                        break;
                    case MotionEvent.ACTION_UP:
                    case MotionEvent.ACTION_CANCEL:
                        break;
                }
View Full Code Here

TOP

Related Classes of android.graphics.Canvas

Copyright © 2018 www.massapicom. 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.