项目:GCSApp
文件:PhotoViewAttacher.java
private void setimageViewMatrix(Matrix matrix) {
ImageView imageView = getimageView();
if (null != imageView) {
checkImageViewScaleType();
imageView.setimageMatrix(matrix);
// Call MatrixChangedListener if needed
if (null != mMatrixchangelistener) {
RectF displayRect = getdisplayRect(matrix);
if (null != displayRect) {
mMatrixchangelistener.onMatrixChanged(displayRect);
}
}
}
}
private void drawPacman(Canvas canvas,Paint paint){
float x=getWidth()/2;
float y=getHeight()/2;
canvas.save();
canvas.translate(x,y);
canvas.rotate(degrees1);
paint.setAlpha(255);
RectF rectF1=new RectF(-x/1.7f,-y/1.7f,x/1.7f,y/1.7f);
canvas.drawArc(rectF1,270,true,paint);
canvas.restore();
canvas.save();
canvas.translate(x,y);
canvas.rotate(degrees2);
paint.setAlpha(255);
RectF rectF2=new RectF(-x/1.7f,y/1.7f);
canvas.drawArc(rectF2,90,paint);
canvas.restore();
}
项目:ImitateZHRB
文件:PacmanIndicator.java
private void drawPacman(Canvas canvas,paint);
canvas.restore();
}
项目:Hitalk
文件:Bubble.java
private void initBottomroundedpath(RectF rect,Path path,float strokeWidth) {
path.moveto(rect.left + mCornersRadius + strokeWidth,rect.top + strokeWidth);
path.lineto(rect.width() - mCornersRadius - strokeWidth,rect.top + strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius,rect.top + strokeWidth,rect.right - strokeWidth,mCornersRadius + rect.top),90);
path.lineto(rect.right - strokeWidth,rect.bottom - mArrowHeight - mCornersRadius - strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius,rect.bottom - mCornersRadius - mArrowHeight,rect.bottom - mArrowHeight - strokeWidth),90);
path.lineto(rect.left + mArrowWidth + mArrowPosition - (strokeWidth / 2),rect.bottom - mArrowHeight - strokeWidth);
path.lineto(rect.left + mArrowPosition + mArrowWidth / 2,rect.bottom - strokeWidth - strokeWidth);
path.lineto(rect.left + mArrowPosition + (strokeWidth / 2),rect.bottom - mArrowHeight - strokeWidth);
path.lineto(rect.left + Math.min(mCornersRadius,mArrowPosition) + strokeWidth,rect.bottom - mArrowHeight - strokeWidth);
path.arcTo(new RectF(rect.left + strokeWidth,mCornersRadius + rect.left,90);
path.lineto(rect.left + strokeWidth,rect.top + mCornersRadius + strokeWidth);
path.arcTo(new RectF(rect.left + strokeWidth,mCornersRadius
+ rect.left,180,90);
path.close();
}
/**
* Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`.
* This method should not to be called until the camera preview size is determined in
* openCamera,or until the size of `mTextureView` is fixed.
*
* @param viewWidth The width of `mTextureView`
* @param viewHeight The height of `mTextureView`
*/
private void configureTransform(int viewWidth,int viewHeight) {
Activity activity = getActivity();
if (null == mTextureView || null == mPreviewSize || null == activity) {
return;
}
int rotation = activity.getwindowManager().getDefaultdisplay().getRotation();
Matrix matrix = new Matrix();
RectF viewRect = new RectF(0,viewWidth,viewHeight);
RectF bufferRect = new RectF(0,mPreviewSize.getHeight(),mPreviewSize.getWidth());
float centerX = viewRect.centerX();
float centerY = viewRect.centerY();
if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
bufferRect.offset(centerX - bufferRect.centerX(),centerY - bufferRect.centerY());
matrix.setRectToRect(viewRect,bufferRect,Matrix.ScaletoFit.FILL);
float scale = Math.max(
(float) viewHeight / mPreviewSize.getHeight(),(float) viewWidth / mPreviewSize.getWidth());
matrix.postScale(scale,scale,centerX,centerY);
matrix.postRotate(90 * (rotation - 2),centerY);
}
mTextureView.setTransform(matrix);
}
项目:ReadMark
文件:ALetter.java
protected void initConfig(int x,int y){
mPaint = new Paint();
mPaint.setStyle(Paint.Style.stroke);
mPaint.setstrokeWidth(mstrokeWidth);
mPaint.setAntiAlias(true);
mPaint.setColor(Config.WHITE);
mPaint.setstrokeCap(Paint.Cap.SQUARE);
mRectF = new RectF(x - MAX_RADIUS_CIRCLE,y - MAX_RADIUS_CIRCLE,x + MAX_RADIUS_CIRCLE,y + MAX_RADIUS_CIRCLE);
mFirPoint = new Point(x + MAX_RADIUS_CIRCLE,y - MAX_RADIUS_CIRCLE);
mSecPoint = new Point(mFirPoint);
}
项目:PeSanKita-android
文件:VerticalSlideColorPicker.java
@Override
protected void onSizeChanged(int w,int h,int oldw,int oldh) {
super.onSizeChanged(w,h,oldw,oldh);
viewWidth = w;
viewHeight = h;
centerX = viewWidth / 2;
colorPickerRadius = (viewWidth / 2) - borderWidth;
colorPickerBody = new RectF(centerX - colorPickerRadius,borderWidth + colorPickerRadius,centerX + colorPickerRadius,viewHeight - (borderWidth + colorPickerRadius));
LinearGradient gradient = new LinearGradient(0,colorPickerBody.top,colorPickerBody.bottom,colors,null,Shader.TileMode.CLAMP);
paint.setShader(gradient);
if (bitmap != null) {
bitmap.recycle();
}
bitmap = Bitmap.createBitmap(viewWidth,viewHeight,Bitmap.Config.ARGB_8888);
bitmapCanvas = new Canvas(bitmap);
resetToDefault();
}
项目:YCUtils
文件:MaterialRippleLayout.java
@Override
public void draw(Canvas canvas) {
final boolean positionChanged = adapterPositionChanged();
if (rippleOverlay) {
if (!positionChanged) {
rippleBackground.draw(canvas);
}
super.draw(canvas);
if (!positionChanged) {
if (rippleRoundedCorners != 0) {
Path clipPath = new Path();
RectF rect = new RectF(0,canvas.getWidth(),canvas.getHeight());
clipPath.addRoundRect(rect,rippleRoundedCorners,Path.Direction.CW);
canvas.clipPath(clipPath);
}
canvas.drawCircle(currentCoords.x,currentCoords.y,radius,paint);
}
} else {
if (!positionChanged) {
rippleBackground.draw(canvas);
canvas.drawCircle(currentCoords.x,paint);
}
super.draw(canvas);
}
}
项目:LeCatApp
文件:MLImageView.java
private void drawBorder(Canvas canvas){
if(mBorderWidth > 0){
Paint paint = new Paint();
paint.setstrokeWidth(mBorderWidth);
paint.setStyle(Paint.Style.stroke);
paint.setColor(mBorderColor);
paint.setAntiAlias(true);
if (mShapeType == 0) {
canvas.drawCircle(mWidth / 2,mHeight / 2,mWidth / 2,paint);
} else {
// 当ShapeType = 1 时 图片为圆角矩形
RectF rectf = new RectF(0,getWidth(),getHeight());
canvas.drawRoundRect(rectf,mRadius,paint);
}
}
}
private Bitmap getTweetimage(String url) {
byte[] image_b = getimageByte(url);
Bitmap image;
if (image_b != null) {
image = BitmapFactory.decodeByteArray(image_b,image_b.length);
} else {
image = BitmapFactory.decodeResource(context.getResources(),R.drawable.pessoa_foto_default);
}
Bitmap imageRounded = Bitmap.createBitmap(image.getWidth(),image.getHeight(),image.getConfig());
Canvas canvas = new Canvas(imageRounded);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setShader(new BitmapShader(image,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP));
canvas.drawRoundRect((new RectF(0,image.getWidth(),image.getHeight())),12,paint);
return imageRounded;
}
项目:baselibrary-master
文件:GlideRoundTransform.java
private static Bitmap roundCrop(BitmapPool pool,Bitmap source)
{
if (source == null) return null;
Bitmap result = pool.get(source.getWidth(),source.getHeight(),Bitmap.Config.ARGB_8888);
if (result == null)
{
result = Bitmap.createBitmap(source.getWidth(),Bitmap.Config.ARGB_8888);
}
Canvas canvas = new Canvas(result);
Paint paint = new Paint();
paint.setShader(new BitmapShader(source,BitmapShader.TileMode.CLAMP,BitmapShader.TileMode.CLAMP));
paint.setAntiAlias(true);
RectF rectF = new RectF(0f,0f,source.getWidth(),source.getHeight());
canvas.drawRoundRect(rectF,paint);
return result;
}
项目:SimpleUILauncher
文件:WallpaperPickerActivity.java
@Override
public void onClick(final WallpaperPickerActivity a) {
a.setWallpaperButtonEnabled(false);
final BitmapRegionTileSource.ResourceBitmapSource bitmapSource =
new BitmapRegionTileSource.ResourceBitmapSource(mResources,mResId);
a.setCropViewTileSource(bitmapSource,false,new CropViewScaleAndOffsetProvider() {
@Override
public float getScale(Point wallpaperSize,RectF crop) {
return wallpaperSize.x /crop.width();
}
@Override
public float getParallaxOffset() {
return a.getWallpaperParallaxOffset();
}
},new Runnable() {
@Override
public void run() {
if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) {
a.setWallpaperButtonEnabled(true);
}
}
});
}
项目:Phoenix-for-VK
文件:ImageHelper.java
public static Bitmap getRoundedBitmap(Bitmap bitmap) {
if(bitmap == null){
return null;
}
final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),bitmap.getHeight(),Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(output);
final Paint paint = new Paint();
final Rect rect = new Rect(0,bitmap.getWidth(),bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
canvas.drawARGB(0,0);
paint.setColor(0xff424242);
canvas.drawoval(rectF,paint);
paint.setXfermode(PORTER_DUFF_XFERMODE);
canvas.drawBitmap(bitmap,rect,paint);
bitmap.recycle();
return output;
}
项目:GitHub
文件:HorizontalBarChart.java
@Override
public void getBarBounds(BarEntry e,RectF outputRect) {
RectF bounds = outputRect;
IBarDataSet set = mData.getDataSetForEntry(e);
if (set == null) {
outputRect.set(Float.MIN_VALUE,Float.MIN_VALUE,Float.MIN_VALUE);
return;
}
float y = e.getY();
float x = e.getX();
float barWidth = mData.getBarWidth();
float top = x - barWidth / 2f;
float bottom = x + barWidth / 2f;
float left = y >= 0 ? y : 0;
float right = y <= 0 ? y : 0;
bounds.set(left,top,right,bottom);
getTransformer(set.getAxisDependency()).rectValuetoPixel(bounds);
}
项目:JueDiQiuSheng
文件:GhostsEyeLoadingRenderer.java
private Path createLeftEyeCircle(RectF arcBounds,float offsetY) {
Path path = new Path();
//the center of the left eye
float leftEyeCenterX = arcBounds.centerX() - mEyeInterval / 2.0f - mEyeCircleRadius;
float leftEyeCenterY = arcBounds.centerY() + offsetY;
//the bounds of left eye
RectF leftEyeBounds = new RectF(leftEyeCenterX - mEyeCircleRadius,leftEyeCenterY - mEyeCircleRadius,leftEyeCenterX + mEyeCircleRadius,leftEyeCenterY + mEyeCircleRadius);
path.addArc(leftEyeBounds,DEGREE_180 + 15);
//the above radian of of the eye
path.quadTo(leftEyeBounds.left + mAboveRadianEyeOffsetX,leftEyeBounds.top + mEyeCircleRadius * 0.2f,leftEyeBounds.left + mAboveRadianEyeOffsetX / 4.0f,leftEyeBounds.top - mEyeCircleRadius * 0.15f);
return path;
}
项目:ReadMark
文件:DLetter.java
@Override
protected void initConfig(int x,int y) {
mPaint = new Paint();
mPaint.setStyle(Paint.Style.stroke);
mPaint.setstrokeWidth(mstrokeWidth);
mPaint.setAntiAlias(true);
mPaint.setColor(Config.WHITE);
mPaint.setstrokeCap(Paint.Cap.SQUARE);
mRectF = new RectF(x - MAX_RADIUS_CIRCLE,y + MAX_RADIUS_CIRCLE);
mFirPoint = new Point(x + MAX_RADIUS_CIRCLE,y - 2 * MAX_RADIUS_CIRCLE);
mSecPoint = new Point(mFirPoint);
}
项目:Excuser
文件:TextDrawable.java
private void drawBorder(Canvas canvas) {
RectF rect = new RectF(getBounds());
rect.inset(borderThickness/2,borderThickness/2);
if (shape instanceof ovalShape) {
canvas.drawoval(rect,borderPaint);
}
else if (shape instanceof RoundRectShape) {
canvas.drawRoundRect(rect,borderPaint);
}
else {
canvas.drawRect(rect,borderPaint);
}
}
RoundRectDrawableWithShadow(Resources resources,int backgroundColor,float radius,float shadowSize,float maxShadowSize) {
this.mShadowStartColor = resources.getColor(R.color.cardview_shadow_start_color);
this.mShadowEndColor = resources.getColor(R.color.cardview_shadow_end_color);
this.mInsetShadow = resources.getDimensionPixelSize(R.dimen.cardview_compat_inset_shadow);
this.mPaint = new Paint(5);
this.mPaint.setColor(backgroundColor);
this.mCornerShadowPaint = new Paint(5);
this.mCornerShadowPaint.setStyle(Style.FILL);
this.mCornerRadius = (float) ((int) (0.5f + radius));
this.mCardBounds = new RectF();
this.mEdgeShadowPaint = new Paint(this.mCornerShadowPaint);
this.mEdgeShadowPaint.setAntiAlias(false);
setShadowSize(shadowSize,maxShadowSize);
}
项目:android-titanium-imagecropper
文件:CropWindowMoveHandler.java
/**
* Change the size of the crop window on the required edge (or edges for corner size move) without
* affecting "secondary" edges.<br>
* Only the primary edge(s) are fixed to stay within limits.
*/
private void moveSizeWithFreeAspectRatio(
RectF rect,float x,float y,RectF bounds,int viewWidth,int viewHeight,float snapMargin) {
switch (mType) {
case TOP_LEFT:
adjustTop(rect,y,bounds,snapMargin,false);
adjustLeft(rect,x,false);
break;
case TOP_RIGHT:
adjustTop(rect,false);
adjustRight(rect,false);
break;
case BottOM_LEFT:
adjustBottom(rect,false);
break;
case BottOM_RIGHT:
adjustBottom(rect,false);
break;
case LEFT:
adjustLeft(rect,false);
break;
case TOP:
adjustTop(rect,false);
break;
case RIGHT:
adjustRight(rect,false);
break;
case BottOM:
adjustBottom(rect,false);
break;
default:
break;
}
}
项目:AndelaTrackChallenge
文件:InkPageIndicator.java
public InkPageIndicator(Context context,AttributeSet attrs,int defStyle) {
super(context,attrs,defStyle);
final int density = (int) context.getResources().getdisplayMetrics().density;
// Load attributes
final TypedArray a = getContext().obtainStyledAttributes(
attrs,R.styleable.InkPageIndicator,defStyle,0);
dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter,DEFAULT_DOT_SIZE * density);
doTradius = dotDiameter / 2;
halfDoTradius = doTradius / 2;
gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap,DEFAULT_GAP * density);
animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration,DEFAULT_ANIM_DURATION);
animHalfDuration = animDuration / 2;
unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor,DEFAULT_UNSELECTED_COLOUR);
selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor,DEFAULT_SELECTED_COLOUR);
a.recycle();
unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
unselectedPaint.setColor(unselectedColour);
selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
selectedPaint.setColor(selectedColour);
interpolator = new FastOutSlowInInterpolator();
// create paths & rect Now – reuse & rewind later
combinedUnselectedpath = new Path();
unselectedDotPath = new Path();
unselectedDotLeftPath = new Path();
unselectedDotRightPath = new Path();
rectF = new RectF();
addOnAttachStatechangelistener(this);
}
@Override
public void process(Bitmap output,Bitmap source) {
cornerRadii(sComputedCornerRadii);
output.setHasAlpha(true);
if (FloatUtil.floatsEqual(sComputedCornerRadii[0],0f) &&
FloatUtil.floatsEqual(sComputedCornerRadii[1],0f) &&
FloatUtil.floatsEqual(sComputedCornerRadii[2],0f) &&
FloatUtil.floatsEqual(sComputedCornerRadii[3],0f)) {
super.process(output,source);
return;
}
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setShader(new BitmapShader(source,Shader.TileMode.CLAMP));
Canvas canvas = new Canvas(output);
float[] radii = new float[8];
geTradii(source,sComputedCornerRadii,radii);
Path pathForBorderRadius = new Path();
pathForBorderRadius.addRoundRect(
new RectF(0,source.getHeight()),radii,Path.Direction.CW);
canvas.drawPath(pathForBorderRadius,paint);
}
@Override
public void draw(Canvas canvas,Paint paint) {
float translateX=getWidth()/9;
float translateY=getHeight()/2;
for (int i = 0; i < 4; i++) {
canvas.save();
canvas.translate((2 + i * 2) * translateX - translateX / 2,translateY);
canvas.scale(scaleFloats[i],scaleFloats[i]);
RectF rectF=new RectF(-translateX/2,-getHeight()/2.5f,translateX/2,getHeight()/2.5f);
canvas.drawRoundRect(rectF,5,paint);
canvas.restore();
}
}
项目:Dachshund-Tab-Layout
文件:LineMoveIndicator.java
public LineMoveIndicator(DachshundTabLayout dachshundTabLayout){
this.dachshundTabLayout = dachshundTabLayout;
linearInterpolator = new LinearInterpolator();
valueAnimatorLeft = new ValueAnimator();
valueAnimatorLeft.setDuration(DEFAULT_DURATION);
valueAnimatorLeft.addUpdateListener(this);
valueAnimatorLeft.setInterpolator(linearInterpolator);
valueAnimatorRight = new ValueAnimator();
valueAnimatorRight.setDuration(DEFAULT_DURATION);
valueAnimatorRight.addUpdateListener(this);
valueAnimatorRight.setInterpolator(linearInterpolator);
rectF = new RectF();
rect = new Rect();
paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);
leftX = (int) dachshundTabLayout.getChildXLeft(dachshundTabLayout.getCurrentPosition());
rightX = (int) dachshundTabLayout.getChildXRight(dachshundTabLayout.getCurrentPosition());
edgeRadius = -1;
}
项目:FastLib
文件:GlideManager.java
private Bitmap roundCrop(BitmapPool pool,Bitmap source) {
Bitmap result = pool.get(source.getWidth(),Bitmap.Config.ARGB_8888);
if (result == null) {
result = Bitmap.createBitmap(source.getWidth(),paint);
return result;
}
项目:PicKing
文件:Attacher.java
private RectF getdisplayRect(Matrix matrix) {
DraweeView<GenericDraweeHierarchy> draweeView = getDraweeView();
if (draweeView == null || (mImageInfoWidth == -1 && mImageInfoHeight == -1)) {
return null;
}
mdisplayRect.set(0.0F,0.0F,mImageInfoWidth,mImageInfoHeight);
draweeView.getHierarchy().getActualImageBounds(mdisplayRect);
matrix.mapRect(mdisplayRect);
return mdisplayRect;
}
private RectF upscaleRect(final RectF downsampledFrameRect) {
return new RectF(
downsampledFrameRect.left * DOWNSAMPLE_FACTOR,downsampledFrameRect.top * DOWNSAMPLE_FACTOR,downsampledFrameRect.right * DOWNSAMPLE_FACTOR,downsampledFrameRect.bottom * DOWNSAMPLE_FACTOR);
}
项目:TensorFlowAndroidDynamic
文件:Classifier.java
public Recognition(
final String id,final String title,final Float confidence,final RectF location) {
this.id = id;
this.title = title;
this.confidence = confidence;
this.location = location;
}
项目:SuperSelector
文件:CropImageView.java
private void adjustRatio() {
if (mImageRect == null) return;
float imgW = mImageRect.right - mImageRect.left;
float imgH = mImageRect.bottom - mImageRect.top;
float frameW = getRatioX(imgW);
float frameH = getRatioY(imgH);
float imgRatio = imgW / imgH;
float frameRatio = frameW / frameH;
float l = mImageRect.left,t = mImageRect.top,r = mImageRect.right,b = mImageRect.bottom;
if (frameRatio >= imgRatio) {
l = mImageRect.left;
r = mImageRect.right;
float hy = (mImageRect.top + mImageRect.bottom) * 0.5f;
float hh = (imgW / frameRatio) * 0.5f;
t = hy - hh;
b = hy + hh;
} else if (frameRatio < imgRatio) {
t = mImageRect.top;
b = mImageRect.bottom;
float hx = (mImageRect.left + mImageRect.right) * 0.5f;
float hw = imgH * frameRatio * 0.5f;
l = hx - hw;
r = hx + hw;
}
float w = r - l;
float h = b - t;
float cx = l + w / 2;
float cy = t + h / 2;
float sw = w * mInitialFrameScale;
float sh = h * mInitialFrameScale;
mFrameRect = new RectF(cx - sw / 2,cy - sh / 2,cx + sw / 2,cy + sh / 2);
invalidate();
}
项目:starcor.xul
文件:XulMassiveRender.java
public RectF getItemRect(int idx,RectF rect) {
if (idx < 0 || idx >= _data.size()) {
return null;
}
_ItemData itemData = _data.get(idx);
if (!itemData.isInitialized()) {
return null;
}
rect.set(itemData.relativeLeft,itemData.relativetop,itemData.relativeLeft + itemData.width,itemData.relativetop + itemData.height
);
XulUtils.offsetRect(rect,_screenX,_screenY);
return rect;
}
项目:godlibrary
文件:PinchImageView.java
/**
* 获取当前设置的mask
*
* @return 返回当前的mask对象副本,如果当前没有设置mask则返回null
*/
public RectF getMask() {
if (mMask != null) {
return new RectF(mMask);
} else {
return null;
}
}
项目:MontageCam
文件:RotateImageView.java
@Test
public void shouldDrawoval() {
RectF rect = mock(RectF.class);
rect.left = LEFT;
rect.top = TOP;
rect.right = RIGHT;
rect.bottom = BottOM;
ovalParams params = new ovalParams(rect,paint);
int result = params.draw(canvas);
verify(canvas).drawoval(rect,paint);
assertthat(result,is(CanvasParams.NO_SAVE));
}
项目:SimpleUILauncher
文件:FolderIcon.java
public void drawBackground(Canvas canvas,Paint paint) {
canvas.save();
canvas.translate(getoffsetX(),getoffsetY());
paint.reset();
paint.setStyle(Paint.Style.FILL);//充满
paint.setColor(Color.LTGRAY);
paint.setAntiAlias(true);
paint.setAlpha(100);
RectF oval3 = new RectF(0,mBackground.previewSize,mBackground.previewSize);
canvas.drawRoundRect(oval3,40,paint);
canvas.restore();
}
项目:Amazing
文件:FadingTextView.java
@Override
protected void onSizeChanged(int w,int oldh) {
super.onSizeChanged(w,oldh);
height = h;
width = w;
initPaint();
rectF = new RectF(0,w,h);
}
项目:JueDiQiuSheng
文件:BalloonLoadingRenderer.java
private Path createCannulaBottomPath(RectF cannulaRect) {
RectF cannulaHeadRect = new RectF(cannulaRect.left,cannulaRect.bottom - 0.833f * cannulaRect.width(),cannulaRect.right,cannulaRect.bottom);
Path path = new Path();
path.addRoundRect(cannulaHeadRect,mRectCornerRadius,Path.Direction.ccw);
return path;
}
项目:android_camera_experiment
文件:CircleProgressView.java
public CircleProgressView(Context context,AttributeSet attrs) {
super(context,attrs);
final int strokeWidth = 8;
paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.stroke);
paint.setstrokeWidth(strokeWidth);
paint.setstrokeCap(Paint.Cap.ROUND);
//Circle color
paint.setColor(Color.WHITE);
basePaint = new Paint();
basePaint.setAntiAlias(true);
basePaint.setStyle(Paint.Style.stroke);
basePaint.setstrokeWidth(strokeWidth);
basePaint.setstrokeCap(Paint.Cap.ROUND);
basePaint.setColor(Color.WHITE);
basePaint.setAlpha(122);
//size 200x200 example
rect = new RectF(strokeWidth,strokeWidth,240 + strokeWidth,240 + strokeWidth);
//Initial Angle (optional,it can be zero)
angle = 0;
}
项目:TPlayer
文件:BorderShape.java
public BorderShape(RectF border,float dashWidth,float dashGap) {
if (border.left != 0 || border.top != 0 || border.right != 0 || border.bottom != 0) {
mBorder = border;
if (dashWidth > 0 && dashGap > 0) {
mPathEffect = new DashPathEffect(new float[]{dashWidth,dashGap},0);
mPath = new Path();
}
}
}
项目:JsoupSample
文件:TouchImageView.java
/**
* Return a Rect representing the zoomed image.
*
* @return rect representing zoomed image
*/
public RectF getZoomedRect() {
if (mScaleType == ScaleType.FIT_XY) {
throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
}
PointF topLeft = transformCoordTouchToBitmap(0,true);
PointF bottomright = transformCoordTouchToBitmap(viewWidth,true);
float w = getDrawable().getIntrinsicWidth();
float h = getDrawable().getIntrinsicHeight();
return new RectF(topLeft.x / w,topLeft.y / h,bottomright.x / w,bottomright.y / h);
}
项目:KTalk
文件:PhotoViewAttacher.java
public final boolean onSingleTapConfirmed(MotionEvent e) {
ImageView imageView = getimageView();
if (null != imageView) {
if (null != mPhotoTapListener) {
final RectF displayRect = getdisplayRect();
if (null != displayRect) {
final float x = e.getX(),y = e.getY();
// Check to see if the user tapped on the photo
if (displayRect.contains(x,y)) {
float xResult = (x - displayRect.left) / displayRect.width();
float yResult = (y - displayRect.top) / displayRect.height();
mPhotoTapListener.onPhotoTap(imageView,xResult,yResult);
return true;
}
}
}
if (null != mViewTapListener) {
mViewTapListener.onViewTap(imageView,e.getX(),e.getY());
}
}
return false;
}
项目:Renrentou
文件:CircleImageView.java
private RectF calculateBounds() {
int availableWidth = getWidth() - getPaddingLeft() - getPaddingRight();
int availableHeight = getHeight() - getPaddingTop() - getPaddingBottom();
int sideLength = Math.min(availableWidth,availableHeight);
float left = getPaddingLeft() + (availableWidth - sideLength) / 2f;
float top = getPaddingTop() + (availableHeight - sideLength) / 2f;
return new RectF(left,left + sideLength,top + sideLength);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。