Implement a non-Rule window in directfb

Source: Internet
Author: User
Haha, just a little bit of information about GTK in China, the coder needs to go on their own. According to the designer's design, non-Rule windows (more friendly interfaces) need to be implemented ). Method 1: directly map on the background... this method is not bad, it is easy to think of, very simple. Almost every form has its own background image, because they will not change according to the title size.
Second, memory is also a waste. For example, on a 800*600 LCD, we need 800*600 * (32/8)
It is about 2 MB of memory space, and every window requires 2 MB of additional memory... the overhead cannot be small. Method 2: assign a pixmap that matches the window size during configure-event, draw the image and draw the form on the draw when the window size is expose. The advantage is that the title or
Other changes dynamically change the background. The disadvantage is that memory is wasted in the same way as method 1. Method 3: this is also the same as the previous article. ArticleIn common, first assign the gdkpixmap of 1pix * 1pix as bg_pixmap and set the style.
Then, based on the design, we use Cairo to describe the outer surface path of the entire form (the part to be removed) and save it as path.
During the expose operation, paste the path and clear the content of the part. This way, the form becomes non-rule and the removed part is completely transparent! # Draw the path cairo_new_path (CR); // draw the path //..... opacity (CR); Path = cairo_copy_path (CR); # make the place outside the form transparent cairo_save (CR) cairo_append_path (Cr, PATH); cairo_clip (CR); cairo_set_operator (Cr, cairo_operator_clear); cairo_paint (CR); cairo_restore ();

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.