• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fwd: NSImage representations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: NSImage representations


  • Subject: Fwd: NSImage representations
  • From: Jeremy Rotsztain <email@hidden>
  • Date: Sat, 7 Jul 2007 15:26:55 -0400


Hello.

My imaging software continuously updates a NSImage object with the contents of a NSBitMapImageRepresentation.

I'm drawing into the image representation every frame, and adding the image representation to the NSImage again, but I'm unable to see the updated NSImage when I display it in a NSImageView or export it to disk using [ NSData writeToFile ].

Any advice on getting this to work would be greatly appreciated.

Jeremy



In my code, it looks something like this.

init:

NSImage *myComposition = [[[NSImage allocWithZone:[self zone]] initWithSize:compositionSize ] retain ];

// create img representation
NSBitmapImageRep *myCompositionRep = [[NSBitmapImageRep allocWithZone:[self zone]]
initWithBitmapDataPlanes: nil // Nil pointer tells the kit to allocate the pixel buffer for us.
pixelsWide: compositionSize.width
pixelsHigh: compositionSize.height
bitsPerSample: 8
samplesPerPixel: 4
hasAlpha: YES
isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace // 0 = black, 1 = white in this color space.
bytesPerRow: 0 // Passing zero means "you figure it out."
bitsPerPixel: 32]; // This must agree with bitsPerSample and samplesPerPixel.



[ myCompositionRep retain ];

// add representation to main image
[ myComposition addRepresentation:myCompositionRep ];

drawing loop:

// draw into myCompositionRep

[ myComposition addRepresentation:myCompositionRep ];

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSImage representations
      • From: Scott Stevenson <email@hidden>
    • Re: NSImage representations
      • From: Dorian Johnson <email@hidden>
  • Prev by Date: Core data / bindings with two one->many relationships
  • Next by Date: How to keep creation/modification date of a (Core Data) object?
  • Previous by thread: RE: Core data / bindings with two one->many relationships
  • Next by thread: Re: NSImage representations
  • Index(es):
    • Date
    • Thread