Questions tagged [drawing]

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

5923 questions
23
votes
5 answers

Getting a DrawingContext for a wpf WriteableBitmap

Is there a way to get a DrawingContext (or something similar) for a WriteableBitmap? I.e. something to allow you to call simple DrawLine/DrawRectangle/etc kinds of methods, rather than manipulate the raw pixels directly.
Emperor XLII
  • 13,014
  • 11
  • 65
  • 75
23
votes
7 answers

How to erase previous drawing on Canvas?

I have a background image (a map) on which I need to regularly draw the you-are-here icon. I use Canvas to draw the icon on top of the map. Assuming that the drawing process is triggered on button click (see code below), how can I erase the previous…
springrolls
  • 1,331
  • 1
  • 14
  • 40
23
votes
3 answers

Way to "free-hand" draw shapes in shiny?

Is there a function or some other way to enable free-hand drawing (i.e., drawing of random shapes/sizes) using the mouse in Shiny? Specifically, I'd like to be able to "interact" with a plot from renderPlot by marking it in various (but…
theforestecologist
  • 4,667
  • 5
  • 54
  • 91
23
votes
3 answers

Draw a circle with a radius and points around the edge

I'm really stuck on how to go about programming this. How to draw a circle in Java with a radius and points around the edge? I need to draw a circle within a JFrame with a radius and points around the circumference. i can mathematically calculate…
alchemey89
  • 485
  • 2
  • 6
  • 8
23
votes
2 answers

UIBezierPath stroke 1px line and fill 1px width rectangle - different results.

Here is a simple drawing - (void)drawRect:(CGRect)rect { //vertical line with 1 px stroking UIBezierPath *vertLine = [[UIBezierPath alloc] init]; [vertLine moveToPoint:CGPointMake(20.0, 10.0)]; [vertLine…
Michael
  • 1,238
  • 2
  • 15
  • 26
22
votes
1 answer

Iphone How to make context background transparent?

CALayer *sublayer = [CALayer layer]; /*sublayer.backgroundColor = [UIColor blueColor].CGColor; sublayer.shadowOffset = CGSizeMake(0, 3); sublayer.shadowRadius = 5.0; sublayer.shadowColor = [UIColor blackColor].CGColor; sublayer.shadowOpacity =…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
22
votes
4 answers

4 points and Ellipse

I have 4 points.. i can draw a polygon usign this code var p = new Polygon(); p.Points.Add(new Point(0, 0)); p.Points.Add(new Point(70, 0)); p.Points.Add(new Point(90, 100)); p.Points.Add(new Point(0, 80)); How i can draw an 'ellipse' that will fit…
obenjiro
  • 3,665
  • 7
  • 44
  • 82
22
votes
6 answers

Drawing graphs on java

I want to draw graphs (nodes and edges) in Java. However, since I don't know how to go about it, I would like to have some advice before starting. How should I do this? use Graphics2D package, right? How about the labels for the nodes? should I use…
nunos
  • 20,479
  • 50
  • 119
  • 154
22
votes
3 answers

How to Change Pixel Color of an Image in C#.NET

I am working with Images in Java, I have designed more over 100+ images(.png) format, They were all Trasparent and Black Color Drawing. The problem is, Now I have been asked to change the color of the Drawing (Black -to ). I have searched many code…
Bibi Tahira
  • 1,082
  • 5
  • 15
  • 39
21
votes
4 answers

drawBitmap() and setPixels(): what's the stride?

Could please somebody explain me (ASCII is really welcome) what the stride argument stands for in Canvas.drawBitmap() and in Bitmap.setPixels()/getPixels()? I understand it's a way to skip elements in the colors array, but how?
bigstones
  • 15,087
  • 7
  • 65
  • 82
21
votes
4 answers

How to draw with .NET Core?

Is there any way to draw and display graphics on the screen with .NET Core? I would like to create a graphics application that runs on multiple platforms.
SuperJMN
  • 13,110
  • 16
  • 86
  • 185
21
votes
2 answers

Canvas.clipPath(Path) not clipping as expected

I'm trying to clip a canvas drawing operation to an arc-shaped wedge. However, I'm not getting the intended result after setting the clipping path to the canvas. For illustration, here is what I'm doing: path.reset(); //Move to point…
Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274
20
votes
2 answers

How to draw the classic state diagram using Mathematica?

Is it possible and practical for Mathematica to draw something like this (being created by Graphviz): This is the best that I can get (but the shape and style are not satisfying): Code: GraphPlot[{{A -> C, "go"}, {C -> B, "gone"}, {C -> D, …
Ning
  • 2,850
  • 2
  • 16
  • 23
20
votes
1 answer

Tips regarding high performance drawing in Android

Background I'm writing a graphing library for an android application (yes yes, I know there are plenty out there but none that offer the customizability we need). I want the graphs to zoomable and pan-able. Problem I want the experience to be…
Nicklas A.
  • 6,501
  • 7
  • 40
  • 65
19
votes
4 answers

Firefox Mousemove event.which

I'm writing an HTML5 canvas drawing app, and I need to be able to tell whether or not the left mouse button is pressed down during a mousemove event. On Chrome, this works: if (event.which == 1) { } But in FireFox, event.which always is…
dieki
  • 2,435
  • 5
  • 23
  • 29