Re: QCView transparent background + full window screenshot with title
Re: QCView transparent background + full window screenshot with title
- Subject: Re: QCView transparent background + full window screenshot with title
- From: Greg Herlihy <email@hidden>
- Date: Tue, 25 Apr 2006 20:16:38 -0700
- Thread-topic: QCView transparent background + full window screenshot with title
The program can use the following code to create a bitmap of an entire
window including its title bar:
// wp is a NSWindow *
NSView *windowView;
NSBitmapImageRep *bitmap;
windowView = [[wp contentView] opaqueAncestor];
[windowView lockFocus];
bitmap = [[NSBitmapImageRep alloc] initWithFocusedViewRect:
[windowView frame]];
[windowView unlockFocus];
The program will have to place the QCView is an overlay window (which is a
borderless, transparent window) - which it can create by subclassing
NSWindow. Apple has some sample code showing how to create an overlay window
in Cocoa.
Greg
On 4/25/06 8:26 AM, "Alexey Galygin" <email@hidden> wrote:
> Hi!
>
> I want do following: two windows cube animation.
> I have screenshot for each window. I have Quartz composition assigned to
> hidden panel in IB.
> When user press Forward button on window 1, I hide window 1 and create
> panel with NSView from
> hidden panel from IB... set face images then start QCView animation:
>
> - (void) awakeFromNib
> {
> NSLog(@"wc1: awake");
>
> if(myPanel==nil)
> {
> NSView *cv=[aw contentView];
> myPanel=[[NSPanel alloc]initWithContentRect:[cv frame]
> styleMask:NSBorderlessWindowMask
> backing:NSBackingStoreBuffered defer:NO];
> [myPanel setContentView:cv];
> [myPanel setHidesOnDeactivate:NO];
> [myPanel setFrameAutosaveName:@"myPanel_sv"];
> }
> }
>
>
>
> NSRect winFrame = [[self window] frame];
> [qv setValue: im forInputKey: @"pic1"];
> [qv setValue: imp forInputKey: @"pic2"];
>
> [myPanel setFrame: winFrame display: YES];
> [myPanel orderFront:self];
> [qv start: self];
> [self performSelector:@selector(showWP:) withObject: self
> afterDelay:1.1];
>
> For better results I need answers to following questions:
>
> 1. How can I do cube animation on panel without title with transparent
> background?
> I even trying to set erase color opacity to zero... Without result...
> When I set two images to faces and start animation I see dirty track on
> area over cube... no transparency.
>
> 2. How can I do full window screenshot with title? Not only inside
> window NSView content...
>
> I have:
>
> [wp orderFront:self];
> NSView * vwp = [wp contentView];
> [vwp lockFocus];
> NSBitmapImageRep *bitmapp = [[NSBitmapImageRep alloc]
> initWithFocusedViewRect:[vwp bounds]];
> [vwp unlockFocus];
> NSImage *imp = [[NSImage alloc] initWithSize:[bitmapp size]];
> [imp addRepresentation:bitmapp];
> [wp orderOut:self];
>
> Unfortunately, this code make screenshot without windows title and his
> buttons...
> Using screenshot by NSRect (as tip captureImageForRect:) is very
> slowly... And not working for me.
>
> Any suggestions?
_______________________________________________
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