Widget's snapshot

Hi All !
I have some hidden widget (have very big negative coordinates -1000,-1000).
And I want to get snapshot from this widget.

PhRect_t rect;
PhImage_t *image;

/* get absolute coordinates of the widget → rect */

if( PgReadScreen( &rect, image ) ) {
/* do something with image … */
}
else { printf(“error: %s\n”, strerror( errno )); }

It’s works fine when widget is visible. But when widget is not visible
(negative coordinates) I get next error: “No such device or address”

How can I make widget’s snapshot when it is unvisible ?

–dima

Rather than PgReadScreen, have you tried using a memory context?

e.g. Something along these lines:

PhImage_t* image;
PmMemoryContext* mc;

// create image of desired size
image = PhCreateImage( … )

// switch to memory context
mc = PmMemCreateMC( … )
PmMemStart( mc )

// draw widget into memory context
PtDamageWidget( widget )
PtFlush( )

// flush context into image
PmMemFlush( mc, image )

// switch back to default context
PmMemStop( mc )
PmMemReleaseMC( mc )

Regards,
Chris

Chris Wiebe / QNX Software Systems

“Dmitry Marienko” <dima@rts-ukraine.com> wrote in message
news:3F3B43E8.3080200@rts-ukraine.com

Hi All !
I have some hidden widget (have very big negative
coordinates -1000,-1000).
And I want to get snapshot from this widget.

PhRect_t rect;
PhImage_t *image;

/* get absolute coordinates of the widget → rect */

if( PgReadScreen( &rect, image ) ) {
/* do something with image … */
}
else { printf(“error: %s\n”, strerror( errno )); }

It’s works fine when widget is visible. But when widget is not visible
(negative coordinates) I get next error: “No such device or address”

How can I make widget’s snapshot when it is unvisible ?

–dima

PgReadScreen does just that, read from the physical screen, if the
widget isn’t on the screen you won’t be able to read it.

Chris mentioned the memory context idea, that is probably your best bet.

Dave

Dmitry Marienko wrote:

Hi All !
I have some hidden widget (have very big negative coordinates
-1000,-1000).
And I want to get snapshot from this widget.

PhRect_t rect;
PhImage_t *image;

/* get absolute coordinates of the widget → rect */

if( PgReadScreen( &rect, image ) ) {
/* do something with image … */
}
else { printf(“error: %s\n”, strerror( errno )); }

It’s works fine when widget is visible. But when widget is not visible
(negative coordinates) I get next error: “No such device or address”

How can I make widget’s snapshot when it is unvisible ?

–dima

Thanks Chris ! It’s works !

Chris Wiebe wrote:

Rather than PgReadScreen, have you tried using a memory context?

e.g. Something along these lines:

PhImage_t* image;
PmMemoryContext* mc;

// create image of desired size
image = PhCreateImage( … )

// switch to memory context
mc = PmMemCreateMC( … )
PmMemStart( mc )

// draw widget into memory context
PtDamageWidget( widget )
PtFlush( )

// flush context into image
PmMemFlush( mc, image )

// switch back to default context
PmMemStop( mc )
PmMemReleaseMC( mc )

–dima