kolibrios/programs/develop/libraries/box_lib/C--/lib/load_bmp.h--
Alexey Teplov ( 5b18f6aea9 bugfix Num,Caps,Scroll Lock & remove in dir libraries
git-svn-id: svn://kolibrios.org@1032 a494cfbc-eb01-0410-851d-a64ba20cac60
2009-02-13 09:04:33 +00:00

68 lines
1.2 KiB
Plaintext

//Load BMP by Veliant
struct readimage{
dword func, param1, param2, size, buffer;
byte z;
dword name;
};
void Put_Image(dword x,y,w,h,name)
{
int i, j, size, off, off2;
byte r, g, b;
readimage image;
dword buf;
size=w*h*3+100;
buf=malloc(size);
image.func = 0;
image.param1 = 0;
image.param2 = 0;
image.size = size;
image.buffer = buf;
image.z = 0;
image.name = #path;
EAX = 70;
EBX = #image;
$int 0x40;
for(i=0;i<h;i++)
for (j=0;j<w/2;j++)
{
off=w*3*i+buf+0x36;
off2=w-j*3+off;
off=j*3+off;
r=ESBYTE[off2-3];
g=ESBYTE[off2-2];
b=ESBYTE[off2-1];
ESBYTE[off2-3]=ESBYTE[off];
ESBYTE[off2-2]=ESBYTE[off+1];
ESBYTE[off2-1]=ESBYTE[off+2];
ESBYTE[off]=r;
ESBYTE[off+1]=g;
ESBYTE[off+2]=b;
}
size=w*h;
for(i=0;i<size/2;i++)
{
off=buf+0x36;
off2=size-i*3+off;
off=i*3+off;
r=ESBYTE[off2-3];
g=ESBYTE[off2-2];
b=ESBYTE[off2-1];
ESBYTE[off2-3]=ESBYTE[off];
ESBYTE[off2-2]=ESBYTE[off+1];
ESBYTE[off2-1]=ESBYTE[off+2];
ESBYTE[off]=r;
ESBYTE[off+1]=g;
ESBYTE[off+2]=b;
}
EAX = 7;
EBX = buf+0x36;
ECX = w<<16+h;
EDX = x<<16+y+skin_width;
$int 0x40
}