objective c - RGBStroke - Image pixels instead of color (iOS) -


i implementing image mask kind of feature in ios similar offered in blender app 2 images. here touch move code :-

- (void)touchesmoved:(nsset *)touches withevent:(uievent *)event {      uitouch *touch = [touches anyobject];     cgpoint currentpoint = [touch locationinview:staticbg1];      uigraphicsbeginimagecontext(view.frame.size);     [image_1 drawinrect:cgrectmake(0, 0, view.frame.size.width, view.frame.size.height)];      cgcontextsetlinecap(uigraphicsgetcurrentcontext(), kcglinecapround);     cgcontextsetlinewidth(uigraphicsgetcurrentcontext(), 20.0);     cgcontextsetrgbstrokecolor(uigraphicsgetcurrentcontext(), 1.0, 0.0, 0.0, 1.0);     cgcontextbeginpath(uigraphicsgetcurrentcontext());     cgcontextmovetopoint(uigraphicsgetcurrentcontext(), lastpoint.x, lastpoint.y);     cgcontextaddlinetopoint(uigraphicsgetcurrentcontext(), currentpoint.x, currentpoint.y);     cgcontextstrokepath(uigraphicsgetcurrentcontext());      image_1 = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();      lastpoint = currentpoint;     mousemoved++;     if (mousemoved == 10)         mousemoved = 0; } 

the above code generating effect :

now want not bright red line pixels image in places. both images of same dimensions. how do it?? tried implement manual image processing method pixel access slow , done in real time.

is there alternative to: cgcontextsetrgbstrokecolor(uigraphicsgetcurrentcontext(), 1.0, 0.0, 0.0, 1.0); ?

don't draw colour or pattern path, draw transparency. need 1 image in own layer behind image being wiped out. create path now, instead of setting colour, set blend mode clear (kcgblendmodeclear).

this remove sections of image allow see through image below.


replace:

cgcontextsetrgbstrokecolor(uigraphicsgetcurrentcontext(), 1.0, 0.0, 0.0, 1.0); 

with:

cgcontextsetblendmode(uigraphicsgetcurrentcontext(), kcgblendmodeclear);  

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -