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

Re: image drawing glitch


  • Subject: Re: image drawing glitch
  • From: stephane sudre <email@hidden>
  • Date: Tue, 9 Nov 2004 11:12:33 +0100


On Nov 8, 2004, at 2:19 AM, Jesse Grosjean wrote:

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?

Thousands or millions of colors?

I've seen bugs in Thousands of colors in Image Rendering in Cocoa in pre-Panther system.

I've also seen this kind of bug in NSButton drawing when the content is just an icon.

_______________________________________________
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


References: 
 >image drawing glitch (From: Jesse Grosjean <email@hidden>)

  • Prev by Date: Nibs and memory leaks
  • Next by Date: Re: New Spotlight Info
  • Previous by thread: Re: image drawing glitch
  • Next by thread: folder name in asian characters
  • Index(es):
    • Date
    • Thread