Tag Archives: graphics

Find drawn characters under the mouse in C#

The following examples find the positions of drawn characters in a string that is drawn by using the Graphics object’s DrawString method. Measure character positions in a drawn string in C# Measure character positions when drawing long strings in C# … Continue reading

Posted in algorithms, drawing, fonts, graphics, strings | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Clip an image to a polygon in C#

This example lets you select a polygon and then uses it to clip an image to it. It uses the technique described in my previous post Build a polygon selector class in C# to let you select the polygon. The … Continue reading

Posted in drawing, graphics, image processing | Tagged , , , , , , , , , | Leave a comment

Build a polygon selector class in C#

This example shows how to make a polygon selector class that makes it easy to let the user select a polygon. I call this kind of class that provides a service for another class a symbiont. In a symbiotic relationship, … Continue reading

Posted in classes, drawing, graphics | Tagged , , , , , , , , | 1 Comment

Arrange images on the corners of a polygon in C#

This post shows a way to arrange images on top of a background image as shown in the image above. How to Use the Program Enter the names of the background and foreground image files, or use the File menu’s … Continue reading

Posted in graphics, image processing, mathematics | Tagged , , , , , , , , , | Leave a comment

Make an improved diagonal picture montage in C#

My earlier example Make a Pinterest-style diagonal picture montage in C# showed how you could make a picture montage showing parts of images rotated by a desired angle. While using that program today I found a small bug. The areas … Continue reading

Posted in drawing, graphics, image processing, tools | Tagged , , , , , , , , , , , , , | Leave a comment

Let the user draw rotated skewed polygons in C#

The example Let the user draw rotated polygons with right angles in C# draws polygons with edges that are parallel or perpendicular to a baseline. This example is very similar except its polygons have edges that are parallel to one … Continue reading

Posted in algorithms, drawing, graphics, mathematics, transformations | Tagged , , , , , , , , , , , , | Leave a comment

Let the user draw rotated polygons with right angles in C#

This example lets the user draw rotated polygons where all edges are either parallel or perpendicular to a defined baseline direction. As a result, all of the polygon’s angles are right angles. (And yes, I know that the polygons aren’t … Continue reading

Posted in algorithms, drawing, graphics, mathematics, transformations | Tagged , , , , , , , , , , , , | Leave a comment

Let the user save an image of a smooth curve in C#

The post Let the user draw a smooth curve in C# shows how you can let the user draw a smooth curve. This example extends that one to let you save the curve in an image file. There are a … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , | Leave a comment

Use a sprite class to animate bouncing cats in C#

A sprite is an object that you use to control a single object in an animation or game. Normally a sprite class must do two things: draw its object and move its object. This example defines an ImageSprite class that … Continue reading

Posted in animation, classes, graphics | Tagged , , , , , , , | Leave a comment

Draw interlocked circles in C#

This example draws a set of interlocked circles so they alternate between above and below each other. As you can see from the picture, the circles are made up of colored lines with black outlines so it’s easy to see … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , | Leave a comment