2015-02-15 11:18:26 +01:00
|
|
|
struct libimg_image {
|
|
|
|
dword image, w, h;
|
|
|
|
};
|
|
|
|
|
2015-02-15 11:54:50 +01:00
|
|
|
:void Libimg_LoadImage(dword struct_pointer, file_path)
|
2015-02-15 11:18:26 +01:00
|
|
|
{
|
2015-02-15 11:54:50 +01:00
|
|
|
dword image_pointer;
|
2015-02-15 11:18:26 +01:00
|
|
|
image_pointer = load_image(file_path);
|
2015-02-15 11:54:50 +01:00
|
|
|
if (!image_pointer) notify("Error: Image not loaded");
|
2015-02-15 11:18:26 +01:00
|
|
|
ESDWORD[struct_pointer] = image_pointer;
|
|
|
|
ESDWORD[struct_pointer+4] = DSWORD[image_pointer+4];
|
|
|
|
ESDWORD[struct_pointer+8] = DSWORD[image_pointer+8];
|
2015-02-15 11:54:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
:void Libimg_FillTransparent(dword struct_pointer, w, h, new_transparent_color)
|
|
|
|
{
|
|
|
|
dword i, max_i, image_data;
|
|
|
|
image_data = ESDWORD[struct_pointer + 24];
|
|
|
|
max_i = w * h * 4 + image_data;
|
|
|
|
for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color;
|
2015-02-15 11:18:26 +01:00
|
|
|
}
|