Tag Archives: color

Randomly color an Apollonian gasket in C#

This example is similar to the example Draw an Apollonian gasket in C# except it fills the circles it draws with random colors. The program uses the following code to generate random colors. // Return a random color. private Random … Continue reading

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

Warholize an image in C#

When you “Warholize” an image, you reduce the number of colors it contains. The term comes from the name of Andy Warhol, the American painter, print maker, and film maker. One particularly striking kind of image he produced featured a … Continue reading

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

Convert a directory’s files to grayscale in C#

The example Quickly convert an image to grayscale in C# explains how to convert an image to grayscale. This program uses the same technique to convert all of the files in a directory to grayscale. (I needed this to prepare … Continue reading

Posted in files, graphics, image processing | Tagged , , , , , , , , , , , , | 1 Comment

Make a selection dialog that uses a color wheel in C#

The example Draw a color wheel with alpha and saturation values in C# lets the user select a color on a color wheel. This example uses that technique to build a color selection dialog. This change is fairly easy. First … Continue reading

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

Use a queue to draw a breadth-first colored binary tree in C#

The example Draw a breadth-first colored binary tree in C# shows how to use a Stack to draw a binary tree in depth-first order. The program builds a Stack representing the bottom (trunk) level of the tree. For each level, … Continue reading

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

Draw a breadth-first colored binary tree in C#

The example Draw a colored binary tree in C# shows how to use recursion to draw a colored binary tree. If you look closely at a tree of high degree, however, you’ll notice a problem. The program draws a branch … Continue reading

Posted in algorithms, drawing, fractals, graphics | Tagged , , , , , , , , , , , , , , | 4 Comments

Draw a colored binary tree in C#

This example shows how you can modify the example Recursively draw a binary tree in C# to draw a colored binary tree. It draws branches at different depths in different colors and with different thicknesses. The main recursive method in … Continue reading

Posted in algorithms, drawing, fractals, graphics | Tagged , , , , , , , , , , , , , , , , | 1 Comment

Use an ImageAttributes object to convert an image to shades of red, green, or blue in C#

This example uses the techniques described by Use an ImageAttributes object to adjust an image’s brightness in C# to convert an image to shades of red, green, or blue. The previous example scaled each pixel’s red, green, and blue color … Continue reading

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

Use an ImageAttributes object to convert an image to sepia tone in C#

This example modified the previous example Use an ImageAttributes object to convert an image to monochrome in C# to convert an image to sepia tone. This example uses a ColorMatrix that gives the resulting pixel’s color components different values that … Continue reading

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

Use an ImageAttributes object to convert an image to monochrome in C#

This example shows a quick and easy way to convert an image to monochrome. The example Quickly convert an image to grayscale in C# shows one way to convert an image to grayscale. It does that buy looping through the … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , , | 2 Comments