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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to