Questions tagged [drawing2d]
110 questions
3
votes
1 answer
How do i draw anywhere in a graphics object after it is transformed
I'm trying to create a canvas for drawing different objects. I've created zoom and pan functions using graphics.scaleTransform and graphics.translateTransform, but i wan't the canvas background (a grid) to allways fill out the entire window, however…

Bildsoe
- 1,310
- 6
- 31
- 44
3
votes
1 answer
Imperfect Ball drawing on HTML5 Canvas
HTML5 Canvas seems to be drawing imperfect balls on certain conditions. When there's a red background, and a blue circle with a black outline, it seems the outline is wider in the left side and thinner in the right. Here's a fiddle illustrating…

Benur21
- 33
- 5
3
votes
1 answer
Animate rectangle on canvas
I am trying to animate horizontal bar chart drawing. It will draw slowly and once finished draw the second one. Just like chart.js. It doesn't have to be that advanced. I am just trying to learn canvas drawing + animation. I am using ctx.fillRect…

Yasin Yaqoobi
- 1,888
- 3
- 27
- 38
3
votes
1 answer
Modifying drawn image as a rounded rectangle
Following the code here I am trying to curve the edges of the rectangle so that its not all square.
An example of what it looks like now:
And what I am looking for it to do:
Using this code:
Using br As New SolidBrush(solidBGColor)
Dim r As New…

StealthRT
- 10,108
- 40
- 183
- 342
3
votes
1 answer
Get mouse position in JFrame considering window bounds
I am building a simple graphing application in Java, it requires me to get the mouse position within the 2D graphics canvas. I have used the code MouseInfo.getPointerInfo().getLocation(), but it returns the mouse position relative to the JFrame…

Syd Lambert
- 1,415
- 14
- 16
3
votes
1 answer
Create Lines around a guiding line using Miterjoin
I am drawing graphs into a WinForms Picturebox. Now I am searching for a possibility to 'duplicate' a line (an array of points), so that the two resulting lines are positioned a fixed distance away from the original one. Like in this picture, I have…

Eric Muller
- 33
- 5
3
votes
5 answers
set position for drawing binary tree
I want to drawing a binary tree with an graphical framework(Qt) like this:
9
/ \
1 10
/ \ \
0 5 11
/ / \
-1 2 6
but I have a problem to set X and Y for every node, do you any idea to setting…

Vahid Kharazi
- 5,723
- 17
- 60
- 103
2
votes
2 answers
How to convert a RectangleF to PointF[] for drawing?
I'm not sure if the question is too trivial but, I need to use the following overload of the method Graphics.DrawImage:
public void DrawImage(
Image image,
PointF[] destPoints,
RectangleF srcRect,
GraphicsUnit srcUnit,
…

Daniel Peñalba
- 30,507
- 32
- 137
- 219
2
votes
2 answers
Pygtk graphics contexts and allocating colors
I've searched on this, but nothing has what I'm looking for.
http://www.mail-archive.com/pygtk@daa.com.au/msg10529.html -- Nobody answered him. This is exactly what I'm experiencing. When I set the foreground on a graphics context, it doesn't seem…

Scott
- 5,135
- 12
- 57
- 74
2
votes
1 answer
c# / 2D Graphics / DrawRectangle size beheviour
private void Form1_Paint(object sender, PaintEventArgs e)
{
Pen p = new Pen(Brushes.Black, 1);
e.Graphics.DrawRectangle(p, 3, 3, 89, 30);
}
Why does this code produce a 90px width / 31px height box? i.e one pixel bigger than…

user1022738
- 63
- 2
2
votes
0 answers
EmbossMaskFilter strange effect on other drawings
I've tried to use EmbossMaskFilter to create custom Drawable.
However I've come across strange behaviour, that when I try to use Emboss it's causing
black stripes on edges of other 2d-graphics objects that overlaps with "embossed" drawble bounds.
Am…

Piotr L.
- 483
- 1
- 4
- 7
2
votes
1 answer
how to save pixijs content as image
Let's say I have a pixijs app like this
https://codesandbox.io/s/o3qfi
I need to save the contents rendered by pixijs in the canvas as a screenshot.
I tried accessing the canvas like
app.renderer.view.toDataURL("image/png", 1.0)
and also…

Ajai
- 1,049
- 1
- 11
- 23
2
votes
2 answers
C# GDI - How to Create a bitmap copy of a polygon (set of point)
I have a bitmap object (or even any other image) and I'm drawing some lines on this bitmap to create a polygon.
after the drawing I need to clone/copy/cut the selection (based on the lines) area.
I cant use the bitmap.clone method becuase its…

Ronen
- 61
- 1
- 3
2
votes
1 answer
p5.js - changing order of two code lines changes behaviour of drawing squares
I have a strange problem with p5.js. Basically, there is one source of gravity force (red square) and one blue square (called pixel in code) that orbits around a red square. proc() function makes one step in time and proceeds physics of both objects…

FindingTruth
- 69
- 8
2
votes
0 answers
System.Drawing quality issue with large offset matrix
I've run into an issue with drawing text and basic graphic drawing operations not having the proper placement & quality when the drawing matrix has large offset values. I've tried number SmoothMode, InterpolationMode, & TextRenderingHint options…

Jered Berge
- 21
- 2