android-canvas

how to change color of pen on button click in android

混江龙づ霸主 提交于 2020-01-17 03:12:28
问题 I have made a simple android program for singletouch paint, in it I have aut 4 types of pens of different sizes and I want is based on that image I want to change strokesize of pen. I have tried as below, please help me: main.java public class MainActivity extends Activity implements OnClickListener { ImageView pen, color; SingleTouchView mDrawView; RelativeLayout layout, layout1; ImageView remove; ImageView eraser; LinearLayout pens; HorizontalScrollView myplate; private Paint mPaint,

how to change color of pen on button click in android

主宰稳场 提交于 2020-01-17 03:12:07
问题 I have made a simple android program for singletouch paint, in it I have aut 4 types of pens of different sizes and I want is based on that image I want to change strokesize of pen. I have tried as below, please help me: main.java public class MainActivity extends Activity implements OnClickListener { ImageView pen, color; SingleTouchView mDrawView; RelativeLayout layout, layout1; ImageView remove; ImageView eraser; LinearLayout pens; HorizontalScrollView myplate; private Paint mPaint,

When saving the new image it keeps the old canvas

大兔子大兔子 提交于 2020-01-15 15:17:12
问题 I have a canvas which allows user to draw and save. It also allows user to change color and draw on the same canvas with different colors. My Paint class: package com.test.testing; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Paint.Style; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.TextView;

When saving the new image it keeps the old canvas

吃可爱长大的小学妹 提交于 2020-01-15 15:13:01
问题 I have a canvas which allows user to draw and save. It also allows user to change color and draw on the same canvas with different colors. My Paint class: package com.test.testing; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Paint.Style; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.TextView;

When saving the new image it keeps the old canvas

荒凉一梦 提交于 2020-01-15 15:12:55
问题 I have a canvas which allows user to draw and save. It also allows user to change color and draw on the same canvas with different colors. My Paint class: package com.test.testing; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Paint.Style; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.TextView;

Are Paths the most efficient way to draw changing shapes?

旧巷老猫 提交于 2020-01-15 11:24:59
问题 The app I'm building has to draw around 400 quadrilateral shapes onto the screen with a fluent frame rate. The shapes 255 permutations and are drawn rotated anywhere from 0-360 degrees. I don't think pre-rendering them would efficient, given the amount of memory it would take (I could be wrong though). They also have a 24-bit color range. Right now I'm drawing them with paths and all the rotation and translation is handled by the function generating the values. Although this implementation is

Are Paths the most efficient way to draw changing shapes?

巧了我就是萌 提交于 2020-01-15 11:24:28
问题 The app I'm building has to draw around 400 quadrilateral shapes onto the screen with a fluent frame rate. The shapes 255 permutations and are drawn rotated anywhere from 0-360 degrees. I don't think pre-rendering them would efficient, given the amount of memory it would take (I could be wrong though). They also have a 24-bit color range. Right now I'm drawing them with paths and all the rotation and translation is handled by the function generating the values. Although this implementation is

draw a curve line with arrow in android canvas

丶灬走出姿态 提交于 2020-01-15 07:29:05
问题 draw a curved line with arrow from point1(x1,y1) to point2(x2,y2) like this I'm developing an application in android canvas. automata like application and I'm having trouble drawing a curved line with an arrow at the end. pointing the next circle. can u give me a code or suggestion about this? 回答1: I think what You need is a mix out of draw on path and line drawing. Declare this method inside Your onDraw: private void drawOvalAndArrow(Canvas canvas){ Paint circlePaint = new Paint();

Android Path addArc in canvas between two points

谁都会走 提交于 2020-01-15 04:29:28
问题 I'm trying to draw an arc in android. In IOS, it's really easy to do it with this method [path addArcWithCenter: radius: startAngle: endAngle: clockwise:] In android, I have 3 points (the center of my circle, and the two points I want to draw an arc between) : Point center = new Point(..., ...); Point p1 = new Point(..., ...); Point p2 = new Point(..., ...); int radius = (int) Math.sqrt(Math.pow(p1.x - center.x, 2) + Math.pow(p1.y - center.y, 2)); But how can I use the Path.addArc method to

Android Canvas drawText not working

不问归期 提交于 2020-01-15 03:19:04
问题 I made a custom view using canvas's drawText method. Somehow none of the text is showing on any of the Jelly Bean devices. It works fine for ICS and below. Does anyone know if anything has changed from API 15 to 16 for this method or any related methods? Edit Code: (from the draw method where canvas is supplied as a parameter) paint = new Paint(); paint.setAntiAlias(true); paint.setStrokeWidth(3); paint.setColor(context.getResources().getColor(R.color.plot_background)); canvas.drawRect(new