objective c - Create 1 image from masked image in ios -


i have image , mask image image make shape.
i want change view background color of masked image.
i using [uicolor colorwithpatternimage:maskedimage];
but not working.
please suggest me how merge or create masked 2 images in 1 image colorwithpatternimage work.

uiimage *originalimage = [uiimage imagenamed:@"original.png"]; //my background image uiimage *maskedimage       = [uiimage imagenamed:@"maskedimage.png"]; //my masked image  cgsize newsize = cgsizemake(width, height); uigraphicsbeginimagecontext( newsize );   [originalimage drawinrect:cgrectmake(0,0,newsize.width,newsize.height)];   [maskedimage drawinrect:cgrectmake(0,0,newsize.width,newsize.height) blendmode:kcgblendmodenormal alpha:0.6];  uiimage *newmaskedbackgroundimage = uigraphicsgetimagefromcurrentimagecontext();  uigraphicsendimagecontext(); 

then use newmaskedbackgroundimage, ex. [uicolor colorwithpatternimage:newmaskedbackgroundimage];


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -