2015-07-22 20:32:54 +02:00
|
|
|
#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H
|
|
|
|
#define INCLUDE_LIBIMG_LOAD_SKIN_H
|
|
|
|
|
|
|
|
#ifndef INCLUDE_LIBIMG_H
|
2017-10-05 00:59:57 +02:00
|
|
|
#include "../lib/obj/libimg.h"
|
2015-07-22 20:32:54 +02:00
|
|
|
#endif
|
|
|
|
|
2015-08-27 01:45:56 +02:00
|
|
|
:struct libimg_image {
|
2018-02-10 12:47:33 +01:00
|
|
|
dword image, w, h, imgsrc;
|
2015-08-27 01:45:56 +02:00
|
|
|
} skin;
|
2015-02-15 11:18:26 +01:00
|
|
|
|
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-18 20:52:40 +01:00
|
|
|
if (!image_pointer) notify("'Error: Image not loaded' -E");
|
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];
|
2018-02-10 12:47:33 +01:00
|
|
|
ESDWORD[struct_pointer+12] = ESDWORD[image_pointer+24];
|
2015-02-15 11:54:50 +01:00
|
|
|
}
|
|
|
|
|
2018-04-16 11:30:24 +02:00
|
|
|
:void Libimg_ReplaceColor(dword struct_pointer, w, h, old_color, new_color)
|
2015-02-15 11:54:50 +01:00
|
|
|
{
|
|
|
|
dword i, max_i, image_data;
|
|
|
|
image_data = ESDWORD[struct_pointer + 24];
|
|
|
|
max_i = w * h * 4 + image_data;
|
2018-04-16 11:30:24 +02:00
|
|
|
for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==old_color) DSDWORD[i] = new_color;
|
2015-07-22 20:32:54 +02:00
|
|
|
}
|
|
|
|
|
2018-04-16 11:30:24 +02:00
|
|
|
:void Libimg_FillTransparent(dword struct_pointer, w, h, new_color)
|
2017-10-05 23:38:09 +02:00
|
|
|
{
|
2018-04-16 11:30:24 +02:00
|
|
|
Libimg_ReplaceColor(struct_pointer, w, h, 0, new_color);
|
|
|
|
}
|
|
|
|
|
|
|
|
:libimg_image icons32draw;
|
|
|
|
:void DrawIcon32(dword x,y, bg, icon_n) {
|
|
|
|
//load_dll(libimg, #libimg_init,1);
|
|
|
|
if (!icons32draw.image) {
|
|
|
|
Libimg_LoadImage(#icons32draw, "/sys/icons32.png");
|
|
|
|
Libimg_FillTransparent(icons32draw.image, icons32draw.w, icons32draw.h, bg);
|
|
|
|
}
|
|
|
|
if (icon_n>=0) img_draw stdcall(icons32draw.image, x, y, 32, 32, 0, icon_n*32);
|
2017-10-05 23:38:09 +02:00
|
|
|
}
|
|
|
|
|
2015-07-22 20:32:54 +02:00
|
|
|
#endif
|