image thumbnails that represent blur and noise

Upload: manokar-hemano

Post on 16-Jul-2015

94 views

Category:

Documents


0 download

TRANSCRIPT

IMAGE THUMBNAILS THAT REPRESENT BLUR AND NOISEAbstract The information about the blur and noise of an original image is lost when a standard image thumbnail is generated by filtering and sub sampling. Image browsing becomes difficult since the standard thumbnails do not distinguish between high-quality and low-quality originals. In this paper, an efficient algorithm with a blur-generating component and a noise-generating component preserves the local blur and the noise of the originals. The local blur is rapidly estimated using a scale-space expansion of the standard thumbnail and subsequently used to apply a space-varying blur to the thumbnail. The noise is estimated and rendered by using multirate signal transformations that allow most of the processing to occur at the lower spatial sampling rate of the thumbnail. The new thumbnails provide a quick, natural way for users to identify images of good quality. A subjective evaluation shows the new thumbnails are more representative of their originals for blurry images. The noise generating component improves the results for noisy images, but degrades the results for textured images. The blur generating component of the new thumbnails may always be used to advantage. The decision to use the noise generating component of the new thumbnails should be based on testing with the particular image mix expected for the application.

HARDWARE REQUIREMENT SPECIFICATIONS:

Processor Speed RAM capacity Floppy disk drive Hard disk drive Monitor Keyboard Mouse : :

: : : : : :

Pentium IV Above 500 MHz 256 MB 1.44 MB 40 GB 15 Color Monitor Multimedia Keyboard Scroll Mouse

2.3.2 SOFTWARE REQUIREMENT SPECIFICATIONS:

Operating System Front-end used Programming Language

: : :

Platform Independent .Net c#.Net

EXISTING SYSTEM:Both sharp and blurry originals appear sharp in the thumbnails, and both clean and noisy originals appear clean in the thumbnails. This leads to errors and inefficiencies during image selection when, as is often the case, image selection is based on the thumbnails rather than the high-resolution originals.

The thumbnails that we originally introduced in, like the ones we describe in this paper, do not modify the image composition, but rather better reflect the image quality of the originals. Our new thumbnails provide a quick, natural way for users to identify images of good quality at the same time that they select images with desired subject matter.

Proposed system:The subjective evaluation of the thumbnails shows that the blur component of the algorithm is robust and it may always be used with improved results. The noise component of the algorithm, however, improves the noisy images but degrades the textured images. The decision to use the noise component requires further testing with the expected image mix for the particular application. For the subjective evaluation described here, roughly

equal numbers of the different image categories were used to better test the different cases. How often noisy images and textured images occur for a given application may help determine whether the noise component should be used.

Thumbnail treatments were positioned to appear on the right and left side randomly. Image samples were presented to each observer in a different random order. This technique distributes any start-up or fatigue effects over different samples.

The algorithm was first tested informally with several thousand images and it was found effective for blurry and noisy images. There were, however, differences between the standard and new thumbnails for textured images.

Modules

USERINTERFACE DESIGN The goal of user interface design is to make the user's interaction as simple and efficient as possible, in terms of accomplishing user goalswhat is often called user-centered design. Good user interface design facilitates finishing the task at hand without drawing unnecessary attention to it. Graphic design may be utilized to support its usability. The design process must balance technical functionality and visual elements (e.g., mental model) to create a system that is not only operational but also usable and adaptable to changing user needs. Interface design is involved in a wide range of projects from computer systems, to cars, to commercial planes; all of these projects involve much of the same basic human interactions yet also require some unique skills and knowledge. NOISE REDUCTION

Noise reduction is the process of removing noise from a signal. Noise reduction techniques are conceptually very similar regardless of the signal being processed, however a priori knowledge of the characteristics of an expected signal can mean the implementations of these techniques vary greatly depending on the type of signal. All recording devices, both analogue and digital, have traits which make them susceptible to noise. Noise can be random or white noise with no coherence, or coherent noise introduced by the device's mechanism or processing algorithms. In electronic recording devices, a major form of noise is hiss caused by random electrons that, heavily influenced by heat, stray from their designated path. These stray electrons influence the voltage of the output signal and thus create detectable noise. In the case of photographic film and magnetic tape, noise (both visible and audible) is introduced due to the grain structure of the medium. In photographic film, the size of the grains in the film determines the film's sensitivity, more sensitive film having larger sized grains. In magnetic tape, the larger the grains of the magnetic particles (usually ferric oxide or magnetite), the more prone the medium is to noise. IMAGE BLUR A Gaussian blur (also known as Gaussian smoothing) is the result of blurring an image by a Gaussian function. It is a widely used effect in graphics software, typically to reduce image noise and reduce detail. The visual effect of this blurring technique is a smooth blur resembling that of viewing the image through a translucent screen, distinctly different from the effect produced by an out-of-focus lens or the shadow of an object under usual illumination. Gaussian smoothing is also used as a pre-processing stage in computer vision algorithms in order to enhance image structures at different scalessee scale-space representation and scale-space implementation. It is often desirable to be able to perform some kind of noise reduction on an image or signal. The median filter is a nonlinear digital filtering technique, often used to remove noise. Such noise reduction is a typical pre-processing step to improve the results of later processing (for example, edge detection on an image).

Literature Survey

Literature survey is the most important step in software development process. Before developing the tool it is necessary to determine the time factor, economy n company strength. Once these things r satisfied, ten next steps is to determine which operating system and language can be used for developing the tool. Once the programmers start building the tool the programmers need lot of external support. This support can be obtained from senior programmers, from book or from websites. Before building the system the above consideration r taken into account for developing the proposed system.

Fundamentals of Digital Image Processing

