• 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
image drawing glitch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

image drawing glitch


  • Subject: image drawing glitch
  • From: Jesse Grosjean <email@hidden>
  • Date: Sun, 7 Nov 2004 20:19:56 -0500

On this page I've posted a small image that best explains the problem that I'm seeing:

	http://www.hogbaysoftware.com/badgediconbug.gif

The left icon has a small white glitch in the bottom left corner. The right icon is drawn as I want and expect. I'm trying to figure out what is causng the glitch. It seems to show up randomly. Maybe 1 out of 10 times I'll get the glitch version, the rest of the time I get the normal version.

I'm creating these icons by loading an image file. And then drawing 25% black over the icon. My code looks like this:

	NSImage *fileIcon = [NSImage imageNamed:@"file"];
	NSImage *darkenedFileIcon = nil;
	NSSize size = [baseImage size];
	NSRect imageRect = {NSZeroPoint, size};

	darkenedFileIcon = [[fileIcon copy] autorelease];

	[darkenedFileIcon lockFocus];
	[[[NSColor blackColor] colorWithAlphaComponent:0.25] set];
	NSRectFillUsingOperation(imageRect, NSCompositeSourceAtop);
	[darkenedFileIcon unlockFocus];

	return darkenedFileIcon;

Behind the scenes I'm also caching these icons in a dictionary so I only need to create a darkened version of each icon once. The catching code looks like this. I'm not showing all the code, but I'm pretty sure that retains counts are proper, I'm not experiencing any crashes in any of these cases.

	NSValue *lookupKey = [NSValue valueWithPointer:originalImage];
	[darkenedImageCache setObject:lookupKey forKey:darkenedImage];

Has anyone seen this sort of problem before, or know what might be causing it? Do you have suggestions on where I should look to fix the problem?

Thanks,
Jesse

_______________________________________________
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


  • Follow-Ups:
    • Re: image drawing glitch
      • From: stephane sudre <email@hidden>
    • Re: image drawing glitch
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: QuickTime, NSMovieView woes
  • Next by Date: folder name in asian characters
  • Previous by thread: text layout crash
  • Next by thread: Re: image drawing glitch
  • Index(es):
    • Date
    • Thread