My understanding of SetWindow, setviewport and translate

Source: Internet
Author: User

Currently in the study of Qt, to the coordinate system this piece of time, a little messy, after looking at a few related blog, sure enough ... More messy, until you read the Qt Help Handbook (shouldn't you be the first to see this?).

1. Translate (), this is quite a good understanding, this function requires a vector of information, the bearer of this information may be:

1.1 One point: the const qpoint &offset (floating-point const qpointf &offset) Vector is pointed to by the origin point;

1.2 Two real numbers, that is, two sub-vectors, the resultant vector is the required information;

When this information is obtained, the origin is shifted according to this vector, which is translate ().

2. SetWindow (), create a map, it needs to be a rectangle of information, because it will map the current window with this rectangle, you can directly give it a rectangle const qrect &rectangle, or give it a point in the upper left corner (int x, in T y) and its width and height (int width, int heigh). such as Painter.setwindow (rectangle) means to use rectangle and painter the current window to map. Of course the meaning of this layer is limited to only this one function, because if there are more than one function, then it means setting up Microsoft System (set Windows) ... Well, I know the joke is cold.

3. SetViewport (), also establishes a mapping with the current window, as needed, but in contrast to SetWindow, it is a mapping of the current window to the given rectangle.

My understanding of SetWindow, setviewport and translate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.