Questions tagged [drawing2d]
110 questions
18
votes
8 answers
How to know if a line intersects a rectangle
I have checked out this question, but the answer is very large for me:
How to know if a line intersects a plane in C#? - Basic 2D geometry
Is there any .NET method to know if a line defined by two points intersects a rectangle?
public bool…

Daniel Peñalba
- 30,507
- 32
- 137
- 219
14
votes
1 answer
Android Draw 9-patch tool: What is the meaning of black lines outside the figure
I tried enough to find in google & android this question. Also did several trials & errors, but couldn't get this question.
I was learning Android's "Draw Nine Patch" images. One basic I know is that, whatever image you process must be in .png…

iammilind
- 68,093
- 33
- 169
- 336
14
votes
7 answers
I need a pixel-perfect triangle fill algorithm to avoid aliasing artifacts
I'm assisting someone with user interface code to visualise a mathematical image analysis.
During this process we'll be segmenting part of a 2D shape into triangles, and filling some of these triangles in on the UI.
We're looking for a fill…

Tynam
- 440
- 1
- 3
- 15
13
votes
1 answer
How to use the projection/camera technique in c#
I drew the following grid:
The above grid is drawn using the following two methods, one to calculate the grid and the other to calculate the centers for each cell:
//makes grid in picture box
private void drawGrid(int numOfCells, int cellSize,…

Rose
- 349
- 3
- 17
10
votes
7 answers
Easy to use drawing library in c or c++?
I'd need a very easy to use drawing c or c++ library. This means that I don't need to put buttons, frames or anything else in there, but I need just to draw points, circles, lines on a graphic window. Is that possible?

Marco Molari
- 128
- 1
- 2
- 10
9
votes
1 answer
Is there a graphical overview of the HatchStyle enumeration?
A hatch pattern is made from two colors: one defined by the BackgroundColor, which fills the background and one for the lines that form the pattern over the background defined by the ForegroundColor property. The HatchStyle property defines what…

mafu
- 31,798
- 42
- 154
- 247
8
votes
1 answer
How to drawing a path with a bitmap?
I have a little drawing app and want to use "complex" shapes as brushes, i.e. a star.
Drawing with a simple brush already works with this code:
remotePath.reset();
remotePath.moveTo(start_x, start_y);
float dx = Math.abs(end_x - start_x);
float dy…

Dominik
- 1,703
- 6
- 26
- 46
8
votes
4 answers
What's a good 2D graphics drawing API for Windows/C++?
I've been working on a small little application, and I've been using DirectX/3D to draw textures to the screen (all 2-dimensional elements). The API, I find, is pretty easy to use and to incorporate using OOP principles, but I can't help but feel…

Jengerer
- 1,163
- 11
- 27
8
votes
2 answers
Android: Drawing on Canvas in Scrollview
I'm pretty much new in programing for Android. My app is sample app from api demos on developer android website. When I change parameters in that sample drawing it gets larger . That drawing needs to be displayed in scroll view (it doesn't need to…

Kristijan
- 131
- 1
- 2
- 7
5
votes
3 answers
.NET - Border around resized imaged
I'm trying to resize an image in .NET, but get a faint black border around the resized image. I found a post - http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/cf765094-c8c1-4991-a1f3-cecdbd07ee15/ which from someone who said…

Echilon
- 10,064
- 33
- 131
- 217
5
votes
3 answers
Drawing square using canvas Javascript
Making a random art generator for assignment. We are supposed to have squares randomly pop up but I can't figure out to draw a square. This is what I have so far
function drawSquare(canvas, context, color){
var x=…

Dallas
- 51
- 1
- 4
4
votes
2 answers
How do I draw an annulus (doughnut) using GDI+?
I have been trying to draw an annulus (ring with thickness) with a transparent hole and a gradient rim in C# with very little success. Does anyone have any suggestions on how to do this?
here's a nice Blend Utility
Here's the Final result - thanks…

Brad
- 20,302
- 36
- 84
- 102
4
votes
2 answers
Fill path not filling entire graphics path?
Trying to get that center area filled, not sure what I'm doing wrong.
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub…
user117499
4
votes
1 answer
Draw text on Canvas with custom Height - Android
I'm drawing text on canvas with this code:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawColor(Color.WHITE);
Paint paint = new Paint();
Rect bounds = new Rect();
…

KiKo
- 1,668
- 7
- 27
- 56
4
votes
2 answers
How is Cairo related to GDK?
What exactly is the function of the GDK library and how does Cairo fit in? Are they competing or complementary technologies? Does one of them depend upon the other in any way?

Nishant George Agrwal
- 2,059
- 2
- 12
- 14