Questions tagged [drawing]

Issues around forms and graphics being drawn onto a computer screen, windowing system or device

5923 questions
36
votes
1 answer

Android Paint stroke width positioning

Given this code to draw a line: Paint p; p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(android.graphics.Color.WHITE); p.setStyle(Paint.Style.FILL); p.setStrokeWidth(21); canvas.drawLine(0,50,100,50,p); there are 3 possible stroke-drawing…
ilomambo
  • 8,290
  • 12
  • 57
  • 106
36
votes
7 answers

Implementing smooth sketching and drawing on the element

I am trying to create a drawing area with canvas. I am having trouble with making the lines look smooth when drawing curves and I also have changing line thickness in my algorithm which looks bad as well because the size jumps to much as well and…
ryuutatsuo
  • 3,924
  • 3
  • 27
  • 29
35
votes
2 answers

How to draw a rounded rectangle in c#

I am using this code to make a rounded rectangle. But it only draws upper left and right corners of rectanlge , more it doest not complete the rectangle at lower part. How to make it complete and filled . What changes should I make ? public static…
phpnet
  • 903
  • 1
  • 8
  • 23
35
votes
7 answers

Drawing on Canvas - PorterDuff.Mode.CLEAR draws black! Why?

I'm trying to create a custom View which works simple: there is a Bitmap which is revealed by arc path - from 0deg to 360deg. Degrees are changing with some FPS. So I made a custom View with overridden onDraw() method: @Override protected void…
cadavre
  • 1,334
  • 1
  • 18
  • 34
35
votes
1 answer

Punch a hole in a rectangle overlay with HW acceleration enabled on View

I have a view which does some basic drawing. After this I want to draw a rectangle with a hole punched in so that only a region of the previous drawing is visible. And I'd like to do this with hardware acceleration enabled for my view for best…
Joseph Earl
  • 23,351
  • 11
  • 76
  • 89
34
votes
7 answers

Drawing a grid using CSS

I'm looking for a way to draw a grid (i.e. http://www.artlex.com/ArtLex/g/images/grid.gif) inside of a div, using CSS (and JS if necessary). It feels like it should be relatively straight forward, but I haven't been able to figure it out. Any advice…
lennysan
  • 1,330
  • 2
  • 13
  • 16
33
votes
2 answers

Opengl pixel perfect 2D drawing

I'm working on a 2d engine. It already works quite good, but I keep getting pixel-errors. For example, my window is 960x540 pixels, I draw a line from (0, 0) to (959, 0). I would expect that every pixel on scan-line 0 will be set to a color, but no:…
scippie
  • 2,011
  • 1
  • 26
  • 42
31
votes
6 answers

How to change Panel Border Color

In the properties of a Panel I have set the border style to Fixed Single. When I am running my application it has the color gray. I don't know how to change the border color. I have tried this in the Paint event handler of the panel: private void…
yogeshkmrsoni002
  • 379
  • 3
  • 6
  • 11
31
votes
5 answers

What does the python interface to opencv2.fillPoly want as input?

I'm trying to draw a polygon using the python interface to opencv, cv2. I've created an empty image, just a 640x480 numpy array. I have a list of polygons (four point quadrilaterals) that I want to draw on the image, however, I can't seem to get the…
DaveA
  • 1,227
  • 2
  • 14
  • 19
30
votes
2 answers

Draw a Fill Rectangle with low opacity

I a have a PictureBox with a picture in a Windows Form application in C# language.I want draw a FillRectangle in some location of picturebox.but i also need to see picture of picture box.how can i draw this rectangle with low opacity to see image of…
Hossein Moradinia
  • 6,116
  • 14
  • 59
  • 85
29
votes
6 answers

Google Maps v3 - Delete vertex on Polygon

Google Maps has the Drawing library to draw Polylines and Polygons and other things. Example of this functionality here: http://gmaps-samples-v3.googlecode.com/svn-history/r282/trunk/drawing/drawing-tools.html I want, when drawing and editing the…
James F
  • 554
  • 1
  • 9
  • 19
29
votes
6 answers

Is there a Javascript library for Paint-like applications using canvas?

Is there a Javascript library which has built-in features for quickly creating a Paint-like web application using the canvas element? EDIT: So, far, I have found Javascript libraries that allow easy animation of canvas elements -- such as Raphael JS…
Ivan
  • 10,052
  • 12
  • 47
  • 78
29
votes
4 answers

Android canvas draw line - make the line thicker

This seems like it should be somewhat trivial, however in my android app, I am using canvas to draw a series of lines that are connected together. For some reason my lines are very very faint and thin. I was wondering how can I make my lines…
user859348
  • 359
  • 1
  • 3
  • 13
29
votes
2 answers

Draw a parallel line

I have x1,y1 and x2,y2 which forms a line segment. How can I get another line x3,y3 - x4,y4 which is parallel to the first line as in the picture. I can simply add n to x1 and x2 to get a parallel line but it is not what i wanted. I want the lines…
VOX
  • 2,883
  • 2
  • 33
  • 43
29
votes
8 answers

Drawing circles with System.Drawing

I have this code that draws a Rectangle ( Im trying to remake the MS Paint ) case "Rectangle": if (tempDraw != null) { tempDraw = (Bitmap)snapshot.Clone(); Graphics g =…
Tony
  • 487
  • 3
  • 9
  • 12