Detailed description of the Globalcompositeoperation attribute in HTML5

Source: Internet
Author: User
This article brings you the content is about CSS3 in the use of Background-orgin (with code), there is a certain reference value, the need for a friend can refer to, I hope you have some help.

The default Value property of Globalcompositeoperation is Source-over

1, Source-over and source on the target

Context.fillstyle = ' Aqua '; Context.fillrect (50,50,100,100);//target Graph context.globalcompositeoperation = ' source-over '; Context.fillstyle = ' Antiquewhite '; Context.fillrect (100,100,100,100);//source graphics

The graphic above is the target, and the graphic below is the source

2, Destination-over target on the source

3. Source-atop will draw the source above the target, but both are opaque on the coincident area, and the target drawn in the other position is opaque and the source is transparent.

Context.fillstyle = ' Aqua '; Context.fillrect (50,50,100,100); context.globalcompositeoperation = ' source-atop '; Context.fillstyle = ' Antiquewhite '; Context.fillrect (100,100,100,100);

4, Destination-atop and source-atop effect, in the overlap between the two are not transparent, but in other locations source opaque, transparent target

5, source-in source and target overlap Part only show the source, the other parts have become transparent

6, destination-in source and target overlap part, only show the target, others become transparent

7, source-out only show the source is not overlapping parts, the other parts are not displayed

8, destination-out only show the target not overlapping parts, other parts are not displayed

9, lighter This value is independent of the order, if the source and target overlap, the two color values are added to get the maximum color value of 255, the value is white

10. Copy copies only the source

11. Copy only the source and target non-overlapping parts, overlapping parts transparent

Related Article

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.