• 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
Fast scrolling a CIImage?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fast scrolling a CIImage?


  • Subject: Fast scrolling a CIImage?
  • From: Francesco Pierfederici <email@hidden>
  • Date: Thu, 7 Sep 2006 15:24:02 -0700

Hi,

My app loads a 6 megapixel RAW image (in Nikon NEF format) from disk and turns it into a CIImage (via imageWithContentsOfURL:). It then draws it into a NSView subclass (which is embedded in a NSScrollView) via CIContext's drawImage:atPoint:fromRect: inthe view's drawRect: method.

The problem is that when the user scrolls the image vertically in the NSScrollView the screen updates are painfully slow. Horizontal scrolling works just fine.

I must be doing something wrong; but I do not what. Any help is greatly appreciated.


Thanks! Francesco


P.S. Here is the relevant code (in Python + PyObjC; the equivalent Objective-C is just as slow):


class EditView(NibClassBuilder.AutoBaseClass):
    photo = None
    image = None

    def isOpaque(self):
        # EditView covers its frame completely.
        return(True)

    def setPhoto(self, photo):
        self.photo = photo
        url = NSURL.fileURLWithPath_(photo.pixels.fileName)
        self.image = CIImage.imageWithContentsOfURL_(url)

        # Set the frame to enclose the whole image.
        frame = self.image.extent()
        self.setFrame_(frame)
        self.setNeedsDisplay_(True)
        return

    def drawRect_(self, rect):
        if(not self.image):
            return

        context = NSGraphicsContext.currentContext().CIContext()
        if(context == None):
            return

context.drawImage_atPoint_fromRect_(self.image, rect.origin, rect)
return


_______________________________________________
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


  • Prev by Date: Re: How do I get the NSApplication of other running applications?
  • Next by Date: Re: How do I get the NSApplication of other running applications?
  • Previous by thread: Re: WebKit
  • Next by thread: Re: NSPasteboard drag pasteboard hang
  • Index(es):
    • Date
    • Thread