Category Archives: transformations

Rotate images that are scaled in C#

The example Interactively rotate images in C# lets you click and drag to rotate images but it doesn’t always work well if the image you are rotating is too big to fit on the screen. The example Rotate images inside … Continue reading

Posted in algorithms, graphics, image processing, transformations | Tagged , , , , , , , , , , , , , , | 1 Comment

Rotate images inside a scrolled panel in C#

The example Interactively rotate images in C# lets you click and drag to rotate images. Unfortunately it doesn’t work well with images that are too big to fit on the screen. If an image is too big, the program lets … Continue reading

Posted in algorithms, graphics, image processing, transformations | Tagged , , , , , , , , , , , , | Leave a comment

Interactively rotate images in C#

The example Rotate images by an arbitrary angle in C# explains how you can rotate an image by a angle specified in a TextBox. This example lets you click and drag around the image’s center to specify the angle of … Continue reading

Posted in algorithms, graphics, image processing, transformations | Tagged , , , , , , , , | 7 Comments

Rotate images in C#

This program uses the following RotateBitmap method to rotate an image. // Return a bitmap rotated around its center. private Bitmap RotateBitmap(Bitmap bm, float angle) { // Make a Matrix to represent rotation // by this angle. Matrix rotate_at_origin = … Continue reading

Posted in algorithms, graphics, image processing, transformations | Tagged , , , , , , , , , | 5 Comments

Easily map drawing coordinates in C#

The example Map points between coordinate systems in C# shows several ways you can map drawing coordinates to screen coordinates. They all work but these sorts of coordinate conversions are really common if you’re doing more advanced graphics so I … Continue reading

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

Draw text on a line segment in C#

This example shows how you can draw text on a line segment. The key is the DrawTextOnSegment method shown in the following code. This method can draw text on a line segment or below a line segment. // Draw some … Continue reading

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

Make CAPTCHA images with overlapping characters in C#

The following MakeCaptchaImage2 method creates a Bitmap containing a CAPTCHA image. private Random Rand = new Random(); // Draw the words with letters overlapping each other. private Bitmap MakeCaptchaImage2(string txt, int wid, int hgt, Font the_font, Brush the_brush) { Bitmap … Continue reading

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

Make CAPTCHA images in C#

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) images are those distorted pictures of words that some Web sites make you enter to prove you are a human and not an automated process. The idea is … Continue reading

Posted in drawing, graphics, image processing, internet, transformations, web | Tagged , , , , , , , , , , , , | 1 Comment

Draw a labeled line graph that displays value tooltips in C#

This (fairly complicated) example maps between several different coordinate systems: The main graph is mapped from a coordinate space where 1900 ≤ x ≤ 2010 and 0 ≤ y ≤ 8000 to an area on the screen. Each data point … Continue reading

Posted in drawing, graphics, mathematics, transformations | Tagged , , , , , , , , , , , , , | 1 Comment

Map points between coordinate systems in C#

This example shows how you can easily map points between different coordinate systems. The Graphics object provides transformations that let you scale, translate, rotate, skew, and otherwise transform graphics as you draw them. One important use of these transformations is … Continue reading

Posted in algorithms, drawing, graphics, transformations | Tagged , , , , , , , , , , , , , , , , , , | 2 Comments