Conversation
Owner
Author
|
Obsolete by #374. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was originally triggered by #233 for adding support to PIN2DMD-XL displays running at 192x64. A few major refactorings took place in order to achieve this.
Firstly, PIN2DMD-XL has a somewhat special API: It takes in RGB24 and 4-bit frames at 128x32, and the firmware centers the image over the 192x64 real estate. In fact, there isn't an API (yet?) to send RGB24 at 192x64. Then there's of course a 192x64 mode that takes in 4-bit frames.
So there are basically two major things that this PR adds:
IMultiSizeDestination!).SetDimensions()or the destination's fixed sizeThis had a few implications:
Instead of sending byte arrays, we're now sending
DmdFrames everywhere, which also contain theDimensions.We never pass
widthandheightanywhere anymore, because we now haveDimensions.Frames get cloned when entering the render graph. That means they can be manipulated without side effects to other destinations treating the same frame (the frame buffer doesn't get cloned, so it must be replaced, not manipulated).
Since we now have frame objects, they are intelligent, i.e. they contain conversion and transformation logic previously awkwardly sitting in the render graph.
The frame objects are:
DmdFramefor byte array frames (gray2, gray4, rgb24)ColoredFramefor gray2 and gray4 including a paletteBmpFramefor bitmap framesAlphaNumericFramefor non-DMD framesThese are now created at the source, and are persisted (or converted into another type) until they reach the destination.
So how this this work?
When a destination offers multiple resolutions, the render graph figures out itself which resolution to send to the frame (see
BaseFrame.GetTargetDimensions()). It boils down to:So the
PinDmd2XLdestination already gets the right resolution (the gray interfaces anyway, RGB24 must be resized since not supported at full res). All it has to do now is look at it and render it accordingly.This PR closes #233.