Faster 2 D graphics on Windows 8 120



















































- Slides: 51
Faster 2 D graphics on Windows 8
120 Frame Rate 100 95. 79 80 60 46 40 Windows 8 Windows 7 20 0 Text Rendering
70 60 Frame Rate 50 40 Windows 8 30 Windows 7 20 10 0 512 2048 Number of Primitives 8192
Your app will run faster on Windows 8
How to write the fastest Direct 2 D app
• • • Animate complex content fast Clip content to an arbitrary shape fast Draw text fast Render Direct 2 D effects fast Scale performance on multiple cores Draw mixed 2 D/3 D content fast
// create a bitmap size dpi. X dpi. Y // preserve pre-existing target Com. Ptr<ID 2 D 1 Image> nullptr 0
// render to the scene. Bitmap // render scene. Bitmap to old. Target
// create an opacity bitmap size dpi. X dpi. Y // preserve pre-existing target Com. Ptr<ID 2 D 1 Image> nullptr 0
// render to the opacity. Bitmap // call Fill. Opacity. Bitmap()
// enables rasterizing only the changed content DXGI_PRESENT_PARAMETERS
Use bitmaps for caching display output Use command list for caching print output.
• • • Animate complex content fast Clip content to an arbitrary shape fast Draw text fast Render Direct 2 D effects fast Scale performance on multiple cores Draw mixed 2 D/3 D content fast
// create the layer resource // render to the layer with the clipping geometry bounds. Rect geometric. Mask
// create opacity bitmap and render content // create opacity brush from the opacity bitmap // call Fill. Geometry() by passing in the clip geometry and the opacity brush to
• • • Animate complex content fast Clip content to an arbitrary shape fast Draw text fast Render Direct 2 D effects fast Scale performance on multiple cores Draw mixed 2 D/3 D content fast
Draw text fast
// Create text layout once text length max. Width max. Height // draw the text layout repeatedly origin
Gray. Scale text rendering mode • Set the rendering mode to grayscale explicitly • Set. Text. Anti. Alias. Mode(D 2 D 1_TEXT_ANTIALIAS_MODE_GRAYSCALE)
• • • Animate complex content fast Clip content to an arbitrary shape fast Draw text fast Render Direct 2 D effects fast Scale performance on multiple cores Draw mixed 2 D/3 D content fast
Render Direct 2 D effects fast
• • • Animate complex content fast Clip content to an arbitrary shape fast Draw text fast Render Direct 2 D effects fast Scale performance on multiple cores Draw mixed 2 D/3 D content fast
• • • Animate complex content fast Clip content to an arbitrary shape fast Draw text fast Render Direct 2 D effects fast Scale performance on multiple cores Draw mixed 2 D/3 D content fast
Mixing 2 D and 3 D content
• • • Animate complex content fast Clip content to an arbitrary shape fast Draw text fast Render Direct 2 D effects fast Scale performance on multiple cores Draw mixed 2 D/3 D content fast
• Channel 9 PDC’ 10 talk: Adopting D 2 D and Dwrite for hardware acceleration in Native Windows Applications • Channel 9 PDC=09 talk: Advanced graphics functionality using Direct. X
http: //forums. dev. windows. com http: //bldw. in/Session. Feedback



















