Interest in digital image processing methods stems from 2 principal application areas: (1) improvement of pictorial information for human interpretation, and (2) processing of scene data for autonomous machine perception.

In the second application area, interest focuses on procedures for extracting from an image information in a form suitable for computer processing. Examples include automatic character recognition,industrial machine vision for product assembly and inspection, military recognizance, automatic processing of fingerprints etc.

An image refers to a 2D light intensity function f(x,y), where (x,y) denote spatial coordinates and the value of f at any point (x,y) is proportional to the brightness or gray levels of the image at that point. A digital image is an image f(x,y) that has been discretized both in spatial coordinates and brightness. The elements of such a digital array are called image elements or pixels. Image acquisition: to acquire a digital image 2. Image preprocessing: to improve the image in ways that increase the chances for success of the other processes. 3. Image segmentation: to partitions an input image into its constituent parts or objects. 4. Image representation: to convert the input data to a form suitable for computer processing. 5. Image description: to extract features that result in some quantitative information of interest or features that are basic for differentiating one class of objects from another. 6. Image recognition: to assign a label to an object based on the information provided by its descriptors. 7. Image interpretation: to assign meaning to an ensemble of recognized objects.

Representative Image Thumbnails: Automatic and ManualImage thumbnails are used in most imaging products and applications, where they allow quick preview of the content of the underlying high resolution images. The question: How would you best represent a high resolution original image given a fixed number of thumbnail

pixels? is addressed using both automatically and manually generated thumbnails. Automatically generated thumbnails that preserve the image quality of the high resolution originals are first reviewed and subjectively evaluated. These thumbnails allow interactive identification of image quality, while simultaneously allowing the viewers knowledge to select desired subject matter. Images containing textures are, however, difficult for the automatic algorithm. Textured images are further studied by using photo editing to manually generate representative thumbnails. The automatic thumbnails are subjectively compared to standard (filter and subsample) thumbnails using clean, blurry, noisy, and textured images. Results using twenty subjects find the automatic thumbnails more representative of their originals for blurry images. In addition, as desired, there is little difference between the automatic and standard thumbnails for clean images. The noise component improves the results for noisy images, but degrades the results for textured images. Further studying textured images, the manual thumbnails were subjectively compared to standard thumbnails for four images. Evaluation using forty judgments found a bimodal distribution for preference between the standard and the manual thumbnails, with some observers preferring manual thumbnails and others preferring standard thumbnails.

For the blurry images, for the small thumbnails (96x96) treatment 2 produced slightly better representations of the original than did treatment 1, and both treatments were better than the standard. For the large thumbnails (300x300) there was no difference between treatment 3 and 4 performance, both were significantly better than the standard, and the result was consistent across the document suite and on average better than the 96x96 results. For the clean images there was no difference in the treatment performance for either size, and no significant preference between standard and treated thumbnails (that is to say, the treatments didnt break the clean images). For the grainy images no difference in performance between the thumbnail treatments for either size, and for both sizes the treated versions were more representative than the standard thumbnails. For the Textured images the treatment applied to the thumbnails in most cases was not as good a representation of the

original as the standard thumbnail. This was true for both sizes of thumbnails. In general, the treatment added speckle. In the case of the bird image with a screen door in the background, shown in Figure 5, and also shown as Document 20, the second textured plot in Figure 3, significant and non-representative distortion was visible. Treatment 4 on the 300x300 size was slightly worse than Treatment 3. Overall, the treatments appear to work well for blurry and grainy images, do not harm clean images, and do harm the textured images. For the blurry images, testing new values of may provide for better representation of the original than the treatments tested provided.

SYSTEM DESIGN

DATA FLOW

System Desgin

SOFTWARE ENVIRONMENT3.1 FEATURES OF FRONT END (.Net)

Server Application DevelopmentServer-side applications in the managed world are implemented through runtime hosts. Unmanaged applications host the common language runtime, which allows your custom managed code to control the behavior of the server. This model provides you with all the features of the common language runtime and class library while gaining the performance and scalability of the host server.

The following illustration shows a basic network schema with managed code running in different server environments. Servers such as IIS and SQL Server can perform standard operations while your application logic executes through the managed code.

Server-side managed codeASP.NET is the hosting environment that enables developers to use the .NET Framework to target Web-based applications. However, ASP.NET is more than just a runtime host; it is a complete architecture for developing Web sites and Internet-distributed objects using managed code. Both Web Forms and XML Web services use IIS and ASP.NET as the publishing mechanism for applications, and both have a collection of supporting classes in the .NET Framework. XML Web services, an important evolution in Web-based technology, are distributed, server-side application components similar to common Web sites. However, unlike Web-based applications, XML Web services components have no UI and are not targeted for browsers such as Internet Explorer and Netscape Navigator. Instead, XML Web services consist of reusable software components designed to be consumed by other applications, such as traditional client applications, Web-based applications, or even other XML Web services. As a result, XML Web services technology is rapidly moving application development and deployment into the highly distributed environment of the Internet. If you have used earlier versions of ASP technology, you will immediately notice the improvements that ASP.NET and Web Forms offers. For example, you can develop Web Forms pages in any language that supports the .NET Framework. In addition, your code no longer needs to share the same file with your HTTP text (although it can continue to do so if you prefer). Web Forms pages execute in native machine language because, like any other managed application, they take full advantage of the runtime. In contrast, unmanaged ASP pages are always scripted and interpreted. ASP.NET pages are faster, more functional, and easier to develop than unmanaged ASP pages because they interact with the runtime like any managed application. The .NET Framework also provides a collection of classes and tools to aid in development and consumption of XML Web services applications. XML Web services are built on standards such as SOAP (a remote procedure-call protocol), XML (an extensible data

format), and WSDL (the Web Services Description Language). The .NET Framework is built on these standards to promote interoperability with non-Microsoft solutions. For example, the Web Services Description Language tool included with the .NET Framework SDK can query an XML Web service published on the Web, parse its WSDL description, and produce C# or Visual Basic source code that your application can use to become a client of the XML Web service. The source code can create classes derived from classes in the class library that handle all the underlying communication using SOAP and XML parsing. Although you can use the class library to consume XML Web services directly, the Web Services Description Language tool and the other tools contained in the SDK facilitate your development efforts with the .NET Framework. If you develop and publish your own XML Web service, the .NET Framework provides a set of classes that conform to all the underlying communication standards, such as SOAP, WSDL, and XML. Using those classes enables you to focus on the logic of your service, without concerning yourself with the communications infrastructure required by distributed software development. Finally, like Web Forms pages in the managed.

