Skip to content
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

Terminology and luma.core.virtual.viewport #116

Open
Stefal opened this issue Dec 18, 2017 · 3 comments
Open

Terminology and luma.core.virtual.viewport #116

Stefal opened this issue Dec 18, 2017 · 3 comments

Comments

@Stefal
Copy link

Stefal commented Dec 18, 2017

Hi !
As a beginner, I'm trying to understand luma.core, and I'm learning the various concepts and terminology used for GUI.
One thing suprised me: If I read the viewport's page on Wikipedia, it's not the same concept as I understand it in caroussel.py or crawl.py.
From wikipedia:

the viewport is the visible portion of a 2D area which is larger than the visualization device

But in caroussel.py, the viewport is larger than the visualization device.

Am I wrong ?

@rm-hull
Copy link
Owner

rm-hull commented Dec 18, 2017

Viewport as defined in wikipedia is correct, of course. In luma.core, if you treat viewport as a class then, in the conventional sense, yes i think it is mixing the terminology up.

If you take a snippet as follows:

    virtual = viewport(device, width=device.width, height=768)

    for _ in range(2):
        with canvas(virtual) as draw:
            draw.text((0, 0), "A long time ago", fill="white")
            draw.text((0, 12), "in a galaxy far", fill="white")
            draw.text((0, 24), "far away....", fill="white")

I read this as "create a virtual device with a viewport onto the device, sized as ...".

Strictly speaking virtual is an instance of the viewport class, so I absolutely see where you're coming from, but it had never really occurred to me to read the code with that inflection before.

@Stefal
Copy link
Author

Stefal commented Dec 18, 2017

Ok

If I'm the only one understanding viewport this way, it's not a problem.

@rm-hull
Copy link
Owner

rm-hull commented Dec 18, 2017

No no, it's good that you're picking stuff up like this. If we can make the documentation and the code clearer as a result, then it's better for everyone who comes to subsequently use it. Have a think how it could be changed to be consistent with the wikipedia definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants