klayout
klayout copied to clipboard
What is the drawing mechanism and method of klayout?
What is the drawing mechanism and method of klayout? I found that the software's drawing efficiency is very high, drawing tens of millions of lines is also very smooth, no delay. Is it drawn by the native qt (QGraphicsScene+QGraphicsView)? Are you using any third-party libraries or other optimization methods?
No, KLayout uses a custom renderer which is based on monochrome bitmaps that are combined into a RGB image separately. Drawing on a monochrome image is very fast as drawing small objects is a matter of setting a single bit.
In addition, KLayout has multiple levels of optimizations such as using the box tree and layer specific cell bounding box information for short-cutting the drawing process. It also uses a rendering cache for cells so that drawing the same cell multiple times is a matter of a bitmap copy.
No, KLayout uses a custom renderer which is based on monochrome bitmaps that are combined into a RGB image separately. Drawing on a monochrome image is very fast as drawing small objects is a matter of setting a single bit.
In addition, KLayout has multiple levels of optimizations such as using the box tree and layer specific cell bounding box information for short-cutting the drawing process. It also uses a rendering cache for cells so that drawing the same cell multiple times is a matter of a bitmap copy.
Wow, you are amazing! What are the source files related to drawing?
There was a similar question a couple of month ago. https://github.com/KLayout/klayout/issues/1424 Do a debug build, use valgrind’s callgrind and visualize the results with [kq]cachegrind. I found this to be a very efficient way to look at other peoples open source code.
how does monochrome bitmaps and antialiasing go together?
@olisnr You mean oversampling? This feature simply draws on a 2 or 3 times larger bitmap and the downsamples the resulting RGB image.
Matthias
that means You do very optimized 4 or 9 times larger bitmaps, merge it into RGB and then do a 2D lowpass over it? its a luck GPUs are already invented :)
Well, basically yes. But it is a simple downscaling (pixel averaging) on a single RGB image. No lowpass involved and it does not require a GPU. I plain CPU is good enough.
Matthias
it looks very nice and response fast with my layouts. KLayout is very nice.