jingwood / d2dlib

A .NET library for hardware-accelerated, high performance, immediate mode rendering via Direct2D.
MIT License
234 stars 40 forks source link

Cached TextBrush and FontFormat for Measure & Draw Text #108

Open Softwaretom007 opened 1 year ago

Softwaretom007 commented 1 year ago

Add D2DSolidColorTextBrush object and interface + extend MeasureText with D2DFontFormat fontFormat and D2DTextLayout textLayout + update Sample/MeasureAndDrawString + update FPS meter algorithm

MeasureAndDrawString yield 2x performance gain using cached SolidColorTextBrush and FontFormat.

jingwood commented 1 year ago

@Softwaretom007 Thank you very much!

Softwaretom007 commented 1 year ago

Added more functionality (string layout, text antialiasing setup, optimized draw & fill rectangle and drawing unconnected lines - from array of points).