Features of .netMicrosoft .NET is a set of Microsoft software technologies for rapidly building and integrating XML Web services, Microsoft Windows-based applications, and Web solutions. The .NET Framework is a language-neutral platform for writing programs that can easily and securely interoperate. Theres no language barrier with .NET: there are numerous languages available to the developer including Managed C++, C#, Visual Basic and Java Script. The .NET framework provides the foundation for components to interact seamlessly, whether locally or remotely on different platforms. It standardizes common data types and communications protocols so that components created in different languages can easily interoperate. .NET is also the collective name given to various software components built upon the .NET platform. These will be both products (Visual Studio.NET and Windows.NET Server, for instance) and services (like Passport, .NET My Services, and so on).

THE .NET FRAMEWORK

The .NET Framework has two main parts: 1. The Common Language Runtime (CLR). 2. A hierarchical set of class libraries. The CLR is described as the execution engine of .NET. It provides the environment within which programs run. The most important features are Conversion from a low-level assembler-style language, called Intermediate Language (IL), into code native to the platform being executed on. Memory management, notably including garbage collection. Checking and enforcing security restrictions on the running code. Loading and executing programs, with version control and other such features. The following features of the .NET framework are also worth description:

Managed CodeThe code that targets .NET, and which contains certain extra Information - metadata - to describe itself. Whilst both managed and unmanaged code can run in the runtime, only managed code contains the information that allows the CLR to guarantee, for instance, safe execution and interoperability.

Managed Data

With Managed Code comes Managed Data. CLR provides memory allocation and Deal location facilities, and garbage collection. Some .NET languages use Managed Data by default, such as C#, Visual Basic.NET and JScript.NET, whereas others, namely C++, do not. Targeting CLR can, depending on the language youre using, impose certain constraints on the features available. As with managed and unmanaged code, one can have both managed and unmanaged data in .NET applications - data that doesnt get garbage collected but instead is looked after by unmanaged code.

Common Type SystemThe CLR uses something called the Common Type System (CTS) to strictly enforce type-safety. This ensures that all classes are compatible with each other, by describing types in a common way. CTS define how types work within the runtime, which enables types in one language to interoperate with types in another language, including cross-language exception handling. As well as ensuring that types are only used in appropriate ways, the runtime also ensures that code doesnt attempt to access memory that hasnt been allocated to it.

Common Language SpecificationThe CLR provides built-in support for language interoperability. To ensure that you can develop managed code that can be fully used by developers using any programming language, a set of language features and rules for using them called the Common Language Specification (CLS) has been defined. Components that follow these rules and expose only CLS features are considered CLScompliant.

The class library.NET provides a single-rooted hierarchy of classes, containing over 7000 types. The root of the namespace is called System; this contains basic types like Byte, Double, Boolean, and String, as well as Object. All objects derive

from System. Object. As well as objects, there are value types. Value types can be allocated on the stack, which can provide useful flexibility. There are also efficient means of converting value types to object types if and when necessary. The set of classes is pretty comprehensive, providing collections, file, screen, and network I/O, threading, and so on, as well as XML and database connectivity. The class library is subdivided into a number of sets (or namespaces), each providing distinct areas of functionality, with dependencies between the namespaces kept to a minimum.

Languages supported by .netThe multi-language capability of the .NET Framework and Visual Studio .NET enables developers to use their existing programming skills to build all types of applications and XML Web services. The .NET framework supports new versions of Microsofts old favourites Visual Basic and C++ (as VB.NET and Managed C++), but there are also a number of new additions to the family. Visual Basic .NET has been updated to include many new and improved language features that make it a powerful object-oriented programming language. These features include inheritance, interfaces, and overloading, among others. Visual Basic also now supports structured exception handling, custom attributes and also supports multi-threading. Visual Basic .NET is also CLS compliant, which means that any CLS-compliant language can use the classes, objects, and components you create in Visual Basic .NET. Managed Extensions for C++ and attributed programming are just some of the enhancements made to the C++ language. Managed Extensions simplify the task of migrating existing C++ applications to the new .NET Framework. C# is Microsofts new language. Its a C-style language that is essentially C++ for Rapid Application Development. Unlike other languages, its specification is just the grammar of the language. It has no standard library of its own and instead has been designed with the intention of using the .NET libraries as its own. Microsoft Visual J# .NET provides the easiest transition for Javalanguage developers into the world of XML Web Services and dramatically

improves the interoperability of Java-language programs with existing software written in a variety of other programming languages. Active State has created Visual Perl and Visual Python, which enable .NET-aware applications to be built in either Perl or Python. Both products can be integrated into the Visual Studio .NET environment. Visual Perl includes support for Active States Perl Dev Kit. Other languages for which .NET compilers are available include FORTRAN COBOL Eiffel

ASP.NET XML WEB SERVICES

Windows Forms

