drawing

How to HitTest in a WPF Grid Panel to find column index.

Hi. We need to create a "timeline" feature where a user is allowed to drag and draw "time spans" into a WPF grid (we thought this better than a Canvas since it has resizing capabilities). Each span spans multiple columns, but only one row. We utilize the PreviewMouseDown/Up/Move events to see when the user clicks, drags, and releases th...

How to draw a circle in java with a radius and points around the edge

Hi, I'm really stuck on how to go about programming this. I need to draw a circle within a JFrame with a radius and points around the circumference. i can mathematically calculate how to find the coordinates of the point around the edge but i cant seem to be able to program the circle. I am currently using a Ellipse2D method but that doe...

How to draw a rectangle in WinForm app in the correct location

I have a WinForm app that has an image displayed in a PictureBox that has the added functionality of allowing a user to draw a rectangle on the image by clicking and dragging. The Location, Height and Width of the rectangle are saved to disk. When the image is viewed again I would like to automatically redraw that rectangle in the sam...

How to draw and scale a bitmap on a canvas using bicubic interpolation in Android?

I want to draw a bitmap on a canvas with bigger size than it is. I can use canvas.drawBitmap(bitmap, null, destRect, null); but that gives a poor quality, as the result is pixelated, if the source image is sightly smaller than the destination rectangle. How can i draw my bitmap using bilinear or bicubic resampling? Any help would be a...

Draw a rectangle using Winforms

Can I draw a rectangle with mouseClick?My code is not working so far.Can you help me? private void panel1_MouseClick(object sender, MouseEventArgs e) { Graphics g = this.CreateGraphics(); Pen pen = new Pen(Color.Black, 2); g.DrawRectangle(pen, 100,100, 100, 200); } ...

Iphone SDK quesiton: How to make a Drawing method in a View class work using CGContextRef?

I have these 2 methods in the View class. the drawRect method always gets called when the view is initalized. But i can't get the drawLine method to work. It doesn't do anything when it gets called. Am i supposed to deal with cgimagecontext or something like that? please help!! - (void)drawRect:(CGRect)rect { // Drawing code // ...

How can I draw the control points of a Bézier Path in Java?

I have created a Path of Bézier curves and it works fine to draw the path. But I don't know How I can draw the Control Points together with the Path. Is that possible or do I have to keep track of them in another datastructure? Update: The reason to why I want to draw the control points, is that I will let the user to edit the curves us...

Drawing Color Spectrum with Waveform

i've come across this ActionScript sample, which demonstrates drawing of the color spectrum, one line at a time via a loop, using waveforms. however, the waveform location of each RGB channel create a color spectrum that is missing colors (pure yellow, cyan and magenta) and therefore the spectrum is incomplete. how can i remedy this pr...

open source flash or ajax sketchpad?

For a non-profit (charity) site I need a simple sketchpad (drawing) component. It should be able to: Let the user draw a simple black on white sketch. Save to server the full drawing steps. Save to server the final image. Re-play the drawing steps to future users. http://www.sketchswap.com/ has a similar component. Do you know wher...

Raphael js drawing circles in all elements with specified class

Hi all, I've just discovered Raphael, and love it, but I am not much of a javascript-er. Right now I have three repeated sections of code to draw the same circle in three different divs. The default for making a canvas in Raphael finds an element by ID, but I want to have one set of variables to have circles drawn in all divs with clas...

PHP script to draw a spiral?

Does anybody have a PHP (or other language) script for drawing a spiral. A simple (Archimedean spiral) would be just fine. Of course the principle is simple but coding it in SVG or GD would take some time, so I wonder if somebody has one ready :-) ...

ActionScript2.0 : Drawing arc for Triangle's angle

Hi all, how can I draw arc in randomize created triangle's angle with flash actionscript 2.0. Thanks all. I would like to draw red arc at every triangle's angle. Note: The triangle will be created randomly. ...

What is the equivalent to Java's canvas object in C#?

I'm working on creating a basic application that will let a user draw (using a series of points) and I plan to do something with these points. If this were Java, I think I would probably use a canvas object and some Java2D calls to draw what I want. All the tutorials I've read on C#/Drawing involve writing your own paint method and add...

Create flow diagram programmatically

I want to visualize components and connections of a HVAC system with .NET/C#. The diagrams will just include a few different components and their connections. They do not have to comply to any formal standard and should look alike the diagrams attached. In addition the user should be able to select a single component/connection (so that ...

How to measure the pixel width of the string drawed over Drawing.Bitmap in .NET?

I am generating a png image that contains a text dinamically written. I need to create the bitmap with the minimum width for file size reasons. ...

Drawing a FrameworkElement within another FrameworkElement

Hello I have this code: public class VisualCue : FrameworkElement { public List<Indicator> Indicators { get; set; } public VisualCue() { this.Indicators = new List<Indicator>(); } protected override int VisualChildrenCount { get { return this.Indicators.Count; } } protected override Visual GetVisualCh...

Trying to draw a Rectangle to a Custom Container in Flex4/AS3

So below is the code I have so far. For now I simply want to make it draw a square and have it show up. Right now when I click the area defined in MXML as <components:PaintArea width="100%" height="100%" id="paint-a"></PaintArea> it shows nothing; however, the actionlistener is getting triggered and an element is being added to the group...

image appears larger than bounding rectangle?

Hello I'm implementing a custom print preview control. One of the objects it needs to display is an image which can be several pages high and wide. I've successfully divided the image into pages and displayed them in the correct order. Each "page" is drawn within the marginbounds. (That is, each page is sized to be the same as the ma...

Which of these choices is the better design for drawing objects?

What would be a better parctice, writing the drawing method inside the GameObject class or in the Game class? GameObject obj = new GameObject(); obj.Draw(); Or GameObject obj = new GameObject(); DrawGameObject(obj); ...

How to learn geometry for programming?

What's the best way to learn the essentials of geometry (and other types of math) used in drawing/graphics programming - e.g. curves (like bezier curves), transformations, matrices, etc.? ...