Trouble with GenerateThumbnailForURL

  • I'm trying to write a Quick Look generator in Cocoa, based on the
    Sketch sample code. I send

    [view displayRectIgnoringOpacity:theRect inContext:context];

    but my view's drawRect: is never called, and the Quick Look is blank.
    (I tossed in some CGContext drawing just to verify that the thumbnail
    was being generated; it was.)

    I'm creating the view and not inserting it into any hieararchy.

    Besides my drawRect: not getting called, the other oddity is that the
    context is a NSBitmapGraphicsContext even though I use
    QLThumbnailRequestCreateContext(aThumbnail, *(CGSize *)&docSize,
    false, NULL), which should be making a single page vector context.

    David Dunham
    Voice/Fax: 206 783 7404            http://www.pensee.com/dunham/
    Imagination is more important than knowledge. -- Albert Einstein
  • Hi David,
    1) Can you check that the drawing rect against your view's bounds? I suspect
    AppKit won't even try to draw something if there is nothing to draw.

    2) The context returned by QLThumbnailRequestCreateContext() is always a
    bitmap context, even when you specify "false" for "isBitmap". It's an
    implementation detail and you should not worry about that, it still does
    what is needed for your thumbnail to look correct :-)

    On Nov 11, 2007 6:07 AM, David Dunham <dunham...> wrote:

    > I'm trying to write a Quick Look generator in Cocoa, based on the
    > Sketch sample code. I send
    >
    > [view displayRectIgnoringOpacity:theRect inContext:context];
    >
    > but my view's drawRect: is never called, and the Quick Look is blank.
    > (I tossed in some CGContext drawing just to verify that the thumbnail
    > was being generated; it was.)
    >
    > I'm creating the view and not inserting it into any hieararchy.
    >
    > Besides my drawRect: not getting called, the other oddity is that the
    > context is a NSBitmapGraphicsContext even though I use
    > QLThumbnailRequestCreateContext(aThumbnail, *(CGSize *)&docSize,
    > false, NULL), which should be making a single page vector context.
    >

    >
    > David Dunham
    > Voice/Fax: 206 783 7404            http://www.pensee.com/dunham/
    > Imagination is more important than knowledge. -- Albert Einstein
    >
    > _______________________________________________
    > MacOSX-dev mailing list
    > <MacOSX-dev...>
    > http://www.omnigroup.com/mailman/listinfo/macosx-dev
    >
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today