Base Class Libraries Common Language Runtime Operating System

C#.NET is also compliant with CLS (Common Language Specification) and supports structured exception handling. CLS is set of rules and constructs that are supported by the CLR (Common Language Runtime). CLR is the runtime environment provided by the .NET Framework; it manages the execution of the code and also makes the development process easier by providing services. C#.NET is a CLS-compliant language. Any objects, classes, or components that created in C#.NET can be used in any other CLS-compliant language. In addition, we can use objects, classes, and components created in other CLS-compliant languages in C#.NET.

Constructors and destructorsConstructors are used to initialize objects, whereas destructors are used to destroy them. In other words, destructors are used to release the resources allocated to the

object. In C#.NET the sub finalize procedure is available. The sub finalize procedure is used to complete the tasks that must be performed when an object is destroyed. The sub finalize procedure is called automatically when an object is destroyed.

Garbage collectionGarbage Collection is another new feature in C#.NET. The .NET Framework monitors allocated resources, such as objects and variables. In addition, the .NET Framework automatically releases memory for reuse by destroying objects that are no longer in use. In C#.NET, the garbage collector checks for the objects that are not currently in use by applications. When the garbage collector comes across an object that is marked for garbage collection, it releases the memory occupied by the object.

OverloadingOverloading is another feature in C#. Overloading enables us to define multiple procedures with the same name, where each procedure has a different set of arguments. Besides using overloading for procedures, we can use it for constructors and properties in a class.

Structured exception handlingC#.NET supports structured handling, which enables us to detect and remove errors at runtime. In C#.NET, we need to use TryCatchFinally statements to create exception handlers.Using TryCatchFinally statements, we can create robust and effective exception handlers to improve the performance of our application.

SOFTWARE ENVIRONMENT3.1 FEATURES OF FRONT END (.Net)

Server Application DevelopmentServer-side applications in the managed world are implemented through runtime hosts. Unmanaged applications host the common language runtime, which allows your custom managed code to control the behavior of the server. This model provides you with all the features of the common language runtime and class library while gaining the performance and scalability of the host server. The following illustration shows a basic network schema with managed code running in different server environments. Servers such as IIS and SQL Server can perform standard operations while your application logic executes through the managed code.

Server-side managed codeASP.NET is the hosting environment that enables developers to use the .NET Framework to target Web-based applications. However, ASP.NET is more than just a runtime host; it is a complete architecture for developing Web sites and Internet-distributed objects using managed code. Both Web Forms and XML Web services use IIS and ASP.NET as the publishing mechanism for applications, and both have a collection of supporting classes in the .NET Framework. XML Web services, an important evolution in Web-based technology, are distributed, server-side application components similar to common Web sites. However, unlike Web-based applications, XML Web services components have no UI and are not targeted for browsers such as Internet Explorer and Netscape Navigator. Instead, XML Web services consist of reusable software components designed to be consumed by other applications, such as traditional client applications, Web-based applications, or even other XML Web services. As a result, XML Web services technology is rapidly moving application development and deployment into the highly distributed environment of the Internet. If you have used earlier versions of ASP technology, you will immediately notice the improvements that ASP.NET and Web Forms offers. For example, you can develop Web Forms pages in any language that supports the .NET Framework. In addition, your code no longer needs to share the same file with your HTTP text (although it can continue to do so if

you prefer). Web Forms pages execute in native machine language because, like any other managed application, they take full advantage of the runtime. In contrast, unmanaged ASP pages are always scripted and interpreted. ASP.NET pages are faster, more functional, and easier to develop than unmanaged ASP pages because they interact with the runtime like any managed application. The .NET Framework also provides a collection of classes and tools to aid in development and consumption of XML Web services applications. XML Web services are built on standards such as SOAP (a remote procedure-call protocol), XML (an extensible data format), and WSDL (the Web Services Description Language). The .NET Framework is built on these standards to promote interoperability with non-Microsoft solutions. For example, the Web Services Description Language tool included with the .NET Framework SDK can query an XML Web service published on the Web, parse its WSDL description, and produce C# or Visual Basic source code that your application can use to become a client of the XML Web service. The source code can create classes derived from classes in the class library that handle all the underlying communication using SOAP and XML parsing. Although you can use the class library to consume XML Web services directly, the Web Services Description Language tool and the other tools contained in the SDK facilitate your development efforts with the .NET Framework. If you develop and publish your own XML Web service, the .NET Framework provides a set of classes that conform to all the underlying communication standards, such as SOAP, WSDL, and XML. Using those classes enables you to focus on the logic of your service, without concerning yourself with the communications infrastructure required by distributed software development. Finally, like Web Forms pages in the managed.

Features of .netMicrosoft .NET is a set of Microsoft software technologies for rapidly building and integrating XML Web services, Microsoft Windows-based applications, and Web solutions. The .NET Framework is a language-neutral platform for writing programs that can easily and securely interoperate. Theres no language barrier with .NET: there are numerous languages available to the developer including Managed C++, C#, Visual Basic and Java Script. The .NET framework provides the foundation for components to interact seamlessly,

whether locally or remotely on different platforms. It standardizes common data types and communications protocols so that components created in different languages can easily interoperate. .NET is also the collective name given to various software components built upon the .NET platform. These will be both products (Visual Studio.NET and Windows.NET Server, for instance) and services (like Passport, .NET My Services, and so on).

THE .NET FRAMEWORK

The .NET Framework has two main parts: 1. The Common Language Runtime (CLR). 2. A hierarchical set of class libraries. The CLR is described as the execution engine of .NET. It provides the environment within which programs run. The most important features are Conversion from a low-level assembler-style language, called Intermediate Language (IL), into code native to the platform being executed on. Memory management, notably including garbage collection. Checking and enforcing security restrictions on the running code. Loading and executing programs, with version control and other such features. The following features of the .NET framework are also worth description:

