[Microbit-Python] What to do about display and images?
Larry Hastings
larry at hastings.org
Wed Oct 7 07:32:13 CEST 2015
So, the ur-operation of all bitmap operations is the "bit blit", as
evinced by this Win32 API, unchanged from Win16:
BOOL BitBlt(
_In_ HDC hdcDest,
_In_int nXDest,
_In_int nYDest,
_In_int nWidth,
_In_int nHeight,
_In_ HDC hdcSrc,
_In_int nXSrc,
_In_int nYSrc,
_In_ DWORD dwRop
);
https://msdn.microsoft.com/en-us/library/windows/desktop/dd183370(v=vs.85).aspx
If you have BitBlt you can do anything. You can construct any other
operation you need.
An "HDC" is a Handle to a Device Context, which we can think of here as
a bitmap. So this function copies the bits from one bitmap to another.
It takes the X and Y of where to copy from on the source, the width and
height of the area we want copied, the X and Y of where we want to copy
/to/ on the destination, and the "raster operation" which is the
approach to take when copying. There are seventeen (!) possible raster
ops with BitBlt() but you only ever use a few.
In theory I'd be interested in things like "scale" and "brighten", but
in practice a 5x5 screen is so low-resolution I'll never scale anything,
and there are only about four brightness levels (including "off"), so
it's hard to get excited about those operations. I suppose you could
still add these operations but I would put them off until last.
I'd be happy to take a crack at designing the API /I'd/ want to use.
All I need to know for now is: does MicroPython support a) positional
parameters with defaults, b) name-only parameters with defaults?
//arry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/mailman/private/microbit/attachments/20151006/df2d9e69/attachment.html>
More information about the Microbit
mailing list