< prev index next >

src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m

Print this page




 258         NSBitmapImageRep * rep = [[NSBitmapImageRep alloc]
 259             initWithBitmapDataPlanes: (unsigned char**)&splash->screenData
 260                           pixelsWide: splash->width
 261                           pixelsHigh: splash->height
 262                        bitsPerSample: 8
 263                      samplesPerPixel: 4
 264                             hasAlpha: YES
 265                             isPlanar: NO
 266                       colorSpaceName: NSDeviceRGBColorSpace
 267                         bitmapFormat: NSAlphaFirstBitmapFormat | NSAlphaNonpremultipliedBitmapFormat
 268                          bytesPerRow: splash->width * 4
 269                         bitsPerPixel: 32];
 270 
 271         NSImage * image = [[NSImage alloc]
 272             initWithSize: NSMakeSize(splash->width, splash->height)];
 273         [image setBackgroundColor: [NSColor clearColor]];
 274 
 275         [image addRepresentation: rep];
 276         float scaleFactor = splash->scaleFactor;
 277         if (scaleFactor > 0 && scaleFactor != 1) {
 278             [image setScalesWhenResized:YES];
 279             NSSize size = [image size];
 280             size.width /= scaleFactor;
 281             size.height /= scaleFactor;
 282             [image setSize: size];
 283         }
 284         
 285         NSImageView * view = [[NSImageView alloc] init];
 286 
 287         [view setImage: image];
 288         [view setEditable: NO];
 289         //NOTE: we don't set a 'wait cursor' for the view because:
 290         //      1. The Cocoa GUI guidelines suggest to avoid it, and use a progress
 291         //         bar instead.
 292         //      2. There simply isn't an instance of NSCursor that represent
 293         //         the 'wait cursor'. So that is undoable.
 294 
 295         //TODO: only the first image in an animated gif preserves transparency.
 296         //      Loos like the splash->screenData contains inappropriate data
 297         //      for all but the first frame.
 298 




 258         NSBitmapImageRep * rep = [[NSBitmapImageRep alloc]
 259             initWithBitmapDataPlanes: (unsigned char**)&splash->screenData
 260                           pixelsWide: splash->width
 261                           pixelsHigh: splash->height
 262                        bitsPerSample: 8
 263                      samplesPerPixel: 4
 264                             hasAlpha: YES
 265                             isPlanar: NO
 266                       colorSpaceName: NSDeviceRGBColorSpace
 267                         bitmapFormat: NSAlphaFirstBitmapFormat | NSAlphaNonpremultipliedBitmapFormat
 268                          bytesPerRow: splash->width * 4
 269                         bitsPerPixel: 32];
 270 
 271         NSImage * image = [[NSImage alloc]
 272             initWithSize: NSMakeSize(splash->width, splash->height)];
 273         [image setBackgroundColor: [NSColor clearColor]];
 274 
 275         [image addRepresentation: rep];
 276         float scaleFactor = splash->scaleFactor;
 277         if (scaleFactor > 0 && scaleFactor != 1) {

 278             NSSize size = [image size];
 279             size.width /= scaleFactor;
 280             size.height /= scaleFactor;
 281             [image setSize: size];
 282         }
 283         
 284         NSImageView * view = [[NSImageView alloc] init];
 285 
 286         [view setImage: image];
 287         [view setEditable: NO];
 288         //NOTE: we don't set a 'wait cursor' for the view because:
 289         //      1. The Cocoa GUI guidelines suggest to avoid it, and use a progress
 290         //         bar instead.
 291         //      2. There simply isn't an instance of NSCursor that represent
 292         //         the 'wait cursor'. So that is undoable.
 293 
 294         //TODO: only the first image in an animated gif preserves transparency.
 295         //      Loos like the splash->screenData contains inappropriate data
 296         //      for all but the first frame.
 297 


< prev index next >