Sei sulla pagina 1di 2

Animations[edit]

WPF supports time-based animations, in contrast to the frame-based approach. Thi


s decouples the speed of the animation from how the system is performing.
WPF supports low level animation via timers and higher level abstractions of ani
mations via the Animation classes. Any WPF element property can be animated as l
ong as it is registered as a Dependency Property.
Animation classes are based on the .NET type of property to be animated. For ins
tance, changing the color of an element is done with the ColorAnimation class an
d animating the Width of an element (which is typed as a Double) is done with th
e DoubleAnimation class.
Animations can be grouped into Storyboards. Storyboards are the primary way to s
tart, stop, pause and otherwise manipulate the animations.
Animations can be triggered by external events, including user action.[9]
Scene redraws are time triggered.[9]
Presentation timers are initialized and managed by WPF.[9]
Animation effects can be defined on a per-object basis, which can be accessed di
rectly from XAML markup.[9]
Imaging[edit]
WPF can natively access Windows Imaging Component (WIC) code and APIs allowing d
evelopers to write image codecs for their specific image file formats.
Effects[edit]
WPF 3.0 provides for Bitmap effects (BitmapEffect class), which are raster effec
ts applied to a Visual. These raster effects are written in unmanaged code and f
orce rendering of the Visual to be performed on the CPU and not hardware acceler
ated by the GPU. BitmapEffects were deprecated in .NET 3.5 SP 1.
.NET Framework 3.5 SP1 adds the Effect class, which is a Pixel-Shader 2.0 effect
that can be applied to a visual, which allows all rendering to remain on the GP
U.
The Effect class is extensible, allowing applications to specify their own shade
r effects.
The Effect class, in .NET 3.5 SP1 and 4.0, ships with two built-in effects, Blur
Effect and DropShadowEffect. There are no direct replacements for OuterGlowBitma
pEffect, EmbossBitmapEffect and BevelBitmapEffect, previously provided by the de
precated BitmapEffect class. However there are other ways of achieving the same
results with the Effect class. For example, developers can get an outer glow eff
ect by using the DropShadowEffect with its ShadowDepth set to 0.
Although the BitmapEffect class was marked as deprecated in .Net Framework 3.5 S
P1, its use was still allowed and these effects would still render correctly. In
.Net Framework 4.0 the BitmapEffect class was effectively deprecated - code ref
erencing BitmapEffect still builds without errors, but no effect gets actually r
endered.
Documents[edit]
WPF natively supports paginated documents. It provides the DocumentViewer class,
which is for reading fixed layout documents. The FlowDocumentReader class offer
s different view modes such as per-page or scrollable and also reflows text if t
he viewing area is resized.
Natively supports XML Paper Specification documents.
Supports reading and writing paginated documents using Open Packaging Convention
.
Text[edit]
WPF includes a number of text rendering features that were not available in GDI.
This is the first Windows programming interface to expose OpenType features to
software developers, supporting OpenType, TrueType, and OpenType CFF (Compact Fo
nt Format) fonts.

Support for OpenType typographic features includes: Ligatures


Old-style numerals (for example, parts of the glyph hang below the text baseline
)
Swash variants
Fractions
Superscript and subscript
Small caps
Line-level justification
Ruby characters
Glyph substitution
Multiple baselines
Contextual and Stylistic Alternates
Kerning
WPF handles texts in Unicode, and handles texts independent of global settings,
such as system locale. In addition, fallback mechanisms are provided to allow wr
iting direction (horizontal versus vertical) handled independent of font name; b
uilding international fonts from composite fonts, using a group of single-langua
ge fonts; composite fonts embedding. Font linking and font fallback information
is stored in a portable XML file, using composite font technology.[10] The XML f
ile has extension .CompositeFont.
The WPF text engine also supports built-in spell checking. It also supports such
features as automatic line spacing, enhanced international text, language-guide
d line breaking, hyphenation, and justification, bitmap effects, transforms, and
text effects such as shadows, blur, glow, rotation etc. Animated text is also s
upported; this refers to animated glyphs, as well as real-time changes in positi
on, size, color, and opacity of the text.
WPF text rendering takes advantage of advances in ClearType technology, such as
sub-pixel positioning, natural advance widths, Y-direction anti-aliasing, hardwa
re-accelerated text rendering, as well as aggressive caching of pre-rendered tex
t in video memory.[11] ClearType cannot be turned off in older WPF 3.x applicati
ons.[12] Unlike the ClearType in GDI or GDI+, WPF ClearType does not snap glyphs
to pixels horizontally, leading to a loss of contrast disliked by some users.[1
3] The text rendering engine has been rewritten in WPF 4.0, correcting this issu
e.[14]
The extent to which glyphs are cached is dependent on the video card. DirectX 10
cards are able to cache the font glyphs in video memory, then perform the compo
sition (assembling of character glyphs in the correct order, with the correct sp
acing), alpha-blending (application of anti-aliasing), and RGB blending (ClearTy
pe's sub-pixel color calculations), entirely in hardware. This means that only t
he original glyphs need to be stored in video memory once per font (Microsoft es
timates that this would require 2 MB of video memory per font), and other operat
ions such as the display of anti-aliased text on top of other graphics including v
ideo can also be done with no computation effort on the part of the CPU. DirectX 9
cards are only able to cache the alpha-blended glyphs in memory, thus requiring
the CPU to handle glyph composition and alpha-blending before passing this to t
he video card. Caching these partially rendered glyphs requires significantly mo
re memory (Microsoft estimates 5 MB per process). Cards that don't support Direc
tX 9 have no hardware-accelerated text rendering capabilities.

Potrebbero piacerti anche