Skip navigation.
 
mlRe: NSView to NSImage
FROM : Tristan Jehan
DATE : Mon Jul 17 23:53:06 2006

Michael,

The "second" solution worked perfectly!
The first didn't do the right thing, perhaps because my view wasn't 
visible on screen...

Thanks!

Tristan


On Jul 16, 2006, at 4:56 PM, Michael Watson wrote:

> Have you tried:
>
> [view lockFocus];
> NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] 
> initWithFocusedViewRect:[view bounds]];
> [view unlockFocus];
>
> If that doesn't work, try:
>
> [view lockFocus];
> NSImage *image = [[NSImage alloc] initWithData:[cameraView 
> dataWithPDFInsideRect:[view bounds]]];
> [view unlockFocus];
>
>
> --
> Michael Watson
>
>
> On 16 Jul, 2006, at 16:47, Tristan Jehan wrote:
>

>> I'm trying to capture an NSView+descendants into an NSImage using 
>> something like:
>>
>>     NSBitmapImageRep *bitmap = [view 
>> bitmapImageRepForCachingDisplayInRect:[view bounds]];
>>     [view cacheDisplayInRect:[view bounds] toBitmapImageRep:bitmap];
>>
>> Problem is: I have the subclass of an NSSlider in that view that 
>> does not get drawn. The NSSlider subclass uses an NSSliderCell 
>> subclass in order to draw its own bar and knob... I believe 
>> cacheDisplayInRect does not call the proper rendering function, 
>> but I can't tell... Do I need to override a function in NSSlider?
>>
>> Has anyone experienced something like this? Is there a fix?
>>
>> Thanks,
>>
>> Tristan
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list      (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/mikey-san%
>> 40bungie.org
>>
>> This email sent to <email_removed>

>

Related mailsAuthorDate
mlNSView to NSImage Tristan Jehan Jul 16, 22:47
mlRe: NSView to NSImage Michael Watson Jul 16, 22:56
mlRe: NSView to NSImage Tristan Jehan Jul 17, 23:53
mlRe: NSView to NSImage Michael Watson Jul 18, 00:40