I am a WPF developer and few days ago I came to know about Flex. Now,I got Following list of questions.
Both of them to be used for creating rich GUI application. So, are
they competitors to each other.**
If both are to be used for same purpose, then which one should be preferred.**
Moreover, I was also wondering that WPF is based on DirectX for rendering as
it does vector-based rendering, but at the same time I am also keen to know
that How Flex renders, Flex is based on what??**
Does Flex can also use GPU based rendering... Is there anyway to use Shader in Flex.**
I am very much confused about Flex, because I am very new to Flex........So, Please clear my doubts, as I might be having totally incorrect perception about Flex
1 Both of them to be used for creating rich GUI application. So, are
they competitors to each other.
Only to a certain extent. As far as I know WPF can only be used to create windows-based applications. Flex' initial primary target was the web and most Flex applications were so-called "Rich Internet Applications".
Later Adobe created AIR, which is a virtual machine that lets you run the same applications on the OS itself, often by reusing 99% of the code that was written for the web apps. Some API's were added to access native functionalities of the OS (client-side database, file I/O, running/accessing native processes, etc.). AIR applications can be deployed on Windows, Mac and Linux alike, though development of the AIR vm for Linux has been stopped.
The last step in this story is that AIR applications can now also be packaged as apps that can be deployed on mobile OS's. Again because it t
runs in a VM, this offers a "write-once, deploy-everywhere" solution. Both Android and iOS are supported (not sure about BlackBerry but who cares). On the Flex side of things, some mobile-specific UI components were added to the framework.
2 If both are to be used for same purpose, then which one should be preferred.
The choice is entirely up to you and depends on factors like knowledge about the framework, specific requirements that you might have, etc., etc.
3 Moreover, I was also wondering that WPF is based on DirectX for rendering as it does vector-based rendering, but at the same time I am also keen to know that How Flex renders, Flex is based on what??
Flex is a framework that compiles to ActionScript which in turn compiles to abc bytecode. That bytecode will be interpreted and run by the Flash VM.
The roots of Flash lie in vector-based rendering (it was the solution to render vector graphics on the web for the two previous decades). All stock graphics for the Flex UI components are thus vector-based.
4 Does Flex can also use GPU based rendering... Is there anyway to use Shader in Flex.
GPU acceleration has been added to the Flash/ActionScript API somewhere in the last 5 years, but because the Flex framework was created long before that, and porting it to the new GPU-accelerated system would be too complicated, Flex does not benefit from that evolution.
But you can use a Flex UI side by side with GPU-accelerated components. You could for instance create a normal Flex application with just one component that renders a 3D model that kind of lives outside the Flex display list.
Usually only games written for the Flash VM do leverage the GPU acceleration. Most of them use the Starling framework. For mobile UI's you also have the option of the FeathersUI framework, which provides a GPU-accelerated mobile component set on top of Starling.
Note that #Vinodharajan's answer is not entirely correct in that the Flex framework is no longer property of Adobe. Adobe donated it to the Apache foundation about two years ago and it has been evolving there ever since.
Flex is a Adobe base front end product. This internally uses Flash to render its content on the browser or Adobe Air for standalone application. This can use hardware rendering. You can just think this as a alternate from Adobe for WPF.
Related
I have requirement that we need to develop a rich UI application(similar to WPF or silverlight). The target device is having embedded OS Win CE 7. how can i achieve this, after so much R&D i got to know that
1. we have to user Silverlight for GUI and C++ as backend coding
2. we can create the MFC application using some third party SDK we will not be able to get rich UI
Also, i read that we can add components in WIN CE 7 for compact framework.
Is my above understanding correct, can someone throw some light on this?
Just to add my 2 cents to Chris and Paolo's replies, if you are not building the OS image for the target device or, at least, can't control the features it supports, your choice may be limited by the set of components that were included into the OS image provided with the device.
Windows CE is highly componentized and both the badly named "Silverlight for Windows Embedded" (XAML) and .NET Compact Framewor runtimes can be left out of the OS image to save storage space and memory.
The XAML runtime can leverage graphic acceleration (if the HW you are using provides it and the BSP includes drivers to use it, of course) and this may lead to a more responsive system, compared to a full .NET implementation.
I would also try to stay away from MFC for new implementation. The only good reason to use MFC is that you already have an UI framework that fit your needs and is based on it.
Currently on CE you can decide between an easy to design and rich UI with complex to develop and debug code-behind (XAML) or an easy to develop .NET application with an ugly windows 95-like UI that require lot of work to be "beautified". XAML in the hand may merge the best of both worlds (requiring additional cost and two heavvy runtimes on your target, but this may not be an issue if you have a powerful x86 machine or a graphic accelerated ARM Cortex).
To develop application on WEC 7 you need an SDK built from OEM that give you the target board.
If you want to develop on a Virtual PC image you need Platform Builder to use CEPC BSP and create an O.S. image and the corresponding SDK.
After that, you can develop using Silverlight only with C++ but you can use .Net Compact Framework and managed code for Windows Forms development.
Paolo.
It really, really depends on both your definition of "rich" and the graphics capability of the hardware you're targeting.
CE 7 supports the .NET Compact Framework. Many people will say that you can't do "rich" UI in the CF, but that's not really true. You can't do it with the standard controls, but if you do your own custom control drawing, you can do pretty well. Yet, it's a lot of work, but it can be done. The limitations here are in alphablending (not fun to get working) and animation (also not fun), but with dedication you can work around many issues.
CE 7.0 also supports "Silverlight for Windows Embedded" (a.k.a. SWE). First thing to know there is that it's really not Silverlight. It's a XAML rendering engine, but any other Silverlight assets you might have won't work with it.
SWE supports only C++, though since it is COM based, it can be wrapped in CF classes and then used from managed code. I've seen a couple of companies do this, and one even offers it as a product.
MFC is available, but since MFC was crap even 10 years ago, I definitely wouldn't use it today. If you want to use C++ but not SWE, there are better options than MFC. STL and WTL come to mind for windowing apps.
I know WPF encapsulates DirectX, but I learned that I can used it to render DirectX or User32
Is DirectX the default renderer when I drag controls to the Window?
If not, how do I force it to render using User32?
Do I need to render the whole Window using User32 if so, or just my control?
Life before WPF:
It will be inevitable not to look back and see that standard window applications reply on two well worn parts of the Windows OS to create its user interface.
a) User32: provides familiar windows look and feel for element.
b) GDI/GDI +: provides drawing support for rendering shapes, text, images etc,
Does WPF render using DirectX or User32?
WPF changes all this and is fundamentally different from window forms. WPF’s underlying technology isn’t GDI/GDI+, instead it uses DirectX. So WPF uses DirectX no matter what type of user interface we create. So it’s like whether we are creating complex 3D graphics or just drawing a button, all the drawing work have to pass through DirectX pipeline. Since WPF relies on DirectX, now we can take advantage of hardware acceleration as well, which means this will hand off much work as possible to the GPU(graphics processing unit) which is dedicated processor on video card, and our CPU(central processing unit) could do some rest.
Does WPF rely on User32?
WPF still relies on User32 for certain services, such as handling and routing input and sorting out which application owns which portion of screen real estate. However, all the drawing is funneled through DirectX.
This is the most significant change in WPF. WPF is not a wrapper for GDI/GDI+. Instead, it’s a replacement—a separate layer that works through DirectX.
Can WPF run without DirectX?
WPF has a dependency on the DirectX runtime. However, both DirectX and
WPF have their own software fallback modes so that, in the absence of
suitable graphics hardware and/or drivers, software rendering will be
used instead. Some graphically intensive features will also be
unavailable when software rendering. WPF allows you to check the
rendering tier that it's running under and tailor the UI to suit
the current environment.
Also I suggest you have a quick read of HAL vs HEL to understand that different Graphics cards determine what can be done via DirectX Hardware or software.
Figure 1. The architecture of DirectX and its relationship to Win32.
In Figure 1, you may notice that there are two layers under DirectX called the HEL (Hardware Emulation Layer) and the HAL (Hardware Abstraction Layer). Here's the deal: DirectX is a very forward-looking design, so it assumes that advanced features are implemented by the hardware. However, if the hardware doesn't support some feature, what happens? This is the basis of the dual-mode HAL and HEL design.
The HAL, or Hardware Abstraction Layer, is the "to the metal" layer. It talks directly to the hardware. This layer is usually the device driver from the vendor, and you communicate to it directly through generic DirectX calls. The bottom line is that HAL is used when the feature you're requesting is supported directly by the hardware and thus is accelerated. For example, when you request a bitmap to be drawn, the hardware blitter does the work rather than a software loop.
The HEL, or Hardware Emulation Layer, is used when the hardware doesn't support the feature that you're requesting. Let's say that you ask the video card to rotate a bitmap. If the hardware doesn't support rotation, the HEL kicks in and software algorithms take over. Obviously, this is slower, but the point is that it does not break your program. It will still work—just slower. In addition, the switching between the HAL and HEL is transparent to you. If you ask DirectX to do something and the HAL does it directly, the hardware will do it. Otherwise, a software emulation will be called to get the job done with HEL.
Refs:
http://vishalnayan.wordpress.com/2011/05/20/windows-presentation-foundation-what-why-and-when/
http://www.yaldex.com/games-programming/0672323699_ch05lev1sec1.html
You can force the Application to use software rendering by setting the ProcessRenderMode to SoftwareOnly.
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
However this is done on the process level and I am not sure if it can be done per Element
I will be developing an interactive application, involving multitouch, several layers of large bitmaps, and video playback. The screen resolution will be fairly large (1920x1280).
For several years, I have developed interactives in Flash, iOS, and OS X Cocoa. However, this project must run on a Windows box, so iOS & Cocoa are impossible. Also, I'm concerned about performance in Flash, since there may be 3 videos playing simultaneously, and large bitmaps moving around.
I know little about the technologies available on Windows. I'm investigating Silverlight, C#, Unity, Processing, and Java. If anyone can offer advice, it will be greatly appreciated.
You seem to be investigating several technologies on different levels:
C# and Java are programming languages. What you prefer may depend on your existing skills, but C# is from Microsoft so chances are that you will experience less friction using this language if you develop for Windows. Picking the right programming language is an important decision.
Silverlight is a "technology stack" from Microsoft. It enables you to develop XAML based applications that run in the browser. Compared to the native WPF stack it is less powerful. Choosing Silverlight, WPF or another technology stack like Processing.js is an important decision.
Unity is a dependency injection container from Microsoft. You can use this or any other suitable container if you like. Or none at all. You don't really have to think about this until you have made some of the more important decisions about your project.
Personally, I don't have experience with the type of application you describe, but I would go with C# and WPF. WPF has some support for multitouch on Windows, and only if it isn't adequate for your requirements you need to to go native and develop in say C++ which tends to require more work.
Multitouch in Windows 8 has been redesigned but unless you want to develop for a yet to be release operating system this is not an option.
Use Visual C++ if you like to create a LAN based Application, C++ is known for it's power and you could have many resources that could help you in developing this application. If you're going to create this application for web Use ASP.net(C#) C# is known for its flexibility and class libraries dedicated for web and client appilcation i also advice the use of WPF and Silverlight applications.
I suggest you have a look at Windows 8 and Metro Apps. Here is a link to start with this: The Microsoft BUILD conference, Windows 8, and the new UX Challenge. C# (.NET languages in fact), HTML5 and XAML are clearly the direction. Native C++ is back in town with WinRT. Silverlight is now in the gray area :-)
Even if you don't use Windows 8, it will give you a good overview of multitouch future in the Windows space.
I want to program for DirectX in C# and i have DirectX SDK,
what kind of project should be choose ? Windows form or ....
You should ask yourself first: What's the purpose of my project?
If you intend to building applications with beautiful 2D-3D visuals, then you just need to learn WPF.
On the other hand, if you wanna build games that require a lot of resources, XNA is the way to go.
Building applications on XNA is a lot of pain, since XNA is built for gaming.
The same can be said about building games with WPF.
In both cases, you don't need to communicate natively with DirectX (Which could be done via C++). Unless you're building a low level rendering engine, or a (very) high budget game.
You should use XNA, that is the replacement for Managed DirectX C#
Microsoft XNA ('XNA's Not Acronymed) is a set of tools with a managed runtime environment provided by Microsoft that facilitates computer game development and management. XNA attempts to free game developers from writing "repetitive boilerplate code" and to bring different aspects of game production into a single system.
From Wikipedia XNA Article.
Unless you want to just render windows but WPF might be the best options. See this blog post.
XNA:
XNA is a game oriented framework that allow you to target multiple hardware easily (Windows, the Xbox 360, Zune and now Windows Phone 7 with version 4) using .NET languages like C#.
Note that there's not a 1-1 relation between XNA and the DirectX SDK, for instance, it doesn't expose D3D10 or D3D11 or some interfaces that you can find in D3DX.
.NET Wrappers:
If your are looking for something similar than the native DirectX API, you have 3 options:
Windows® API Code Pack for Microsoft® .NET Framework:
wraps a bunch of Windows native libraries such as DirectX so they can be used from managed code. Note it doesn't expose API's prior to D3D10 such as D3D9.
SlimDX: Same thing but only for DirectX and exposes Direct3D from version 9 to 11 (SlimDX is an aside project that is not related to Microsoft).
C++/CLI and DIY the wrapper: Unless you have special needs, I wouldn't recommend it.
The final choice depends on your needs. If it's just for learning purpose of the DirectX API but in C#, I would say pick the Windows API Code Pack or SlimDX.
I have to make an application that runs on both Windows (XP/Vista) and Windows Mobile. The graphics interface must be scalable (for different resolutions) and the controls must be custom (like the ones usually found on music apps).
SVG was my instant choice but the lack of support on Windows Mobile pretty much kill my time budget. I've tried to evaluate WMF and it seems the right answer but i don't really like it.
I was thinking about WPF/XAML but i don't know what are the differences between Windows and Windows Mobile.
The project must be in C# or C++ and it's a commercial project (thus no GPLed libraries).
What would be the best choice? What ma I overlooking?
WinForms has limited support for scaling:
http://sellsbrothers.com/writing/winformsAutoScaling.htm
You may also want to look at "anchor" and "docking":
https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6165908.html
Combined together you should be able to create a UI that works for both desktop and mobile.
You can do scaling UI in .NET compact framework, like Erwin said with docking and achoring. In the windows mobile applications i have written i do normaly have to write some custom code that deals with things like Font scaling ( Touch founds might need bigger Font then system default if the text should be clickable).
I dont think your going to get it to scale picture correctly without code, i found some question releated that on this site. In my experience i write 99.9% of my code so it runs fine on both windows and windows mobile, but i do make a different UI for windows mobile.
If normaly write code in .NET 2.0 / .NET 2.0 Compact Framework, but if your you dont care about having to install .NET 3 then it should be better ( .NET 2 is wider spread out then .NET 3 )
Another option is the Qt library which is written in C++. It is LGPL which means that it can be used in commercial products without having to release your sources (except for changes to the library itself). If for some reason that isn't good enough they also sell commercial licenses.
It runs on Windows and Windows Mobile. As a bonus if you do a reasonable job of programming (and assuming everything else you're doing coding wise supports it) your application can also be run on Mac OSX, Linux and S60.
It has support for Scalable Vector Graphics, a Canvas with full widget support and a bunch of other nifty features as well! I'd suggest checking out the documentation and seeing if it has everything you need.
Silverlight?