-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 Design discussion #58
Comments
This is super helpful, thanks @FaBjE!!! Apologies in advance if I'm incorrectly reading this class diagram, I tend to avoid object-oriented programming except for very simple cases, so these diagrams are unfamiliar to me, but they look great! Could you help me to understand the interface between the rendering pipeline and the printer, which currently consists of just a link between My mental model of a printer is that it's something capable of printing certain bitmaps. If the For the other direction (printer→renderer), it seems to me like the printer (with its label type) needs to tell the renderer, "these are the types of bitmaps I'm capable of printing". My expectation here is very similar to the In terms of units, it seems to me like On a related note, there are many places in the code that use |
RenderContext is indeed a bitmap, with some extra data. Like the px_per_mm. I like to wrap these things in a container object so that they can be passed around easily. I probably missed something that we will need in the future. With this approach it is just a matter of adding it to the RenderContext object and it is available in all the places. I tried to keep the rendering stuff as separated from the printer as possible. RenderContext are the things that do need to be "passed around".
It's a bit of the other way around. You select/indicate a label type to the printer. and you ask the printer for a RenderContext. LabelConfig sizes are intended to be in mm. Float may be a better datatype indeed. The printer object will calculate the available pixels with the label sizes and its DPI, subtract it's print margins, and give this as a "Rendercontext". For the margins we now use a simple lookup table as the amount of supported labels (tapes in this case) is limited. Technically we can allow the user to set/add custom label sizes (in mm) from for example the GUI as well. In case they have some custom label type.
All core logic is in px. Indeed the GUI touching parts can use mm. I think the part we differ in view is the LabelConfig. For the reason stated above.
I completely agree with you. (px == int). I see no reason why it can´t be like that. I think/assume/guess the reason that where pixels are calculated from say a size in mm it can make sense to use a float type as some programming languages (I have no clue how this relates to python!!) can optimize the following: |
Split-off from the discussion in the PR I've put my view for a maintainable codebase that can support many different printers and label types into a plant uml class diagram.
Image: Class Diagram
Edit link Don´t forget to share the link if you made changes. It won´t be saved on the server.
Global program flow:
Notes:
The text was updated successfully, but these errors were encountered: