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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/************************************************************************/
/* Scan, main module. */
/************************************************************************/
# include "appFrameConfig.h"
# include <stddef.h>
# include <stdio.h>
# include <stdlib.h>
# include <sioXprop.h>
# include <appImage.h>
# include <appDebugon.h>
/************************************************************************/
/* */
/* get the image from the clipboard that 'xv' simulates on the root */
/* window. */
/* */
/************************************************************************/
int appImgGetXvClipboard( BitmapDescription * bd,
unsigned char ** pBuffer,
APP_WIDGET w )
{
SimpleInputStream * sis;
int done;
sis= sioInOpenXvPaste( w );
if ( ! sis )
{ XDEB(sis); return -1; }
done= bmXvReadPaste( bd, pBuffer, sis );
sioInClose( sis );
if ( done < 0 )
{ LDEB(done); return -1; }
return 0;
}
int appImgPutXvClipboard( const BitmapDescription * bd,
const unsigned char * buffer,
APP_WIDGET w )
{
SimpleOutputStream * sos;
int done;
sos= sioOutOpenXvCopy( w );
if ( ! sos )
{ XDEB(sos); return -1; }
done= bmXvWritePaste( bd, buffer, sos );
sioOutClose( sos );
if ( done < 0 )
{ LDEB(done); return -1; }
return 0;
}
|