Issues around forms and graphics being drawn onto a computer screen, windowing system or device
Questions tagged [drawing]
5923 questions
29
votes
4 answers
How to animate scroll position? How to scroll smoothly?
I wish to move smoothly to next scroll position in my custom view (on button press or event). How to implement this? First of all I can't see scroll animation class (only alpha, rotate, scale and translate). Secondly, having animation class, I can't…

Suzan Cioc
- 29,281
- 63
- 213
- 385
28
votes
6 answers
How to draw a simple rounded rect in swift (rounded corners)
I managed to draw a rect :-) But I don't know how to draw a rounded rect.
Can someone help me out with the following code how to round the rect?
let canvas = UIGraphicsGetCurrentContext()
rec = CGRectMake(0, 0, 40, 40);
//var maskPath =…

mcfly soft
- 11,289
- 26
- 98
- 202
28
votes
7 answers
How to draw a directed arrow line in Java?
I want to draw a directed arrow line through Java.
At present, I am using java.awt.Line2D.Double class to draw a line
g2.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); // g2 is an instance of Graphics2D
g2.draw(new…

Amit
- 33,847
- 91
- 226
- 299
27
votes
5 answers
Stretching an UIImage while preserving the corners
I'm trying to stretch a navigation arrow image while preserving the edges so that the middle stretches and the ends are fixed.
Here is the image that I'm trying to stretch:
The following iOS 5 code allows the image when resized to stretch the…

Camsoft
- 11,718
- 19
- 83
- 120
27
votes
2 answers
Draw dash line on a Canvas
How can i draw dash line on a canvas. I already tried this:
Paint dashPaint = new Paint();
dashPaint.setARGB(255, 0, 0, 0);
dashPaint.setStyle(Paint.Style.STROKE);
dashPaint.setPathEffect(new DashPathEffect(new float[]{5, 10, 15, 20},…

Procurares
- 2,169
- 4
- 22
- 34
27
votes
6 answers
How to set combined color for overlapped area of two different color objects?
I am creating different custom views with two different colors. According to my app features user will drag those objects on the screen, when dragging objects will overlap each other. I want to differentiated the overlapped area, how to set the…

RajaReddy PolamReddy
- 22,428
- 19
- 115
- 166
26
votes
3 answers
Easiest way to "draw" simple lines over an image with jQuery and save to Rails DB?
I'd like to draw lines on an image. Basically allow the user to draw a path for mountain trails they like.
1) Does anyone know a good simple library for drawing basic lines?
2) After a user draws a bunch of lines on an image, what would be the best…

Daniel Fischer
- 3,042
- 1
- 26
- 49
26
votes
2 answers
Draw another image on a UIImage
Is it possible to add another, smaller, image to a UIImage/UIImageView? If so, how? If not, then how can I draw a small filled triangle?
Thanks

Alede
- 381
- 1
- 5
- 9
26
votes
3 answers
C#: Draw one Bitmap onto Another, with Transparency
I have two Bitmaps, named largeBmp and smallBmp. I want to draw smallBmp onto largeBmp, then draw the result onto the screen. SmallBmp's white pixels should be transparent. Here is the code I'm using:
public Bitmap Superimpose(Bitmap largeBmp,…

Paul A Jungwirth
- 23,504
- 14
- 74
- 93
25
votes
6 answers
google maps API v3 - how to draw dynamic polygons/polylines?
I have 4 days of experience with Google Maps Javascript API and i find their documentation and information sharing confusing at best.
Does anyone have experience or knowledge on how to draw polygons/polylines on a google map (using Javascript API…

David 'the bald ginger'
- 1,296
- 3
- 20
- 38
25
votes
10 answers
How to fill a square with smaller squares/rectangles?
In my office at work, we are not allowed to paint the walls, so I have decided to frame out squares and rectangles, attach some nice fabric to them, and arrange them on the wall.
I am trying to write a method which will take my input dimensions (9'…

esac
- 24,099
- 38
- 122
- 179
25
votes
6 answers
how to get Bitsperpixel from a bitmap
I have a 3rd party component which requires me to give it the bitsperpixel from a bitmap.
What's the best way to get "bits per pixel"?
My starting point is the following blank method:-
public int GetBitsPerPixelMethod( system.drawing.bitmap bitmap…

jason clark
- 829
- 2
- 11
- 23
25
votes
2 answers
What exactly is a canvas path, and what is the use of ctx.closePath()?
I'm working on an HTML5 game. I need to draw tail lines in the canvas and check for intersections in the game, which is a Tron-style game.
I'm actually using the drawLine() function from JCanvas, but JCanvas did not provide me a way to check for…

Aronis Mariano
- 2,352
- 3
- 22
- 19
24
votes
5 answers
How can I draw lines into numpy arrays?
I would like to be able to draw lines into numpy arrays to get off-line features for on-line handwriting recognition. This means I don't need the image at all, but I need for some positions in a numpy array who an image of a given size would look…

Martin Thoma
- 124,992
- 159
- 614
- 958
24
votes
4 answers
draw a circle over image opencv
Im usign python and opencv to get a image from the webcam, and I want to know how to draw a circle over my image, just a simple green circle with transparent fill
my code:
import cv2
import numpy
import sys
if __name__ == '__main__':
#get…

Art Grc
- 453
- 2
- 8
- 14