• 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
NSScrollView scroll scale image problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSScrollView scroll scale image problem


  • Subject: NSScrollView scroll scale image problem
  • From: Peter Chan <email@hidden>
  • Date: Sat, 25 Aug 2012 15:45:52 +0800

I am facing a problem of scrolling a scale NSImageRep image. It
appears the image leaves trail when the scroll bar is drag left /right
or up/down direction.  However if the scale is set to 1.0, the image
appears to be normal when scrolling occur.  Is there a way to solve
this problem ?

Thanks.

Links to part screen shot.
https://dl.dropbox.com/u/13443568/Cocoa/screen1.jpg
https://dl.dropbox.com/u/13443568/Cocoa/scrollleftright.jpg
https://dl.dropbox.com/u/13443568/Cocoa/scrollupdown.jpg

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
		NSString *pathStr;
		NSRect tmpRect;

		pathStr = [[[NSBundle mainBundle] resourcePath]
stringByAppendingPathComponent:@"lena.jpeg"];
		imageRep = [NSImageRep imageRepWithContentsOfFile:pathStr];
		[imageRep retain];
		tmpRect = [self frame];
		// double the scroll view size for scrolling
		tmpRect.size.width *= 2.0;
		tmpRect.size.height *= 2.0;
		[self setFrame:tmpRect];
    }
    return self;
}

- (void)drawRect:(NSRect)dirtyRect
{
	NSAffineTransform *trans;

	[NSGraphicsContext saveGraphicsState];
	[[NSColor greenColor] set];
	NSRectFill([self frame]);
	trans = [NSAffineTransform transform];
	[trans scaleBy:0.5];
	[trans set];
	[imageRep drawAtPoint:NSZeroPoint];
	[NSGraphicsContext restoreGraphicsState];
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSScrollView scroll scale image problem
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Finder Info
  • Next by Date: Re: NSScrollView scroll scale image problem
  • Previous by thread: Re: NSView -backingAlignedRect:
  • Next by thread: Re: NSScrollView scroll scale image problem
  • Index(es):
    • Date
    • Thread