quartz-dev

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Core Image interpolation Issue Sandy McGuffog Fri Jun 19 09:01:39 2009

Can't tell from that.

You said that you were drawing a CIImage. The thing is, a CIImage really isn't an image as such, its a "recipe" for how to process an image. So, e.g., if your input image to the CIImage is say an image of 50x50, and you then ask CoreImage to render the image at 100x100, which it looks like you are, then CIImage (aka, the Core Image Processing Pipeline) will dutifully interpolate the image up to 100x100, before any of the drawInRect stuff happens. So the question is, what's your input into the CIImage (what are you creating it from), and what are you asking it to render to?

Sandy

On Jun 19, 2009, at 4:57 PM, Srinivasa Prabhu wrote:

Sandy, Thanks for your reply.

Can't say for sure without seeing all your code, and understanding image sizes at various points in the chain, but you may well be seeing interpolation that has occurred in the CIImage/CIFilter chain before your call to drawInRect.

We are not using any custom filters in our application.
Here is the code snippet of image drawing  :

#define TO_NSRECT(cgRect) (*(NSRect*)(&cgRect))

        CGRect extent =[ outputImage extent ];
        float width = floorf( extent.size.width );
        float height = floorf(extent.size.height );
        
        if( width != 0 && height != 0  )
        {
                [ outputImage
drawInRect: TO_NSRECT( extent ) /*NSMakeRect( 0, 0, 100, 100)*/ fromRect:TO_NSRECT( extent ) operation:NSCompositeSourceOver fraction:1.0 ];
        }

Image is drawn in drawrect of custom NSView.
Interpolation issues are observed when view zooming is done.
Following is the code snippet of view zooming :

        fr = [self frame];
                        
        newSize.width = newSize.height = factor;

        [self scaleUnitSquareToSize:newSize];
                        
        fr.size.width *= factor;
        fr.size.height *= factor;
        [self setFrameSize:fr.size];


Please let me know if I am doing something wrong here.

Regards,
Srinivas.

On Jun 19, 2009, at 4:13 PM, Sandy McGuffog wrote:

Can't say for sure without seeing all your code, and understanding image sizes at various points in the chain, but you may well be seeing interpolation that has occurred in the CIImage/CIFilter chain before your call to drawInRect. If so, the issue is that default CISampler interpolates - the only way I know of to control interpolation in that chain is via custom filters that use CISamplers set up to not interpolate, e.g.,

CISampler *src = [CISampler samplerWithImage: inputImage keysAndValues: kCISamplerFilterMode, kCISamplerFilterNearest, nil];

Sandy

On Jun 19, 2009, at 6:39 AM, Srinivasa Prabhu wrote:

Hi all,

We are working on a image viewer application.
Here  a CIImage is drawn in NSView using the following API :
- (void)drawInRect:(NSRect)dstRect fromRect:(NSRect)srcRect operation:(NSCompositingOperation)op fraction:(CGFloat)delta


But, this API ignores the interpolation settings set to the current graphics context.
Interpolation settings is changed using the following API :
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationNone]


Please let me if i am doing something wrong here.
or Is there any way to change the interpolation settings while drawing CIImage?

Thanks in advance,
Srinivas.




-----------------------------------------------

Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]