Here is my code
Code: Select all
void ImageFillRect(OSL_IMAGE *img,int x1,int y1,int x2,int y2,unsigned long color) {
OSL_IMAGE *tmp;
tmp=tmp=oslCreateImageCopy(img,OSL_IN_VRAM);
oslSetDrawBuffer(tmp);
oslDrawFillRect(x1,y1,x2,y2,color);
oslCopyImage(img,tmp);
oslSetDrawBuffer(OSL_DEFAULT_BUFFER);
oslDeleteImage(tmp);
}
void DrawImageOnImage(OSL_IMAGE *srcimg, int srcX, int srcY, int width, int height, OSL_IMAGE *destimg, int destX, int destY) {
OSL_IMAGE *tmp;
tmp=oslCreateImageCopy(destimg,OSL_IN_VRAM);
oslSetDrawBuffer(tmp);
oslSetImageTileSize(srcimg,srcX,srcY,width,height);
oslDrawImageXY(srcimg,destX,destY);
oslCopyImage(destimg,tmp);
oslSetDrawBuffer(OSL_DEFAULT_BUFFER);
oslDeleteImage(tmp);
}