draw

How to outline a TextView?

 ̄綄美尐妖づ 提交于 2019-11-28 11:34:24
What I want to do? (blue will be changed as white) What I did? I have found a class which extends TextView that able to outline textview very close to what I want. The problem is that I could not change stroke color to any color, it draws always as black. How to set border color as white? What is my output: Where are my codes? public class TypeFaceTextView extends TextView { private static Paint getWhiteBorderPaint(){ Paint p = new Paint(Color.WHITE); return p; } private static final Paint BLACK_BORDER_PAINT = getWhiteBorderPaint(); static { BLACK_BORDER_PAINT.setXfermode(new

Regarding Android Paint drawing color

一世执手 提交于 2019-11-28 11:27:41
DrawView.java public class DrawView extends View implements OnTouchListener { private Canvas mCanvas; private Path mPath; public Paint mPaint; ArrayList<Path> paths = new ArrayList<Path>(); private ArrayList<Path> undonePaths = new ArrayList<Path>(); private MaskFilter mEmboss; private MaskFilter mBlur; private Bitmap im; public DrawView(Context context) { super(context); setFocusable(true); setFocusableInTouchMode(true); this.setOnTouchListener(this); paths.clear(); undonePaths.clear(); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(Color.BLUE);

Android - drawing path as overlay on MapView

别说谁变了你拦得住时间么 提交于 2019-11-28 10:23:11
I have a class that extends Overlay and implemments Overlay.Snappable. I have overriden its draw method: @Override public void draw(Canvas canvas, MapView mv, boolean shadow) { Projection projection = mv.getProjection(); ArrayList<GeoPoint> geoPoints = new ArrayList<GeoPoint>(); //Creating geopoints - ommited for readability Path p = new Path(); for (int i = 0; i < geoPoints.size(); i++) { if (i == geoPoints.size() - 1) { break; } Point from = new Point(); Point to = new Point(); projection.toPixels(geoPoints.get(i), from); projection.toPixels(geoPoints.get(i + 1), to); p.moveTo(from.x, from.y

How can I center Graphics.drawString() in Java?

僤鯓⒐⒋嵵緔 提交于 2019-11-28 09:37:53
I'm currently working on the menu system for my Java game, and I wonder how I can center the text from Graphics.drawString() , so that if I want to draw a text whose center point is at X: 50 and Y: 50 , and the text is 30 pixels wide and 10 pixels tall, the text will start at X: 35 and Y: 45 . Can I determine the width of the text before I draw it? Then it would be easy maths. EDIT: I also wonder if I can get the height of the text, so that I can center it vertically too. Any help is appreciated! Daniel Kvist I used the answer on this question . The code I used looks something like this: /** *

java draw line as the mouse is moved

◇◆丶佛笑我妖孽 提交于 2019-11-28 09:33:56
I would like to add a feature to my application which allows the user to draw a straight line by clicking the mouse at the start location and releasing it at the end location. The line should move as the mouse moves until it is finally released; similar to the way that a line can be drawn using the Microsoft Paint application. How can implement this so that the line is repainted as it moves without repainting other things that may already be drawn in that rectangular area? Try this...Draw a red line on the screen as the mouse is moved (dragged). public static void main(String args[]) throws

Android Drawing bitmap and button on canvas by X Y Positions

杀马特。学长 韩版系。学妹 提交于 2019-11-28 06:35:18
问题 i'm new into android and i have some problems with my app. Any help will be appreciated :) I have drawing bitmap on canvas by xpositon and ypostion by sensors (when i'm moving my phone, bitmaps are moving ) I need to create moving clickable button on center of my bitmaps and when i click them i will go to next activity . Bitmaps are drawing perfectly but idont know how to draw buttons on them, buttons that will be moving with my bitmap by the same values of x and y. How i can do that? This is

Android transparent canvas (surfaceview)

限于喜欢 提交于 2019-11-28 06:06:08
I've got a panel which is placed on top of another view via a relativelayout. I would like to give this panel a transparent background, but didn't find the correct way to do this after searching for some hours. When I set the alpha back to 0 I end up with a black background. Hopefully someone here can help me with this. Thanks a lot! The panel is drawn via this code: import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.view.SurfaceHolder; import android.view.SurfaceView; public class Panel extends

android: quality of the images resized in runtime

大憨熊 提交于 2019-11-28 06:01:40
I want to show images using drawBitmap() method. But before I want to resize it according screen dimensions. I have a problem with quality of result image. You can see screenshots and test code below. How can I resize images in runtime with a good quality? Thank you for solutions. Original image: alt text http://dl.dropbox.com/u/709109/gradient.png Result screenshot on device: alt text http://dl.dropbox.com/u/709109/device.png import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Rect; import

Draw a rectangle in Golang?

最后都变了- 提交于 2019-11-28 05:53:56
I want to draw a mailing label with some rectangles, barcodes, and then finally generate a PNG/PDF file. Is there is a better way to draw a shape in Go other than to do it with primitives - pixel by pixel? The standard Go library does not provide primitive drawing or painting capabilities. What it provides is models for colors ( image/color package) and an Image interface with several implementations ( image package). The blog post The Go Image package is a good introduction to this. It also provides a capability to combine images (e.g. draw them on each other) with different operations in the

Android : Zoom Image And Draw line on image with current zoom

核能气质少年 提交于 2019-11-28 05:16:58
问题 I am using ImageView support zooming.Right now I am extending the ImageView so i can draw on canvas . Currently i Have setImageResource setting a drawable and In onDraw(canvas); i am drawing some line over a path then drawing that over the canvas. The problem is when i try zooming, the image zooms perfectly but the drawing that was drawn over the canvas is not zooming. it just stays in place. Steps - First screen Image view - Zoom Imageview. - Now Draw on Image like signature,line,circle etc