dotnet / iot

This repo includes .NET Core implementations for various IoT boards, chips, displays and PCBs.
MIT License
2.18k stars 586 forks source link

Consider GDI+ for Ssd13xx #987

Closed A-J-Bauer closed 4 years ago

A-J-Bauer commented 4 years ago

Consider the usage of GDI+ functions for the Ssd13xx displays. Please have a look at OledI2c128x64SH1106

krwq commented 4 years ago

System.Drawing is using GDI+ under the covers, perhaps we can plug it in there if it's not yet there

joperezr commented 4 years ago

My idea was that because we were already using System.Drawing we were already using GDI+ as @krwq mentions. Is there something specific in mind you had where we could take different advantage of GDI+?

A-J-Bauer commented 4 years ago

I was thinking of an approach like the one used in WinfForms where OnPaint is provided which exposes a System.Drawing.Graphics object. OnPaint that can be triggered with Refresh().

Exposing a System.Drawing.Bitmap and an Update method/function (without events) would suffice though.

All drawing, shapes, lines images, text, scrolling etc. could then be done by using the graphics object/bitmap.

Something like this: working sample code for a sh1106 display (Update function at line 162)

Frankenslag commented 4 years ago

Just FYI the SSD1351 already supports the use of System.Drawing.Bitmap if that is any help.

A-J-Bauer commented 4 years ago

Ok didn't know that. I probably didn't look at the existing code close enough then. Thanks.