ios - Background color for drawing CIImage -
i use of cifilter
s image processing. i've found uiimageview
slow display output image in real-time. i've followed documentation , built glkview
. performance perfect, image rendered in black rect when rotated.
how set color background (green in case) or transparent?
here drawing code snippet. i'm not familiar graphics domain @ all.
private class imageview: glkview { override init!(frame: cgrect, context: eaglcontext!) { // called `.opengles3` context. cicontext = cicontext(eaglcontext: context, options: [kcicontextworkingcolorspace: nsnull()]) super.init(frame: frame, context: context) } private let cicontext: cicontext private var image: ciimage? { didset { setneedsdisplay() } } private override func drawrect(rect: cgrect) { // clear `glclear`... here set color `backgroundcolor` (green) , cleared it. if image != nil { cicontext.drawimage(image!, inrect: { /* returned computed rect */ }(), fromrect: image!.extent()) } } private override func layoutsubviews() { super.layoutsubviews() setneedsdisplay() } }
are setting blend mode?
glenable(gl_blend); glblendfunc(gl_src_alpha, gl_one_minus_src_alpha); glblendequation(gl_func_add);
check link show visual effects of blend mode
if setting blend mode can show more of going on in drawrect method?
Comments
Post a Comment