Showing posts with label WPF. Show all posts
Showing posts with label WPF. Show all posts

Tuesday, 7 May 2013

WPF Architecture


The Major components of WPF Architecture are Presentation Framework, Presentation Core and Media Integration Layer. The architecture divides in three major groups Managed Layer, Media Integration Layer (Unmanaged code) and Core Operating System.

Managed layer contains WindowsBase, Presentation Framework and Presentation Core assembly. Media Integration Layer contains Milcore(Media Integration Library Core)  and WindowsCodecs modules and both are unmanaged code. Media Integration Layer interacts with Direct3D and Direct3D interacts with Device Driver.


Managed Layer

Presentation Framework – Holds top level WPF types includes Window, Controls, Styles, and Layout Panels etc. The code and controls written in WPF Application is mostly interacting with this layer.

Presentation Core – Holds base types such as UI Element and Visual. Almost all the controls you are directly interacting with are derived from these types. Presentation Framework uses most of the types defined in this layer.

WindowBase: They hold even more basic elements which are capable of being used outside the WPF environment like Dispatcher.

Unmanaged Layer(milcore.dll) 

MilCore –
 Media Integration Library is core rendering system. MIL is unmanaged code. This layer converts WPF elements into the format that Direct3D expects. Windows7 & Windows Vista use this assembly to render its Desktop.

WindowsCodecs– This is low level API which gives imaging support in WPF applications. Provides supports for imaging like image processing, image displaying and scaling etc.


Direct3D – This layer is used to render graphics created using WPF Applications.

User32:- This provides the windows look and feel for buttons and textboxes and other UI elements. User32 lacked drawing capabilities.

GDI (Graphics device interface):- Microsoft introduced GDI to provide drawing capabilities. GDI not only provided drawing capabilities but also provided a high level of abstraction on the hardware display. In other words it encapsulates all complexities of hardware in the GDI API.

GDI+:- GDI+ was introduced which basically extends GDI and provides extra functionalities like jpg and PNG support, gradient shading and anti-aliasing. The biggest issue with GDI API was it did not use hardware acceleration and did not have animation and 3D support.

Monday, 29 April 2013

What is WPF?



Windows Presentation Foundation (WPF) is next generation presentation system to create applications with a rich UI. WPF application uses hardware acceleration of graphic cards so that it will improve your application performance. WPF introduced new markup language called XAML which allows you to keep separate UI and code behind. WPF has rich control set and all controls are highly customization using control templates and styles. The core of WPF is a resolution-independent and vector-based rendering engine that is built to take advantage of modern graphics hardware. WPF also supports 2D and 3D Graphics, flow documents and multimedia. You can create Standalone Application and Browser Hosted Applications (XBAP) using WPF.




Vector Graphics

Unlike JPEGs, GIFs, and BMP images, vector graphics are not made up of a grid of pixels. Instead, vector graphics are comprised of paths, which are defined by a start and end point, along with other points, curves, and angles along the way. A path can be a line, a square, a triangle, or a curvy shape. These paths can be used to create simple drawings or complex diagrams. Paths are even used to define the characters of specific typefaces.

Because vector-based images are not made up of a specific number of dots, they can be scaled to a larger size and not lose any image quality. If you blow up a raster graphic, it will look blocky, or "pixelated." When you blow up a vector graphic, the edges of each object within the graphic stay smooth and clean. This makes vector graphics ideal for logos, which can be small enough to appear on a business card, but can also be scaled to fill a billboard. Common types of vector graphics include Adobe Illustrator, Macromedia Freehand, and EPS files. Many Flash animations also use vector graphics, since they scale better and typically take up less space than bitmap images.

Vector graphics article taken from below link
http://www.techterms.com/definition/vectorgraphic


What is the need of WPF when we had GDI, GDI+ and DirectX?

User32:- This provides the windows look and feel for buttons and textboxes and other UI elements. User32 lacked drawing capabilities.

GDI (Graphics device interface):- Microsoft introduced GDI to provide drawing capabilities. GDI not only provided drawing capabilities but also provided a high level of abstraction on the hardware display. In other words it encapsulates all complexities of hardware in the GDI API.

GDI+:- GDI+ was introduced which basically extends GDI and provides extra functionalities like jpg and PNG support, gradient shading and anti-aliasing. The biggest issue with GDI API was it did not use hardware acceleration and did not have animation and 3D support.

Note: - Hardware acceleration is a process in which we use hardware to perform some functions rather than performing those functions using the software which is running in the CPU.

DirectX: - One of the biggest issues with GDI and its extension GDI+ was hardware acceleration and animation support. This came as a biggest disadvantage for game developers. To answer and server game developers Microsoft developed DirectX. DirectX exploited hardware acceleration, had support for 3D, full color graphics, media streaming facility and lot more. This API no matured when it comes to gaming industry.

WPF: - Microsoft almost had 3 to 4 API's for display technologies, so why a need for one more display technology. DirectX had this excellent feature of using hardware acceleration. Microsoft wanted to develop UI elements like textboxes, button, grids etc using the DirectX technology by which they can exploit the hardware acceleration feature. As WPF stands on the top of directX you can not only build simple UI elements but also go one step further and develop special UI elements like Grid, FlowDocument, and Ellipse. Oh yes you can go one more step further and build animations.WPF is not meant for game development. DirectX still will lead in that scenario. In case you are looking for light animation (not game programming) WPF will be a choice. You can also express WPF using XML which is also called as XAML.In other words WPF is a wrapper which is built over DirectX.


Labels

Custome Service Class to connect wcf service

  using  System; using  System.ServiceModel; namespace Custom.Service.Client {      // Borrowed from: http://old.iserviceoriented.com/blog/p...