android Programming Glossary: canvas.translate
Draw Rectangle Over ImageView for highlight that can be zoom in-out in android http://stackoverflow.com/questions/10482229/draw-rectangle-over-imageview-for-highlight-that-can-be-zoom-in-out-in-android x1 y1 PRESET_SIZE size paint canvas.save canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor mBitmapDrawable.draw..
Android Image View Pinch Zooming http://stackoverflow.com/questions/10630373/android-image-view-pinch-zooming 1 backgroundPaint if this.getDrawable null canvas.save canvas.translate mPosX mPosY Matrix matrix new Matrix matrix.postScale mScaleFactor..
Vertical (rotated) label in Android http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android t r l @Override public void draw Canvas canvas if topDown canvas.translate getHeight 0 canvas.rotate 90 else canvas.translate 0 getWidth.. topDown canvas.translate getHeight 0 canvas.rotate 90 else canvas.translate 0 getWidth canvas.rotate 90 canvas.clipRect 0 0 getWidth getHeight.. getDrawableState canvas.save if topDown canvas.translate getWidth 0 canvas.rotate 90 else canvas.translate 0 getHeight..
Android color picker to be included in the activity http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity Canvas canvas float r CENTER_X mPaint.getStrokeWidth 0.5f canvas.translate CENTER_X CENTER_X canvas.drawOval new RectF r r r r mPaint canvas.drawCircle..
Android listview row delete animation http://stackoverflow.com/questions/17857775/android-listview-row-delete-animation 0 0 getWidth mOpenAreaHeight canvas.save canvas.translate 0 mOpenAreaTop mShadowedBackground.draw canvas canvas.restore..
Fast Scroll display problem with ListAdapter and SectionIndexer http://stackoverflow.com/questions/3225092/fast-scroll-display-problem-with-listadapter-and-sectionindexer left 0 viewWidth mThumbH mChangedBounds true canvas.translate 0 y mCurrentThumb.draw canvas canvas.translate 0 y If user is.. true canvas.translate 0 y mCurrentThumb.draw canvas canvas.translate 0 y If user is dragging the scroll bar draw the alphabet overlay..
Using clipRect - explantion http://stackoverflow.com/questions/3331805/using-cliprect-explantion undocumented View ViewGroup drawing code I found that canvas.translate x y also adjusts the clipRect. The interaction of clipRect and..
Android custom view Bitmap memory leak http://stackoverflow.com/questions/4197794/android-custom-view-bitmap-memory-leak resizedBitmap space 0 null if xPos 0 yPos 0 canvas.translate xPos space position.getWidth 2 yPos position.getHeight 2 canvas.drawBitmap.. resizedBitmap.get space 0 null if xPos 0 yPos 0 canvas.translate xPos space position.get .getWidth 2 yPos position.get .getHeight..
Android: Moving background image while navigating through Views http://stackoverflow.com/questions/4775650/android-moving-background-image-while-navigating-through-views Draw background image at its current locations canvas.save canvas.translate X 0 background.draw canvas canvas.restore ViewFlipper.java..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events canvas canvas.save Log.d DEBUG X mPosX Y mPosY canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor mImage.draw..
Pinch Zoom in android for an imageview? http://stackoverflow.com/questions/6758847/pinch-zoom-in-android-for-an-imageview canvas canvas.save Log.d DEBUG X mPosX Y mPosY canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor mImage.draw..
Get Canvas coordinates after scaling up/down or dragging in android http://stackoverflow.com/questions/7524843/get-canvas-coordinates-after-scaling-up-down-or-dragging-in-android void onDraw Canvas canvas super.onDraw canvas canvas.save canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor super.getWidth..
How to find absolute position of click while zoomed in http://stackoverflow.com/questions/8180442/how-to-find-absolute-position-of-click-while-zoomed-in void onDraw Canvas canvas super.onDraw canvas canvas.save canvas.translate mCenterScaleX mCenterScaleY canvas.scale mScaleFactor mScaleFactor.. mCenterScaleY canvas.scale mScaleFactor mScaleFactor canvas.translate mCenterScaleX mCenterScaleY mIcon.draw canvas canvas.restore..
Draw Rectangle Over ImageView for highlight that can be zoom in-out in android http://stackoverflow.com/questions/10482229/draw-rectangle-over-imageview-for-highlight-that-can-be-zoom-in-out-in-android pressure 8 int PRESET_PRESSURE pressure mCanvas.drawCircle x1 y1 PRESET_SIZE size paint canvas.save canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor mBitmapDrawable.draw canvas Paint myPaint new Paint myPaint.setColor..
Android Image View Pinch Zooming http://stackoverflow.com/questions/10630373/android-image-view-pinch-zooming onDraw Canvas canvas canvas.drawRect 0 0 getWidth 1 getHeight 1 backgroundPaint if this.getDrawable null canvas.save canvas.translate mPosX mPosY Matrix matrix new Matrix matrix.postScale mScaleFactor mScaleFactor pivotPointX pivotPointY canvas.setMatrix..
Vertical (rotated) label in Android http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android int l int t int r int b return super.setFrame l t l b t t r l @Override public void draw Canvas canvas if topDown canvas.translate getHeight 0 canvas.rotate 90 else canvas.translate 0 getWidth canvas.rotate 90 canvas.clipRect 0 0 getWidth getHeight android.graphics.Region.Op.REPLACE.. l t l b t t r l @Override public void draw Canvas canvas if topDown canvas.translate getHeight 0 canvas.rotate 90 else canvas.translate 0 getWidth canvas.rotate 90 canvas.clipRect 0 0 getWidth getHeight android.graphics.Region.Op.REPLACE super.draw canvas.. getPaint textPaint.setColor getCurrentTextColor textPaint.drawableState getDrawableState canvas.save if topDown canvas.translate getWidth 0 canvas.rotate 90 else canvas.translate 0 getHeight canvas.rotate 90 canvas.translate getCompoundPaddingLeft..
Android color picker to be included in the activity http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity boolean mHighlightCenter @Override protected void onDraw Canvas canvas float r CENTER_X mPaint.getStrokeWidth 0.5f canvas.translate CENTER_X CENTER_X canvas.drawOval new RectF r r r r mPaint canvas.drawCircle 0 0 CENTER_RADIUS mCenterPaint if mTrackingCenter..
Android listview row delete animation http://stackoverflow.com/questions/17857775/android-listview-row-delete-animation Canvas canvas if mShowing if mUpdateBounds mShadowedBackground.setBounds 0 0 getWidth mOpenAreaHeight canvas.save canvas.translate 0 mOpenAreaTop mShadowedBackground.draw canvas canvas.restore Layout files LinearLayout xmlns android http schemas.android.com..
Fast Scroll display problem with ListAdapter and SectionIndexer http://stackoverflow.com/questions/3225092/fast-scroll-display-problem-with-listadapter-and-sectionindexer viewWidth mThumbW alpha ScrollFade.ALPHA_MAX mCurrentThumb.setBounds left 0 viewWidth mThumbH mChangedBounds true canvas.translate 0 y mCurrentThumb.draw canvas canvas.translate 0 y If user is dragging the scroll bar draw the alphabet overlay if mDragging.. mCurrentThumb.setBounds left 0 viewWidth mThumbH mChangedBounds true canvas.translate 0 y mCurrentThumb.draw canvas canvas.translate 0 y If user is dragging the scroll bar draw the alphabet overlay if mDragging mDrawOverlay mOverlayDrawable.draw canvas..
Using clipRect - explantion http://stackoverflow.com/questions/3331805/using-cliprect-explantion Another note after long frustration with the apparently largely undocumented View ViewGroup drawing code I found that canvas.translate x y also adjusts the clipRect. The interaction of clipRect and the drawing matrix is very confusing. It is helpful to print..
Android custom view Bitmap memory leak http://stackoverflow.com/questions/4197794/android-custom-view-bitmap-memory-leak protected void onDraw Canvas canvas if mapBitmap null canvas.drawBitmap resizedBitmap space 0 null if xPos 0 yPos 0 canvas.translate xPos space position.getWidth 2 yPos position.getHeight 2 canvas.drawBitmap position new Matrix new Paint public void updatePosition.. void onDraw Canvas canvas if mapBitmap null canvas.drawBitmap resizedBitmap.get space 0 null if xPos 0 yPos 0 canvas.translate xPos space position.get .getWidth 2 yPos position.get .getHeight 2 canvas.drawBitmap position.get new Matrix null public..
Android: Moving background image while navigating through Views http://stackoverflow.com/questions/4775650/android-moving-background-image-while-navigating-through-views the scrolling X scroll 5 scroll BadScrollHelp.getScrollX Draw background image at its current locations canvas.save canvas.translate X 0 background.draw canvas canvas.restore ViewFlipper.java package de.android.projects import android.content.Context import..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events return true @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save Log.d DEBUG X mPosX Y mPosY canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor mImage.draw canvas canvas.restore private class ScaleListener extends..
Pinch Zoom in android for an imageview? http://stackoverflow.com/questions/6758847/pinch-zoom-in-android-for-an-imageview return true @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save Log.d DEBUG X mPosX Y mPosY canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor mImage.draw canvas canvas.restore private class ScaleListener extends..
Get Canvas coordinates after scaling up/down or dragging in android http://stackoverflow.com/questions/7524843/get-canvas-coordinates-after-scaling-up-down-or-dragging-in-android Also I'm new bee. Here is the code. @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor super.getWidth 0.5f super.getHeight 0.5f mIcon.draw canvas for Path path..
How to find absolute position of click while zoomed in http://stackoverflow.com/questions/8180442/how-to-find-absolute-position-of-click-while-zoomed-in the centre ands draw's the image to it. @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save canvas.translate mCenterScaleX mCenterScaleY canvas.scale mScaleFactor mScaleFactor canvas.translate mCenterScaleX mCenterScaleY mIcon.draw.. super.onDraw canvas canvas.save canvas.translate mCenterScaleX mCenterScaleY canvas.scale mScaleFactor mScaleFactor canvas.translate mCenterScaleX mCenterScaleY mIcon.draw canvas canvas.restore This all works fine when scaling from ScaleFactor 1 this is..
|