objective c - Drawing pdf in Cocoa with antialias -
i developing application requires converting pdf image. problem facing in pdfs there white lines.
this code use converting pdf image.
nspdfimagerep* pdfrep = [nspdfimagerep imagerepwithcontentsoffile:path]; [pdfrep setcurrentpage:page]; nsbitmapimagerep* bmrep; nsrect pdfbounds=[pdfrep bounds]; nsrect target=[nsbitmapimagerep scalingsizefittingin:pdfbounds.size targetsize:size]; bmrep = [[nsbitmapimagerep alloc] initwithbitmapdataplanes:null pixelswide:size.width pixelshigh:size.height bitspersample:8 samplesperpixel:4 hasalpha:yes isplanar:no colorspacename:nscalibratedrgbcolorspace bytesperrow:0 bitsperpixel:0]; nsgraphicscontext* context = [nsgraphicscontext graphicscontextwithbitmapimagerep:bmrep]; [nsgraphicscontext savegraphicsstate]; [nsgraphicscontext setcurrentcontext:context]; [[nsgraphicscontext currentcontext] setshouldantialias:no]; [[nsgraphicscontext currentcontext] setimageinterpolation:nsimageinterpolationhigh]; [[nsgraphicscontext currentcontext] setcolorrenderingintent:nscolorrenderingintentperceptual]; // draw pdf rep bitmap rep. [pdfrep drawinrect:target]; [nsgraphicscontext restoregraphicsstate];
if set shouldantialias no image
and image shouldantialias set yes
the question how can rid of white stripes , keep image smooth? thanks.
Comments
Post a Comment