• 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
NSImageViews and redrawing bitmap data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImageViews and redrawing bitmap data


  • Subject: NSImageViews and redrawing bitmap data
  • From: Don Murta <email@hidden>
  • Date: Wed, 07 Nov 2001 16:37:57 -0700

Hi, I feel a little stupid asking this.
Basically what I'm trying to do is take a NSImageView, pull out the bitmap data from it change its bitmap data, and have it redisplay. I can get it to draw once at startup, and my bitmap data seems to be changing ok, but I can't seem to get the bitmap back out to the screen again.
Thanks in advance.

-Don-

// assume NSImageView *theImageView loads and draws once just fine
- (IBAction)doMyDraw:(id)sender
{
NSBitmapImageRep *theImageRep = [[[theImageView image] representations] objectAtIndex:0];
unsigned char *data;
int i;

data = [theImageRep bitmapData];

// the image is RGB, 400 x 400
// flip black to white
for( i = 0; i < (400 * 400 * 3); i++ )
{
if( data[i] == 0 )
{
data[i] = 255;
}
else
{
data[i] = 0;
}
}
// how do I make my changes get redrawn?
}


  • Prev by Date: growing an NSView?
  • Next by Date: Re: NSDebug.h and frame pointers
  • Previous by thread: Re: growing an NSView?
  • Next by thread: Re: NSDebug.h and frame pointers
  • Index(es):
    • Date
    • Thread