How are GUI's really made?

后端 未结 2 2011
轻奢々
轻奢々 2020-12-18 06:13

My question is
Gui libraries like Qt and lets say for Windows operating systems how do they create all those graphical user interfaces(windows etc).

Does each

2条回答
  •  失恋的感觉
    2020-12-18 06:37

    Stackoverflow answers are not supposed to use links, comments can but not answers.

    Each operating system and gui library is different, but, yes in some way, shape, or form they do actually draw every one of the pixels. It is often quite organized and many peformance solutions are used, optimized routines that can update a rectangle or some chunk of a screen, sometimes hardware gets involved (these days a lot of the time the hardware or basically gpus get involved the cpu asks the gpu to draw something then the gpus are busy placing all the pixels).

    You would likely for example want to create some sort of font rendering function that is given the font, the string to display, the font size, and perhaps a clipping window to not go outside, or perhaps a function that with the font, size and string returns the number of pixels then you can adjust the string to fit and wrap (look around this web page for example, drag the window wider and narrower and watch what web text does).

    Definitely some sort of image drawing routines with the ability to stretch or fit the drawing to the rectangle defined.

    The fun stuff, games, etc has improved so rapidly over time that it is hard to go back to a simple line draw and area fill routine, etc. But also along with the technology the games brought simple things like web pages benefit...Again look around.

    There are many open source programs and libraries you should just wander around the source code and see what you see.

提交回复
热议问题