Managed Code

The code that targets .NET, and which contains certain extra Information - metadata - to describe itself. Whilst both managed and unmanaged code can run in the runtime, only managed code contains the information that allows the CLR to guarantee, for instance, safe execution and interoperability.

Managed DataWith Managed Code comes Managed Data. CLR provides memory allocation and Deal location facilities, and garbage collection. Some .NET languages use Managed Data by default, such as C#, Visual Basic.NET and JScript.NET, whereas others, namely C++, do not. Targeting CLR can, depending on the language youre using, impose certain constraints on the features available. As with managed and unmanaged code, one can have both managed and unmanaged data in .NET applications - data that doesnt get garbage collected but instead is looked after by unmanaged code.

Common Type SystemThe CLR uses something called the Common Type System (CTS) to strictly enforce type-safety. This ensures that all classes are compatible with each other, by describing types in a common way. CTS define how types work within the runtime, which enables types in one language to interoperate with types in another language, including cross-language exception handling. As well as ensuring that types are only used in appropriate ways, the runtime also ensures that code doesnt attempt to access memory that hasnt been allocated to it.

Common Language SpecificationThe CLR provides built-in support for language interoperability. To ensure that you can develop managed code that can be fully used by developers using any programming language, a set of language features and rules for using them

called the Common Language Specification (CLS) has been defined. Components that follow these rules and expose only CLS features are considered CLScompliant.

The class library.NET provides a single-rooted hierarchy of classes, containing over 7000 types. The root of the namespace is called System; this contains basic types like Byte, Double, Boolean, and String, as well as Object. All objects derive from System. Object. As well as objects, there are value types. Value types can be allocated on the stack, which can provide useful flexibility. There are also efficient means of converting value types to object types if and when necessary. The set of classes is pretty comprehensive, providing collections, file, screen, and network I/O, threading, and so on, as well as XML and database connectivity. The class library is subdivided into a number of sets (or namespaces), each providing distinct areas of functionality, with dependencies between the namespaces kept to a minimum.

Languages supported by .netThe multi-language capability of the .NET Framework and Visual Studio .NET enables developers to use their existing programming skills to build all types of applications and XML Web services. The .NET framework supports new versions of Microsofts old favourites Visual Basic and C++ (as VB.NET and Managed C++), but there are also a number of new additions to the family. Visual Basic .NET has been updated to include many new and improved language features that make it a powerful object-oriented programming language. These features include inheritance, interfaces, and overloading, among others. Visual Basic also now supports structured exception handling, custom attributes and also supports multi-threading. Visual Basic .NET is also CLS compliant, which means that any CLS-compliant language can use the classes, objects, and components you create in Visual Basic .NET.

Managed Extensions for C++ and attributed programming are just some of the enhancements made to the C++ language. Managed Extensions simplify the task of migrating existing C++ applications to the new .NET Framework. C# is Microsofts new language. Its a C-style language that is essentially C++ for Rapid Application Development. Unlike other languages, its specification is just the grammar of the language. It has no standard library of its own and instead has been designed with the intention of using the .NET libraries as its own. Microsoft Visual J# .NET provides the easiest transition for Javalanguage developers into the world of XML Web Services and dramatically improves the interoperability of Java-language programs with existing software written in a variety of other programming languages. Active State has created Visual Perl and Visual Python, which enable .NET-aware applications to be built in either Perl or Python. Both products can be integrated into the Visual Studio .NET environment. Visual Perl includes support for Active States Perl Dev Kit. Other languages for which .NET compilers are available include FORTRAN COBOL Eiffel

ASP.NET XML WEB SERVICES

Windows Forms

Base Class Libraries Common Language Runtime Operating System

C#.NET is also compliant with CLS (Common Language Specification) and supports structured exception handling. CLS is set of rules and constructs that are supported

by the CLR (Common Language Runtime). CLR is the runtime environment provided by the .NET Framework; it manages the execution of the code and also makes the development process easier by providing services. C#.NET is a CLS-compliant language. Any objects, classes, or components that created in C#.NET can be used in any other CLS-compliant language. In addition, we can use objects, classes, and components created in other CLS-compliant languages in C#.NET.

Constructors and destructorsConstructors are used to initialize objects, whereas destructors are used to destroy them. In other words, destructors are used to release the resources allocated to the object. In C#.NET the sub finalize procedure is available. The sub finalize procedure is used to complete the tasks that must be performed when an object is destroyed. The sub finalize procedure is called automatically when an object is destroyed.

Garbage collectionGarbage Collection is another new feature in C#.NET. The .NET Framework monitors allocated resources, such as objects and variables. In addition, the .NET Framework automatically releases memory for reuse by destroying objects that are no longer in use. In C#.NET, the garbage collector checks for the objects that are not currently in use by applications. When the garbage collector comes across an object that is marked for garbage collection, it releases the memory occupied by the object.

OverloadingOverloading is another feature in C#. Overloading enables us to define multiple procedures with the same name, where each procedure has a different set of arguments. Besides using overloading for procedures, we can use it for constructors and properties in a class.

Structured exception handling

C#.NET supports structured handling, which enables us to detect and remove errors at runtime. In C#.NET, we need to use TryCatchFinally statements to create exception handlers.Using TryCatchFinally statements, we can create robust and effective exception handlers to improve the performance of our application.

Source Code

BitmapViewFrm using System; using System.Drawing; using System.Windows.Forms; namespace ImageProcessing3 { public partial class BitmapViewFrm : Form { CurrentImageHandler currImageHandler; public BitmapViewFrm(CurrentImageHandler currImageHandler) { InitializeComponent(); this.currImageHandler = currImageHandler; }

private void BitmapViewFrm_Paint(object sender, PaintEventArgs e) { int xPos = (this.Width - currImageHandler.CurrentBitmap.Width) / 2; int yPos = (this.Height - currImageHandler.CurrentBitmap.Height) / 2; Graphics g = e.Graphics; g.DrawImage(currImageHandler.CurrentBitmap, new Rectangle(xPos, yPos, Convert.ToInt32(currImageHandler.CurrentBitmap.Width), Convert.ToInt32(currImageHandler.CurrentBitmap.Height))); } private void BitmapViewFrm_MouseClick(object sender, MouseEventArgs e) { this.Close(); } private void BitmapViewFrm_KeyDown(object sender, KeyEventArgs e) { this.Close(); } } }

Thumbnailview.csusing System.Drawing; using System.Windows.Forms; namespace ImageProcessing3 { public partial class ThumbnailViewFrm : Form { CurrentImageHandler currImgHandler; public ThumbnailViewFrm(CurrentImageHandler currImgHandler) { InitializeComponent(); this.currImgHandler = currImgHandler; }

private void ThumbnailViewFrm_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; float h = (180.0F * (float)currImgHandler.CurrentBitmap.Height) / (float)currImgHandler.CurrentBitmap.Width; this.Width = 180; this.Height = (int)h + 25; g.DrawImage(currImgHandler.ThumbnailView(180,(int)h), new Rectangle(0, 0, 180, (int)h)); } } } BrightnessForm using System; using System.Windows.Forms; namespace ImageProcessing3 { public partial class BrightnessForm : Form { public BrightnessForm() { InitializeComponent(); btnOK.DialogResult = DialogResult.OK; btnCancel.DialogResult = DialogResult.Cancel; } public int BrightnessValue { get { if (string.IsNullOrEmpty(txtBrightnessValue.Text)) txtBrightnessValue.Text = "0"; return Convert.ToInt32(txtBrightnessValue.Text); } set { txtBrightnessValue.Text = value.ToString(); } } } } ContrastForm.cs using System; using System.Windows.Forms; namespace ImageProcessing3

{ public partial class ContrastForm : Form { public ContrastForm() { InitializeComponent(); btnOK.DialogResult = DialogResult.OK; btnCancel.DialogResult = DialogResult.Cancel; } public float ContrastValue { get { if (string.IsNullOrEmpty(txtContrastValue.Text)) txtContrastValue.Text = "0"; return Convert.ToSingle(txtContrastValue.Text); } set { txtContrastValue.Text = value.ToString(); } } } } CropForm.cs using System; using System.Windows.Forms; namespace ImageProcessing3 { public partial class CropForm : Form { public CropForm() { InitializeComponent(); btnOK.DialogResult = DialogResult.OK; btnCancel.DialogResult = DialogResult.Cancel; } public int CropXPosition { get { if (string.IsNullOrEmpty(txtX.Text)) txtX.Text = "0"; return Convert.ToInt32(txtX.Text); } set { txtX.Text = value.ToString(); } }

public int CropYPosition { get { if (string.IsNullOrEmpty(txtY.Text)) txtY.Text = "0"; return Convert.ToInt32(txtY.Text); } set { txtY.Text = value.ToString(); } } public int CropWidth { get { if (string.IsNullOrEmpty(txtWidth.Text)) txtWidth.Text = "0"; return Convert.ToInt32(txtWidth.Text); } set { txtWidth.Text = value.ToString(); } } public int CropHeight { get { if (string.IsNullOrEmpty(txtHeight.Text)) txtHeight.Text = "0"; return Convert.ToInt32(txtHeight.Text); } set { txtHeight.Text = value.ToString(); } } } } ImageInfoFrm.cs using using using using System; System.Windows.Forms; System.IO; ImageFunctions;

namespace ImageProcessing3 { public partial class ImageInfoFrm : Form { ImageHandler imageHandler; public ImageInfoFrm(ImageHandler imageHandler)

{ this.imageHandler = imageHandler; InitializeComponent(); } private void ImageInfo_Load(object sender, EventArgs e) { FileInfo fileInfo = new FileInfo(imageHandler.CurrentBitmapPath); lblImageName.Text = fileInfo.Name.Replace(fileInfo.Extension,""); lblImageExtension.Text = fileInfo.Extension; string loc = fileInfo.DirectoryName; if (loc.Length > 50) loc = loc.Substring(0, 15) + "..." + loc.Substring(loc.LastIndexOf("\\")); lblImageLocation.Text = loc; lblImageDimension.Text = imageHandler.CurrentBitmap.Width + " x " + imageHandler.CurrentBitmap.Height; lblImageSize.Text = (fileInfo.Length / 1024.0).ToString("0.0") + " KB"; lblImageCreatedOn.Text = fileInfo.CreationTime.ToString("dddd MMMM dd, yyyy"); } private void btnOK_Click(object sender, EventArgs e) { this.Close(); } } } ImageProcessing.cs using using using using System; System.Drawing; System.Windows.Forms; ImageFunctions;

