• 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
force entire window redraw?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

force entire window redraw?


  • Subject: force entire window redraw?
  • From: Michael Hanna <email@hidden>
  • Date: Tue, 28 Sep 2004 16:25:46 -0400

Hi, I'm performing a short dark "flash" on my NSWindow, but when I restore the original cached image, it doesn't completely return to its original state:

http://www.siddha.ca/~tao/darkened.jpg

any ideas on how to force it to return completely?

here's my code:

~~~~


-(void)doSignal {


[...............]

if([defaults boolForKey:TAOFlashWindowKey] == YES)
{
NSTimer *flashTimer;
NSView * flashView = [myWindow contentView];
NSRect theRect = [flashView bounds];
NSData * viewData = [flashView dataWithPDFInsideRect:[flashView bounds]];

NSImage * theImage = [[NSImage alloc] initWithData:viewData];


[myWindow cacheImageInRect:theRect];

[flashView lockFocus]; // draw onto the contentView

[[NSColor colorWithDeviceWhite:0.0f alpha:0.8f] set];

[theImage compositeToPoint:NSMakePoint(0.0, 0.0) fromRect:theRect operation:NSCompositeSourceOver];


		NSRectFillUsingOperation(theRect,NSCompositeSourceAtop);

[flashView unlockFocus];
[myWindow flushWindow]; // draw darkened image

// add a slight delay
flashTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(darkenDelay:) userInfo:nil repeats: NO];
[[NSRunLoop currentRunLoop] addTimer:theTimer forMode:NSEventTrackingRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:theTimer forMode:NSDefaultRunLoopMode];


		[myWindow setViewsNeedDisplay:YES];
		[theImage release];

	}

}

- (void)darkenDelay
{

	[myWindow restoreCachedImage];
	[myWindow flushWindow];						// draw undarkened image
}

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Carbon sheet making my Cocoa window unmovable
  • Next by Date: NSXMLParser and CDATA sections
  • Previous by thread: Re: Localizing a helper app
  • Next by thread: NSXMLParser and CDATA sections
  • Index(es):
    • Date
    • Thread