NSBitmapImageRep data Format as application icon image??

Posted by Joe on Stack Overflow See other posts from Stack Overflow or by Joe
Published on 2010-04-01T20:42:15Z Indexed on 2010/04/01 20:43 UTC
Read the original article Hit count: 304

Filed under:
|
|

i have a char* array of data that was in RGBA and then moved to ARGB

Bottom line is the set application image looks totally messed up and i cant put my finger on why?

    //create a bitmap representation of the image data.
    //The data is expected to be unsigned char**
    NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc]
        initWithBitmapDataPlanes : (unsigned char**) &dest
        pixelsWide:width pixelsHigh:height
        bitsPerSample:8
        samplesPerPixel:4
        hasAlpha:YES
        isPlanar:NO
        colorSpaceName:NSDeviceRGBColorSpace
        bitmapFormat:NSAlphaFirstBitmapFormat
        bytesPerRow: 0
        bitsPerPixel:0 ];

    NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
    [image addRepresentation:bitmap];


    if( image == NULL) {
        printf("image is null\n");
        fflush(stdout);
    }

    [NSApp setApplicationIconImage :image];

What in these values is off? the image looks very multicolored and pixelated, with transparent parts/lines as well.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about mac