Questions tagged [android-canvas]

The Android Java Canvas (android.graphics.Canvas)

This is the tag for the Android Java Canvas, android.graphics.Canvas (official documentation).

If your question is about HTML5 (JavaScript) Canvas on Android devices please tag it and .

3799 questions
1
vote
1 answer

Why is my cardview not being drawn onto canvas?

I'm trying to draw a cardview onto a pdf its canvas. Unfortunately the cardview is not drawn. However some test text is drawn. Why is my carview not drawn? Code: // start a page PdfDocument.Page page = document.startPage(pageInfo); …
Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
1
vote
1 answer

view.getDrawingCache() returns null only in Samsung Galaxy note 8.0?

**Note : (For Nerds) Don't mark it as a duplicate question. Yes I know what's a NullPointerException is. yes I have tried view.getDrawingCache returns null answers from Stackoverflow. I am trying to develop a drawing application for tablets…
HourGlass
  • 1,805
  • 1
  • 15
  • 29
1
vote
0 answers

Dynamic drawing on canvas taking too long

I wanted to draw a grid of quads with an animated colour property but ended up with code that is too slow just to create a basic structure of an image, not to mention to animate it. Also, the image is drawing, not as it finished to compute, but in…
Katherine
  • 576
  • 1
  • 7
  • 19
1
vote
1 answer

How to draw a curved arrow in canvas android

I have this code to draw the arrow tail line between 2 point but how should I draw curved line for arrow tail? canvas.drawLine(pt1[X], pt1[Y], pt2[X], pt2[Y], paint);//draw line I want to have something like this, whereby the arrow is dynamic
Zheng Xian
  • 310
  • 1
  • 3
  • 13
1
vote
2 answers

create a button programatically with sharp edge containing image

I wanted to create a custom button or view progrmatically with a simple image and text as shown in image, where edge is of button not of image. Please don't use xml. Any help would be greatly appreciated. I wanted to learn and create custom view…
1
vote
0 answers

Position an Overlay Image onto Canvas

Hello There I am working on an Android Application that takes an Image from the gallery and add a watermarks on it. It has the following features: The Screen is manually locked to portrait mode by me in manifest.xml The user can drag the water mark…
Android Nerd
  • 625
  • 1
  • 8
  • 13
1
vote
1 answer

How Draw circle on Zoom able and scroll able imageview android?

I am developing an application and requirements are as below. Display image with pinch zoom and pan. For this I am using TouchImageview.java from here And it is working as expected. Draw solid circle on Image. This is also working. public class…
Biraj Zalavadia
  • 28,348
  • 10
  • 61
  • 77
1
vote
2 answers

Android drawing an arc in custom view using sweep gradient with multiple colors

I'm trying draw a custom view which has an Arc which will be filled with gradient of 4 colors and I choose SweepGradient to be suitable for this and when I tried it works fine for two colors and even if add more colors I'm not able to get the other…
Kingston
  • 474
  • 5
  • 14
1
vote
2 answers

What is the correct way to horizontally add some spaced image into a Canvas?

I am absolutly new in Android development and I have the followind doubt. I have to draw images one next to each other into a Canvas object. So let to an example: I have this icon (it is pretty huge and I have to resize it): So I have to put 3 of…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
1
vote
2 answers

canvas.drawRect Not drawing rectangle on image

Here canvas.drawRect is working differently with different bitmap. I want the rectangle to be drawn on top image and want the part of image outside rectangle to be dull or blur. Please help me. draw.setOnClickListener(new View.OnClickListener() { …
Krishna
  • 601
  • 2
  • 9
  • 32
1
vote
1 answer

How to make image coloring in Android

I'm new to Android Graphics and would appreciate if you can advise an algorithm to color particular part of image with outlines. I would like to create similar to this application. I should be able to fill in parts of the image with colors, or use…
Gyuzal
  • 1,581
  • 10
  • 52
  • 99
1
vote
0 answers

Draw on SurfaceView with Bitmap as background

In my Android application, I have an image view with a bitmap. I want to be able to draw rectangle or freehand when user touches this image view. I can currently draw these shapes using canvas. However if I use canvas I have to copy the bitmap in…
1
vote
0 answers

Canvas c =surfaceHolder.lockCanvas(rect) ;c.drawColor(color) ; the rect will be redrawed

Canvas c = surfaceHolder.lockCanvas(rect) ; c.drawColor(color) ; The previous rect will be redrawn by the color. I want to retain the previous rect, but can't remove c.drawColor(color), what should I do ?
Kam
  • 13
  • 1
  • 4
1
vote
1 answer

getting a part of a Canvas as a Bitmap

I'm trying to get a part of SurfaceView's canvas and save it as a Bitmap. Every answer i've seen about it was creating a new Canvas and passing it your Bitmap to the constructor. Because I am using SurfaceView, I am getting my canvas using the…
user2635439
1
vote
1 answer

refresh a bitmap or canvas in android

can anybody tell me how to refresh or reset a bitmap or canvas to draw another image on it? actually i have a map binary file which contains bitmap tiles in bytes now problem is i have a buffer image with buffer image i get screen image to…
sajjoo
  • 6,576
  • 20
  • 65
  • 86
1 2 3
99
100