Since #327, we have several marker interfaces in our code, such as:
IBrush
IFontTypeface
They work in a similar way: an implementation (say, WPF) creates them from a platform-specific wrappers (say, WpfBrush that wraps a WPF Brush instance), and then an implementation-issued renderer casts them back to these types to unpack and use.
This involves a lot of unsafe casting, and it's possible to imagine this all getting messed up in a multiplatform application.
We could investigate using more generics instead. For example, it could be possible to parametrize the IElementRenderer with <TBrush, TFontTypeface>.
I'm not sure that storing and passing around a lot of generic parameters is such a good idea. But still, I'd like to investigate this approach.
Since #327, we have several marker interfaces in our code, such as:
IBrush
IFontTypeface
They work in a similar way: an implementation (say, WPF) creates them from a platform-specific wrappers (say,
WpfBrush
that wraps a WPFBrush
instance), and then an implementation-issued renderer casts them back to these types to unpack and use.This involves a lot of unsafe casting, and it's possible to imagine this all getting messed up in a multiplatform application.
We could investigate using more generics instead. For example, it could be possible to parametrize the
IElementRenderer
with<TBrush, TFontTypeface>
.I'm not sure that storing and passing around a lot of generic parameters is such a good idea. But still, I'd like to investigate this approach.