Monthly Archives: October 2014

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

Use an ImageAttributes object to adjust an image’s brightness in C#

This example demonstrates a fast way to adjust an image’s brightness. The idea is simple: move each pixel’s red, green, and blue color components closer to the minimum or maximum values 0 and 255. For example, if a pixel’s components … Continue reading

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

Quickly convert an image to grayscale in C#

This example shows how you can quickly convert an image to grayscale by using the Bitmap32 class described in the post Use the Bitmap32 class to manipulate image pixels very quickly in C#. The ConvertBitmapToGrayscale method shown in the following … Continue reading

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

Validate a switch statement that uses values from an enumerated type in C#

This example shows how you can validate a switch statement that uses values defined in an enumerated type. Enumerated types and switch statements often go hand-in-hand. You define an enumerated type and then later use a switch statement to see … Continue reading

Posted in debugging | Tagged , , , , , , , , , , , , | Leave a comment

Let the user select and deselect 3D objects using WPF and C#

This example extends the techniques used in Perform hit testing in a 3D program that uses WPF, XAML, and C# to let the user select and deselect 3D objects. This program contains several refinements over previous 3D WPF examples. In … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , | 4 Comments

Perform hit testing in a 3D program that uses WPF, XAML, and C#

Many three-dimensional programs need to perform hit testing to determine when the user clicks on something. This example draws two interlocked tetrahedrons inside a cage. When you click on one of the objects, the program displays information about the object … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , | 15 Comments

Use segments to draw 3D axes with tic marks using WPF and C#

This example uses the techniques described in the post Draw improved 3D line segments using WPF and C# to draw 3D axes with tic marks. You could make the tic marks in several ways. You could use small spheres, cubes, … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Use segments to draw 3D arrows using WPF and C#

This example uses the techniques described in the post Draw improved 3D line segments using WPF and C# to draw 3D arrows. The following code shows the AddArrow extension method that adds an arrow to a MeshGeometry3D object. // Make … Continue reading

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