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;
}
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);
}
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);
}
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;
}
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);
}
Aggregations