Android Open Source - OrzEye Draw Rect View






From Project

Back to project page OrzEye.

License

The source code is released under:

GNU General Public License

If you think the Android project OrzEye listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dylan.orzeye;
//from  www  .  ja  v  a 2 s. co m
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.widget.ImageView;

public class DrawRectView extends ImageView {
  Context mContext;

  public DrawRectView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;
  }

  Paint paint = new Paint();
  {
    paint.setAntiAlias(true);
    paint.setColor(Color.GREEN);
    paint.setStyle(Style.STROKE);
    paint.setStrokeWidth(2.5f);
    paint.setAlpha(100);
  };

  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    if (mContext instanceof CameraActivity) {
      DisplayMetrics dm = ((CameraActivity) mContext).getDisplayMetrics();
      int width = dm.widthPixels;
      int height = dm.heightPixels;
      canvas.drawRect(width/5, height/8, width - width/5, height/4, paint);
      canvas.clipRect(width/5, height/8, width - width/5, height/4);
      canvas.drawARGB(100, 0, 0, 0);
      canvas.drawLine(width/2-20,(height/8+height/4)/2,width/2+20,(height/8+height/4)/2,paint);
      canvas.drawLine(width/2,(height/8+height/4)/2-20,width/2,(height/8+height/4)/2+20,paint);
    }
  }
}




Java Source Code List

com.dylan.orzeye.CameraActivity.java
com.dylan.orzeye.DrawRectView.java
com.dylan.orzeye.SplashActivity.java
com.dylan.orzeye.dictionary.DictionaryTool.java
com.dylan.orzeye.dictionary.YoudaoJsonParser.java
com.dylan.orzeye.dictionary.YoudaoTranslaterAPIConnection.java
com.dylan.orzeye.dictionary.YoudaoTranslater.java
com.dylan.orzeye.image.ImageProcessTool.java
com.dylan.orzeye.ocr.OCRTool.java