namespace ImageProcessing3 { public partial class ImageProcessing : Form { OpenFileDialog oDlg; SaveFileDialog sDlg; PrintDialog pDlg; double zoomFactor = 1.0; private MenuItem cZoom; CurrentImageHandler currImgHandler; public ImageProcessing()

{ InitializeComponent(); oDlg = new OpenFileDialog(); // Open Dialog Initialization oDlg.RestoreDirectory = true; oDlg.InitialDirectory = "C:\\"; oDlg.FilterIndex = 1; oDlg.Filter = "jpg Files (*.jpg)|*.jpg|gif Files (*.gif)|*.gif|png Files (*.png)|*.png |bmp Files (*.bmp)|*.bmp"; /*************************/ sDlg = new SaveFileDialog(); // Save Dialog Initialization sDlg.RestoreDirectory = true; sDlg.InitialDirectory = "C:\\"; sDlg.FilterIndex = 1; sDlg.Filter = "jpg Files (*.jpg)|*.jpg|gif Files (*.gif)|*.gif|png Files (*.png)|*.png |bmp Files (*.bmp)|*.bmp"; /*************************/ pDlg = new PrintDialog(); // Print Dialog Initialization /*************************/ cZoom = menuItemZoom100; // Current Zoom Percentage = 100% currImgHandler = new CurrentImageHandler(); } private void ImageProcessing_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawImage(currImgHandler.CurrentBitmap, new Rectangle(this.AutoScrollPosition.X, this.AutoScrollPosition.Y, Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor))); } private void menuItemOpen_Click(object sender, EventArgs e) { try { if (DialogResult.OK == oDlg.ShowDialog()) { currImgHandler.CurrentFileHandler.Load(oDlg.FileName); this.AutoScroll = true; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); menuItemImageInfo.Enabled = true; ImageInfoFrm imgInfo = new ImageInfoFrm(currImgHandler); imgInfo.Show(); } }

catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemSave_Click(object sender, EventArgs e) { try { if (DialogResult.OK == sDlg.ShowDialog()) { currImgHandler.CurrentFileHandler.Save(sDlg.FileName); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemPrint_Click(object sender, EventArgs e) { try { if (DialogResult.OK == pDlg.ShowDialog()) { pDlg.Document.Print(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemExit_Click(object sender, EventArgs e) { this.Close(); } private void menuItemUndo_Click(object sender, EventArgs e) { currImgHandler.ResetBitmap();

this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } private void menuItemClearImage_Click(object sender, EventArgs e) { currImgHandler.ClearImage(); this.Invalidate(); } private void menuItemImageInfo_Click(object sender, EventArgs e) { ImageInfoFrm imgInfo = new ImageInfoFrm(currImgHandler); imgInfo.Show(); } private void menuItemZoom25_Click(object sender, EventArgs e) { try { zoomFactor = 0.25; cZoom.Checked = false; menuItemZoom25.Checked = true; cZoom = menuItemZoom25; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemZoom50_Click(object sender, EventArgs e) { try { zoomFactor = 0.5; cZoom.Checked = false; menuItemZoom50.Checked = true; cZoom = menuItemZoom50; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor));

this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemZoom100_Click(object sender, EventArgs e) { try { zoomFactor = 1.0; cZoom.Checked = false; menuItemZoom100.Checked = true; cZoom = menuItemZoom100; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemZoom150_Click(object sender, EventArgs e) { try { zoomFactor = 1.5; cZoom.Checked = false; menuItemZoom150.Checked = true; cZoom = menuItemZoom150; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } }

private void menuItemZoom200_Click(object sender, EventArgs e) { try { zoomFactor = 2.0; cZoom.Checked = false; menuItemZoom200.Checked = true; cZoom = menuItemZoom200; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemZoom300_Click(object sender, EventArgs e) { try { zoomFactor = 3.0; cZoom.Checked = false; menuItemZoom300.Checked = true; cZoom = menuItemZoom300; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemZoom400_Click(object sender, EventArgs e) { try { zoomFactor = 4.0; cZoom.Checked = false; menuItemZoom400.Checked = true; cZoom = menuItemZoom400;

this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemZoom500_Click(object sender, EventArgs e) { try { zoomFactor = 5.0; cZoom.Checked = false; menuItemZoom500.Checked = true; cZoom = menuItemZoom500; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemViewBitmap_Click(object sender, EventArgs e) { BitmapViewFrm bFrm = new BitmapViewFrm(currImgHandler); bFrm.Show(); } private void menuItemThumbnailView_Click(object sender, EventArgs e) { ThumbnailViewFrm ThumbnailViewFrm(currImgHandler); tFrm.Show(); } tFrm = new

private void menuItemFilterRed_Click(object sender, EventArgs e) { try

{ currImgHandler.CurrentFilterHandler.SetColorFilter(ColorFilterTy pes.Red); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemFilterGreen_Click(object sender, EventArgs e) { try { currImgHandler.CurrentFilterHandler.SetColorFilter(ColorFilterTy pes.Green); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemFilterBlue_Click(object sender, EventArgs e) { try { currImgHandler.CurrentFilterHandler.SetColorFilter(ColorFilterTy pes.Blue); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemFilterAlpha_Click(object sender, EventArgs e) { try { AlphaFrm aFrm = new AlphaFrm(); aFrm.AlphaValue = 255; if (aFrm.ShowDialog() == DialogResult.OK)

{ currImgHandler.CurrentFilterHandler.SetAlphaFilter(aFrm.Alp haValue); this.Invalidate(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemBrightness_Click(object sender, EventArgs e) { try { BrightnessForm bFrm = new BrightnessForm(); bFrm.BrightnessValue = 0; if (bFrm.ShowDialog() == DialogResult.OK) { currImgHandler.CurrentBrightnessHandler.SetBrightness(bFr m.BrightnessValue); this.Invalidate(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemContrast_Click(object sender, EventArgs e) { try { ContrastForm cFrm = new ContrastForm(); cFrm.ContrastValue = 0; if (cFrm.ShowDialog() == DialogResult.OK) { currImgHandler.CurrentContrastHandler.SetContrast(cFrm.Co ntrastValue); this.Invalidate(); } } catch (Exception ex) {

MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemGrayscale_Click(object sender, EventArgs e) { try { currImgHandler.CurrentGrayscaleHandler.SetGrayscale(); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemSepiaTone_Click(object sender, EventArgs e) { try { currImgHandler.CurrentSepiaToneHandler.SetSepiaTone(); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemInvert_Click(object sender, EventArgs e) { try { currImgHandler.CurrentInvHandler.SetInversion(); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemResize_Click(object sender, EventArgs e) {

try { ResizeForm rFrm = new ResizeForm(); rFrm.NewWidth = currImgHandler.CurrentBitmap.Width; rFrm.NewHeight = currImgHandler.CurrentBitmap.Height; if (rFrm.ShowDialog() == DialogResult.OK) { currImgHandler.Resize(rFrm.NewWidth, rFrm.NewHeight); this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemFlipH_Click(object sender, EventArgs e) { try { currImgHandler.CurrentRotationHandler.Flip(RotateFlipType.Rot ateNoneFlipX); this.AutoScroll = true; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemFlipV_Click(object sender, EventArgs e) { try { currImgHandler.CurrentRotationHandler.Flip(RotateFlipType.Rot ateNoneFlipY); this.AutoScroll = true;

this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemRotate90_Click(object sender, EventArgs e) { try { currImgHandler.CurrentRotationHandler.Flip(RotateFlipType.Rot ate90FlipNone); this.AutoScroll = true; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemRotate180_Click(object sender, EventArgs e) { try { currImgHandler.CurrentRotationHandler.Flip(RotateFlipType.Rot ate180FlipNone); this.AutoScroll = true; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } }

private void menuItemRotate270_Click(object sender, EventArgs e) { try { currImgHandler.CurrentRotationHandler.Flip(RotateFlipType.Rot ate270FlipNone); this.AutoScroll = true; this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); this.Invalidate(); } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemCustomRotate_Click(object sender, EventArgs e) { try { RotateForm rFrm = new RotateForm(); rFrm.RotateAngle = 0; if (rFrm.ShowDialog() == DialogResult.OK) { currImgHandler.CurrentRotationHandler.Rotate(rFrm.RotateA ngle); this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width), Convert.ToInt32(currImgHandler.CurrentBitmap.Height)); this.Invalidate(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemCrop_Click(object sender, EventArgs e) { try { CropForm cpFrm = new CropForm();

cpFrm.CropXPosition = 0; cpFrm.CropYPosition = 0; cpFrm.CropWidth = currImgHandler.CurrentBitmap.Width; cpFrm.CropHeight = currImgHandler.CurrentBitmap.Height; if (cpFrm.ShowDialog() == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; currImgHandler.CurrentCropHandler.DrawOutCropArea(cpFrm .CropXPosition, cpFrm.CropYPosition, cpFrm.CropWidth, cpFrm.CropHeight); this.Invalidate(); if (MessageBox.Show("Do u want to crop this area?", "ImageProcessing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { currImgHandler.CurrentCropHandler.Crop(cpFrm.CropXPosi tion, cpFrm.CropYPosition, cpFrm.CropWidth, cpFrm.CropHeight); this.AutoScrollMinSize = new Size(Convert.ToInt32(currImgHandler.CurrentBitmap.Width * zoomFactor), Convert.ToInt32(currImgHandler.CurrentBitmap.Height * zoomFactor)); } else { currImgHandler.CurrentCropHandler.RemoveCropAreaDraw (); } this.Invalidate(); this.Cursor = Cursors.Default; } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemInsertText_Click(object sender, EventArgs e) { try { InsertTextForm itFrm = new InsertTextForm(); itFrm.DisplayTextPositionX = itFrm.DisplayTextPositionY = 0; if (itFrm.ShowDialog() == DialogResult.OK) { currImgHandler.CurrentTextInsHandler.Insert(itFrm.DisplayTe xt, itFrm.DisplayTextPositionX, itFrm.DisplayTextPositionY, itFrm.DisplayTextFont, itFrm.DisplayTextFontSize, itFrm.DisplayTextFontStyle, itFrm.DisplayTextAngle,

itFrm.DisplayTextOpacity, itFrm.DisplayTextColor1, itFrm.DisplayTextColor2, itFrm.DisplayTextGradientStyle); this.Invalidate(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemInsertImage_Click(object sender, EventArgs e) { try { InsertImageForm iiFrm = new InsertImageForm(); iiFrm.DisplayImagePositionX = iiFrm.DisplayImagePositionY = 0; if (iiFrm.ShowDialog() == DialogResult.OK) { currImgHandler.CurrentImgInsHandler.Insert(iiFrm.DisplayIma gePath, iiFrm.DisplayImagePositionX, iiFrm.DisplayImagePositionY, iiFrm.DisplayImageWidth, iiFrm.DisplayImageHeight, iiFrm.DisplayImageAngle, iiFrm.DisplayImageOpacity); this.Invalidate(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void menuItemInsertShape_Click(object sender, EventArgs e) { try { InsertShapeForm isFrm = new InsertShapeForm(); isFrm.DisplayShapePositionX = isFrm.DisplayShapePositionY = 0; if (isFrm.ShowDialog() == DialogResult.OK) { currImgHandler.CurrentShapeInsHandler.Insert(isFrm.Display Shape, isFrm.DisplayShapePositionX, isFrm.DisplayShapePositionY, isFrm.DisplayShapeWidth, isFrm.DisplayShapeHeight, isFrm.DisplayShapeAngle, isFrm.DisplayShapeOpacity, isFrm.DisplayShapeColor1, isFrm.DisplayShapeColor2, isFrm.DisplayShapeGradientStyle);

this.Invalidate(); } } catch (Exception ex) { MessageBox.Show("Error occured: " + ex.Message, "Image Processing", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }