• 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
NSImage scaling not well rendered and other few things...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImage scaling not well rendered and other few things...


  • Subject: NSImage scaling not well rendered and other few things...
  • From: Olivier Guizol <email@hidden>
  • Date: Thu, 27 Mar 2003 22:26:45 -0800

Hi there,

I have written a class that inherits from NSView that has an NSImage to
display.

My problem appears when I scale the image in a running application.
Indeed, it seems that the scaling blurs the image until at some point
it become unicolor...
This is obvious when I resize the window to its minimal rectangle: When
you scale it afterward, I guess it does just a scaling of the small
image and does not use the actual image data.
I added the method -(void) viewDidEndLiveResize and made a recache call
on the image but I believe I should do something else as it did not
work.

Next is the code of two methods of this class.
What should I add in order to get true non blurry scaling

In the init method I have the following:
_backgroundImage = [NSImage imageNamed:@"myImage"];
[_backgroundImage retain];
[_backgroundImage setScalesWhenResized:YES];
[_backgroundImage setSize:bds.size];

And the draw method is this one:
- (void) drawRect:(NSRect)rect {
NSRect bds = [self bounds];
[_backgroundImage setSize:bds.size];
[_backgroundImage drawInRect:bds fromRect:bds
operation:NSCompositeSourceOver fraction:1.0];
}


As a side note, myImage is a Jpeg. I tried to load without success a
Tiff image but it looks like the image was lacking the alpha channel. I
operated tiffutil -cat on the image as advised in the logs without any
more success either. Someone has some insights to share on this one?

Thanks a lot,
Olivier
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Newbie question regarding NSWindow
  • Next by Date: Re: Is there a ready chart plotting view?
  • Previous by thread: Re: Newbie question regarding NSWindow
  • Next by thread: NSOpenPanel Path Problem
  • Index(es):
    • Date
    • Thread