Q:

image scaling performance in Quartz/Cocoa vs Qt4

I wrote a test application in Qt4 which uses QImage.scaled() or QPixmap.scaled() methods that turned to  be very slow.  Even a perspective transform is faster, while a scaling transform is the same slow. 
[I tried to scale directly a QPainter but I do not master paintEvent() so I always get "painter not active" or paintEvent() is not called at all.  So I do not know the painter scaling performaces.] 
I ask here if the same issue is known for Quartz/Cocoa or instead their performances for similar tasks are better.  I am particularly interested in native Quartz pdf rendering capability and subsequent image scaling. 

A:

NIRTimer *timer = [NIRTimer timer];
    [timer start];
    NSImage *image = [[NSImage alloc]initWithContentsOfFile:@"filename"];
    NSImage *scaledImage = [[NSImage alloc]initWithSize:NSMakeSize(720, 480)];
    [scaledImage lockFocus];
    [image drawInRect:NSMakeRect(0, 0, 720, 480) fromRect:NSZeroRect operation:NSCompositeSourceAtop fraction:1];
    [scaledImage unlockFocus];
    [image release];
    [scaledImage release];
    NSLog(@"time: %ld", [timer microseconds]);

This is how to scale an image in Cocoa, and it takes 80000 microseconds (0.08 seconds).