Love paper Tail-----quartz2d-Image Add watermark

Source: Internet
Author: User

The purpose of giving a picture watermark:
Tell someone about the source of the picture.
Prevent others from stealing pictures. Advertise.

Add a watermark It's finally generating a new picture.
The picture context is used to generate the picture. No need to customize view,
The view was previously customized because the context associated with the view was to be taken.
The context associated with view is automatically created by the system, so we do not need to create it ourselves manually,
But the picture context requires us to manually create it ourselves. We also need to manually shut down.

The idea of realizing the watermark effect:
Opens a picture context that is the same as the original picture.
Draw the original picture to the picture context first.
Then the watermark (text, logo) to be added to the picture context.
Finally, a picture is taken out of the context.
Close the picture context.

1. How do I open a picture context?
Size: Turn on how big the above
Opaque: Opacity
Scale: the zoom context.
Uigraphicsbeginimagecontextwithoptions (image.size, YES, 0);

2. How do I generate a picture from a picture context?
UIImage *newimage = Uigraphicsgetimagefromcurrentimagecontext ();

3. How do I close the context?
Uigraphicsendimagecontext ();

Love paper Tail-----quartz2d-Image Add watermark

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.