#include #include "lx.h" #include "proto.h" #include "internal.h" void lx_PutImage( LX_CONN *xc, LX_XID drawable, LX_XID gc, LX_IMAGEFORMAT fmt, int depth, int w, int h, int dstx, int dsty, int leftpad, int datalen, const void *data ) { unsigned char reqhdr[24]; int pf; if ( (xc->flags & XCF_FAIL) || (w > 65535) || (h > 65535) || (depth < 0) || (depth > 255) || (dstx < -32768) || (dstx > 32767) || (dsty < -32768) || (dsty > 32767) || (leftpad < 0) || (leftpad > 255) || (datalen < 0) || (datalen > ((65535-6)*4)) ) { lx__bad_call(xc,"lx_PutImage"); return; } lx__nochain(xc); pf = lx__imageformat_to_proto(fmt); if (pf < 0) { lx__bad_call(xc,"lx_PutImage"); return; } reqhdr[0] = XP_REQ_PutImage; reqhdr[1] = pf; w_card16(&reqhdr[2],6+((datalen+3)>>2)); w_card32(&reqhdr[4],drawable); w_card32(&reqhdr[8],gc); w_card16(&reqhdr[12],w); w_card16(&reqhdr[14],w); w_int16(&reqhdr[16],dstx); w_int16(&reqhdr[18],dsty); reqhdr[20] = leftpad; reqhdr[21] = depth; lx__send_req(xc,&reqhdr[0],24); lx__just_send(xc,data,datalen); lx__send_padding(xc,datalen); }