Direct2D Max2D backend

BlitzMax Forums/BlitzMax Programming/Direct2D Max2D backend

grable(Posted February) [#1]
Been playing with Direct2D and DirectWrite these last few days and made a prelim Max2D backend.

Its not perfect though, Direct2D really isnt for 2D games and it has some bad limitations.
The apis im using should work on Windows7+, to use any of the newer features one need Visual Studio (for headers) and probably Windows 10 as well, so thats no fun.
Anyway, the backend itself is pretty small and renders correctly for the most part, and its pretty fast except for when running into those bad limitations.
Sadly, DrawText can be slow when colored since its using images but there is equivalent functions D2DDrawText and others that uses DirectWrite instead (see readme.txt)

Im just throwing this out here for those wanting a comparison or want to play with Direct2D and DirectWrite themselves. Have Fun :D

limitations:
no fullscreen, just havent bothered since it requires way more code.
colored images/text are slow because im using the lowest api version with no fast path for it.
all images are converted to BGRA8888 format, also has to pre-multiply alpha on image load needing an extra copy.

working:
SOLIDBLEND - partial, does not ignore image alpha
ALPHABLEND
DrawPixmap
DrawImage - slow if color<>white
DrawImageRect - not correct if color<>white
DrawSubImageRect - not correct if color<>white
DrawText - slow if color<>white
DrawRect
DrawOval
DrawLine - has artifacts when rotated, looks like a bug in d2d
SetScale
SetRoation
SetColor
SetHandle
SetOrigin
SetTransform
SetViewport
SetClsColor
Plot
Flip
Cls

d2d.mod.7z