objective c - NSSharingServicePicker and PNG preserving transparency -
i'm trying make sharing of image while preserving transparency, when share it, transforms image jpeg losing transparency, wrong?
nsimage *image = [[nsimage alloc] initwithsize:size]; [image lockfocus]; cgcontextref context = [nsgraphicscontext currentcontext].cgcontext; cgcontextsetinterpolationquality(context, kcginterpolationhigh); // transparent image [[nscolor clearcolor] setfill]; cgcontextfillrect(context, exportview.bounds); // transparent view exportview.wantslayer = yes; exportview.layer.opaque = no; exportview.layer.backgroundcolor = [nscolor clearcolor].cgcolor; [exportview.layer renderincontext:context]; [image unlockfocus]; [exportview removefromsuperview]; nssharingservicepicker *sharingservicepicker = [[nssharingservicepicker alloc] initwithitems:@[image]]; [sharingservicepicker showrelativetorect:[sender bounds] ofview:sender preferrededge:nsrectedgeminy];
thanks
Comments
Post a Comment