This page is the starting point for all code samples. As I discover something new/interesting I’ll be creating code samples explaining a specific topic. These samples are not intended to be full on applications, but rather components that can be used in applications. If you would like me to create a code sample on a specific topic please drop me a comment here, or reach me via twitter @DefaultSoftware All code is released under the Ms-PL license.

Navigate to an article by clicking the relevant thumbnail image.


Article List

Article and sample code illustrating how to create with customized borders implemented using GDI.

Short Code Sample explaining how to read values from Application Configuration Files without having to cast/parse by hand.

An article based on using the System.IO.DriveInfo class to determine the amount of space not in use on a particular logical disk drive.

A discussion accompanied by a code sample illustrating drawing two dimensional shapes and text with ARGB colours.

This article provides a discussion on how to determine whether a file is read only or not, provides three different methods of setting a file to read only and provides three different methods of negating a file’s read only status. Full code sample and source code download included.

The purpose of this article is to explore the implementation of by means of a single extension method supporting .

The purpose of this article is to illustrate to object data that resides in application memory. Additionally this article details implementing generics, resulting in a single method being able to deserialize multiple object types. This article relates to the article: C# How to: Implementing Xml Serialization through a generic extension method

This article will illustrate how to create deep copies of an object by making use of implemented in the form of an extension method with generic type support. A short discussion is included on the differences between shallow copy and deep copy.

is an Xml based schema that exactly details the custom data types and web service methods exposed by a web service. Developers usually generate web service client proxy code in order to call into web services. Since WSDL is an exact description of a web service it is also possible to generate code that represents the service in the form of web method stubs. This article illustrates how to generate a web service from WSDL.

This article illustrates a basic introductory level explanation of the steps required to interface with the using the implemented in a application.

This article features a short illustration of how to determine if a network port is already in use.

 

This article explores encoding images to strings. Encoding is implemented by means of an targeting the class.

This article details how to decode or convert encoded strings back into Bitmap images by means of extending the string class. Note: This article is an update that builds upon the article: C# How to: Encoding Bitmaps to Base64 strings

In this article we discover creating basic filters implemented by directly manipulating the ARGB colour values associated with an image’s pixels. The different types of filters discussed are: Grayscale, Transparency, Image Negative and Sepia tone. All filters are implemented as targeting the Image class, as well as the Bitmap class as the result of inheritance and upcasting.

This article is based around creating basic Image filters. The different types of filters discussed are: Grayscale, Transparency, Image Negative and Sepia tone. All filters are implemented as targeting the Image class, as well as the Bitmap class as the result of inheritance and upcasting.

Note: This article is a follow up to C# How to: Image filtering by directly manipulating Pixel ARGB values. The previously published related article implements filtering by performing calculations and updating pixel colour component values namely Alpha, Red, Green and Blue. This article achieves the same image filtering through implementing various ColorMatrix transformations, in essence providing an alternative solution. For the sake of convenience I have included the pixel manipulation in addition to the ColorMatrix detailed by this article.

This article details how to read Image files from the file system, create thumbnails and then encoding thumbnail images to strings.

In this article we explore how to combine or blend two Bitmap images by implementing various colour filters affecting how an Image appear as part of the resulting blended . The concepts detailed in this article are reinforced and easily reproduced by making use of the sample source code that accompanies this article.

This article is aimed at detailing how to implement the process of substituting the colour values that form part of a Bitmap image. Colour substitution is implemented by means of a threshold value. By implementing a threshold a range of similar colours can be substituted.

This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying sample source code implements a Windows Forms application, allowing for easily testing the icon generation process.

The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a  Bitmap image. The concepts explained can easily be replicated by making use of the included sample application.

In this article we explore manipulating a Bitmap image’s underlying pixel data. The process of Pixel data manipulation at its core feature the implementation of Linq Queries targeting raw pixel data.

In this follow up article we further explore manipulating a Bitmap image’s underlying pixel data. This article is part 2 of the Linq to Bitmaps series, we’ll be focussing on partial colour inversion using Linq queries. article was published as a follow up to: C# How to: Bitmap Pixel manipulation using LINQ Queries.

This article explores the concept of manipulating the Colour Balance of a Bitmap image. Colour Balance values are updated by directly manipulating a Bitmap’s underlying pixel data, no GDI drawing code required.

The purpose of this article is to explore and illustrate the concept of creating bi-tonal bitmap . Colour images are manipulated in such a fashion to only express two colours. The colours expressed are configurable. A threshold value determines which of the two configured colours will be applied to a pixel.

The purpose of this article is to illustrate the tasks required when implementing a colour tint on a Bitmap image. The various Bitmap manipulation operations detailed in this article are all exclusively implemented by processing raw pixel data. No traditional GDI+ drawing operations are required in achieving the objective of this article

The objective of this article is focussed on exploring the concept of applying Colour Shading to Bitmap images. The various Bitmap manipulation operations detailed in this article are all exclusively implemented by processing raw pixel data. No traditional GDI+ drawing operations are required in implementing Bitmap Colour Shading.

The focus of this article is set on exploring the concept of Image Solarisation. In this article the tasks required to perform Image Solarisation  are entirely implemented on pixel data level. Image manipulation is only implemented in the form of updating the individual Alpha, Red, Green and Blue colour components expressed by Image pixels.

Adjusting the contrast of an Image is a fairly common task in image processing. This article explores the steps involved in adjusting image contrast by directly manipulating pixels.

In this article you’ll find a discussion on the topic of blending  Bitmap images into a single Image. Various possible methods can be employed in blending images. In this scenario image blending is achieved through means of bitwise operations, implemented on individual colour components Red, Green and Blue.

The objective of this article is to illustrate Arithmetic being implemented when blending/combining two separate into a single result . The types of Image Arithmetic discussed are: Average, Add, SubtractLeft, SubtractRight, Difference, Multiply, Min, Max and Amplitude.

This article is intended to serve as an introduction to the concepts related to creating and processing filters being applied on . The filters discussed are: Blur, Gaussian Blur, Soften, Motion Blur, High Pass, Edge Detect, Sharpen and Emboss.

The objective of this article is to explore various algorithms. The types of discussed are: , , , and . All instances are implemented by means of .

In this article we explore the concept of Difference of Gaussians . This article implements as a means of achieving . All of the concepts explored are implemented by accessing  and manipulating the raw pixel data exposed by an , no GDI+ or conventional drawing code is required.

The objective of this article is focussed on providing a discussion on implementing a on an image. This article illustrates varying levels of filter intensity: 3×3, 5×5, 7×7, 9×9, 11×11 and 13×13.

The purpose of this article is to explore and illustrate the concept of . This article implements in the form of a 3×3 Gaussian Blur, 5×5 Gaussian Blur, 3×3 and a 5×5 .

This article’s intension is focussed on providing a discussion on the tasks involved in implementing Image Colour Averaging. Pixel colour averages are calculated from neighbouring pixels.

The purpose of this article is aimed at exploring the concepts of , Image Dilation, and . In addition this article extends conventional and implementations through partial colour variations of and .

The objective of this article is to explore implemented by means of and . In addition we explore the concept of implementing morphological .

C# How to: Boolean Edge Detection

The purpose of this article is to detail Boolean Function Based Edge Detection. The filtering implemented in this article occurs on a per pixel basis. The implementation relies on linear algebra. No GDI+ or traditional drawing methods are required.

This article provides a technical discussion exploring the topic of Gradient Based Edge Detection and related aspects. Several filtering options are illustrated and explained ranging from pure black and white to .

In this article we explore the tasks related to creating a Cartoon Effect from which reflect real world non-animated scenarios. When applying a Cartoon Effect it becomes possible with relative ease to create appearing to have originated from a drawing/animation.

It is the objective of this article to explore and provide a discussion based in the concept of through means of . Illustrated are various methods of image sharpening and in addition a implemented in reduction.

This article’s purpose is to explain and illustrate in detail the requirements involved in calculating intended for use in when implementing filters. This article’s discussion spans from exploring concepts in theory and continues on to implement concepts through C# sample source code.

This article serves to provides an introduction and discussion relating to methods and techniques. The Image Blur methods covered in this article include: , , , and  .

This article provides a discussion exploring the concept of rotation as a . In addition to conventional rotation this article illustrates the concept of individual colour channel rotation.

This article is focussed on illustrating the steps required in performing an . All of the concepts explored have been implemented by means of raw pixel data processing, no conventional drawing methods, such as GDI, are required.

This article’s objective is to illustrate concepts relating to Compass . The methods implemented in this article include: , , Scharr, and Isotropic.

This article illustrates and provides a discussion and implementation of Oil Painting Filters and related Image Cartoon Filters.

This article serves to provides a detailed discussion and implementation of a Stained Glass Image Filter. Primary topics explored include: Creating , Pixel Coordinate distance calculations implementing , and methods. In addition, this article explores Gradient Based implementing thresholds.

This article explores the concept of rendering from source . Beyond exploring concepts this article also provides a practical implementation of all the steps required in creating an ASCII Filter.

It is the purpose of this article to illustrate the concept of . This article extends the conventional implementation of algorithms through the application of equally sized only differing by a weight factor.

This article explores various concepts, which feature in combination when implementing Image Boundary Extraction. Concepts covered within this article include: Morphological and , Addition and Subtraction, Boundary Sharpening, Boundary Tracing and Boundary Extraction.

This article explores Abstract Colour Image filters as a process of Non-photo Realistic Image Rendering. The output produced reflects a variety of artistic effects.

0 Responses to “Code Samples”



  1. Leave a Comment

Leave a comment




Dewald Esterhuizen

Blog Stats

  • 869,853 hits

Enter your email address to follow and receive notifications of new posts by email.

Join 228 other subscribers

Archives

RSS SoftwareByDefault on MSDN

  • An error has occurred; the feed is probably down. Try again later.