Search in sources :

Example 86 with Point

use of android.graphics.Point in project MagicCamera by wuhaoyu1990.

the class MainActivity method initConstants.

private void initConstants() {
    Point outSize = new Point();
    getWindowManager().getDefaultDisplay().getRealSize(outSize);
    Constants.mScreenWidth = outSize.x;
    Constants.mScreenHeight = outSize.y;
}
Also used : Point(android.graphics.Point)

Example 87 with Point

use of android.graphics.Point in project MagicCamera by wuhaoyu1990.

the class CameraActivity method initView.

private void initView() {
    mFilterLayout = (LinearLayout) findViewById(R.id.layout_filter);
    mFilterListView = (RecyclerView) findViewById(R.id.filter_listView);
    btn_shutter = (ImageView) findViewById(R.id.btn_camera_shutter);
    btn_mode = (ImageView) findViewById(R.id.btn_camera_mode);
    findViewById(R.id.btn_camera_filter).setOnClickListener(btn_listener);
    findViewById(R.id.btn_camera_closefilter).setOnClickListener(btn_listener);
    findViewById(R.id.btn_camera_shutter).setOnClickListener(btn_listener);
    findViewById(R.id.btn_camera_switch).setOnClickListener(btn_listener);
    findViewById(R.id.btn_camera_mode).setOnClickListener(btn_listener);
    findViewById(R.id.btn_camera_beauty).setOnClickListener(btn_listener);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    mFilterListView.setLayoutManager(linearLayoutManager);
    mAdapter = new FilterAdapter(this, types);
    mFilterListView.setAdapter(mAdapter);
    mAdapter.setOnFilterChangeListener(onFilterChangeListener);
    animator = ObjectAnimator.ofFloat(btn_shutter, "rotation", 0, 360);
    animator.setDuration(500);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    Point screenSize = new Point();
    getWindowManager().getDefaultDisplay().getSize(screenSize);
    MagicCameraView cameraView = (MagicCameraView) findViewById(R.id.glsurfaceview_camera);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) cameraView.getLayoutParams();
    params.width = screenSize.x;
    params.height = screenSize.x * 4 / 3;
    cameraView.setLayoutParams(params);
}
Also used : MagicCameraView(com.seu.magicfilter.widget.MagicCameraView) RelativeLayout(android.widget.RelativeLayout) FilterAdapter(com.seu.magiccamera.adapter.FilterAdapter) Point(android.graphics.Point) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 88 with Point

use of android.graphics.Point in project ZI by yixia.

the class ColorPickerView method drawAlphaPanel.

private void drawAlphaPanel(Canvas canvas) {
    if (!mShowAlphaPanel || mAlphaRect == null || mAlphaPattern == null)
        return;
    final RectF rect = mAlphaRect;
    if (BORDER_WIDTH_PX > 0) {
        mBorderPaint.setColor(mBorderColor);
        canvas.drawRect(rect.left - BORDER_WIDTH_PX, rect.top - BORDER_WIDTH_PX, rect.right + BORDER_WIDTH_PX, rect.bottom + BORDER_WIDTH_PX, mBorderPaint);
    }
    mAlphaPattern.draw(canvas);
    float[] hsv = new float[] { mHue, mSat, mVal };
    int color = Color.HSVToColor(hsv);
    int acolor = Color.HSVToColor(0, hsv);
    mAlphaShader = new LinearGradient(rect.left, rect.top, rect.right, rect.top, color, acolor, TileMode.CLAMP);
    mAlphaPaint.setShader(mAlphaShader);
    canvas.drawRect(rect, mAlphaPaint);
    if (mAlphaSliderText != null && mAlphaSliderText != "") {
        canvas.drawText(mAlphaSliderText, rect.centerX(), rect.centerY() + 4 * mDensity, mAlphaTextPaint);
    }
    float rectWidth = 4 * mDensity / 2;
    Point p = alphaToPoint(mAlpha);
    RectF r = new RectF();
    r.left = p.x - rectWidth;
    r.right = p.x + rectWidth;
    r.top = rect.top - RECTANGLE_TRACKER_OFFSET;
    r.bottom = rect.bottom + RECTANGLE_TRACKER_OFFSET;
    canvas.drawRoundRect(r, 2, 2, mHueTrackerPaint);
}
Also used : RectF(android.graphics.RectF) LinearGradient(android.graphics.LinearGradient) Point(android.graphics.Point) Point(android.graphics.Point) Paint(android.graphics.Paint)

Example 89 with Point

use of android.graphics.Point in project ZI by yixia.

the class ColorPickerView method alphaToPoint.

private Point alphaToPoint(int alpha) {
    final RectF rect = mAlphaRect;
    final float width = rect.width();
    Point p = new Point();
    p.x = (int) (width - (alpha * width / 0xff) + rect.left);
    p.y = (int) rect.top;
    return p;
}
Also used : RectF(android.graphics.RectF) Point(android.graphics.Point)

Example 90 with Point

use of android.graphics.Point in project ZI by yixia.

the class ColorPickerView method drawSatValPanel.

private void drawSatValPanel(Canvas canvas) {
    final RectF rect = mSatValRect;
    if (BORDER_WIDTH_PX > 0) {
        mBorderPaint.setColor(mBorderColor);
        canvas.drawRect(mDrawingRect.left, mDrawingRect.top, rect.right + BORDER_WIDTH_PX, rect.bottom + BORDER_WIDTH_PX, mBorderPaint);
    }
    if (mValShader == null) {
        mValShader = new LinearGradient(rect.left, rect.top, rect.left, rect.bottom, 0xffffffff, 0xff000000, TileMode.CLAMP);
    }
    int rgb = Color.HSVToColor(new float[] { mHue, 1f, 1f });
    mSatShader = new LinearGradient(rect.left, rect.top, rect.right, rect.top, 0xffffffff, rgb, TileMode.CLAMP);
    ComposeShader mShader = new ComposeShader(mValShader, mSatShader, PorterDuff.Mode.MULTIPLY);
    mSatValPaint.setShader(mShader);
    canvas.drawRect(rect, mSatValPaint);
    Point p = satValToPoint(mSat, mVal);
    mSatValTrackerPaint.setColor(0xff000000);
    canvas.drawCircle(p.x, p.y, PALETTE_CIRCLE_TRACKER_RADIUS - 1f * mDensity, mSatValTrackerPaint);
    mSatValTrackerPaint.setColor(0xffdddddd);
    canvas.drawCircle(p.x, p.y, PALETTE_CIRCLE_TRACKER_RADIUS, mSatValTrackerPaint);
}
Also used : RectF(android.graphics.RectF) LinearGradient(android.graphics.LinearGradient) ComposeShader(android.graphics.ComposeShader) Point(android.graphics.Point) Point(android.graphics.Point) Paint(android.graphics.Paint)

Aggregations

Point (android.graphics.Point)1151 Display (android.view.Display)217 Rect (android.graphics.Rect)194 Paint (android.graphics.Paint)170 WindowManager (android.view.WindowManager)138 RemoteException (android.os.RemoteException)76 RectF (android.graphics.RectF)62 Bitmap (android.graphics.Bitmap)54 Resources (android.content.res.Resources)41 View (android.view.View)41 ArrayList (java.util.ArrayList)40 ImageView (android.widget.ImageView)37 Camera (android.hardware.Camera)36 Canvas (android.graphics.Canvas)31 Matrix (android.graphics.Matrix)29 Animator (android.animation.Animator)27 SuppressLint (android.annotation.SuppressLint)27 Configuration (android.content.res.Configuration)26 IOException (java.io.IOException)24 Message (android.os.Message)22