Subversion Repositories Kolibri OS

Rev

Rev 7049 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7049 Rev 7054
1
#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H
1
#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H
2
#define INCLUDE_LIBIMG_LOAD_SKIN_H
2
#define INCLUDE_LIBIMG_LOAD_SKIN_H
3
 
3
 
4
#ifndef INCLUDE_LIBIMG_H
4
#ifndef INCLUDE_LIBIMG_H
5
#include "../lib/obj/libimg.h"
5
#include "../lib/obj/libimg.h"
6
#endif
6
#endif
7
 
7
 
8
:struct libimg_image {
8
:struct libimg_image {
9
	dword image, w, h;
9
	dword image, w, h;
10
} skin;
10
} skin;
11
 
11
 
12
:void Libimg_LoadImage(dword struct_pointer, file_path)
12
:void Libimg_LoadImage(dword struct_pointer, file_path)
13
{
13
{
14
	dword image_pointer;
14
	dword image_pointer;
15
	image_pointer = load_image(file_path);
15
	image_pointer = load_image(file_path);
16
	if (!image_pointer) notify("'Error: Image not loaded' -E");
16
	if (!image_pointer) notify("'Error: Image not loaded' -E");
17
	ESDWORD[struct_pointer] = image_pointer;
17
	ESDWORD[struct_pointer] = image_pointer;
18
	ESDWORD[struct_pointer+4] = DSWORD[image_pointer+4];
18
	ESDWORD[struct_pointer+4] = DSWORD[image_pointer+4];
19
	ESDWORD[struct_pointer+8] = DSWORD[image_pointer+8];
19
	ESDWORD[struct_pointer+8] = DSWORD[image_pointer+8];
20
}
20
}
21
 
21
 
22
:void Libimg_FillTransparent(dword struct_pointer, w, h, new_transparent_color)
22
:void Libimg_FillTransparent(dword struct_pointer, w, h, new_transparent_color)
23
{
23
{
24
	dword i, max_i, image_data;
24
	dword i, max_i, image_data;
25
	image_data = ESDWORD[struct_pointer + 24];
25
	image_data = ESDWORD[struct_pointer + 24];
26
	max_i =  w * h * 4 + image_data;
26
	max_i =  w * h * 4 + image_data;
27
	for (i = image_data; i < max_i; i += 4)	if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color;
27
	for (i = image_data; i < max_i; i += 4)	if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color;
28
}
28
}
-
 
29
 
-
 
30
:void Libimg_ReplaceColor(dword struct_pointer, w, h, old_color, new_color)
-
 
31
{
-
 
32
	dword i, max_i, image_data;
-
 
33
	image_data = ESDWORD[struct_pointer + 24];
-
 
34
	max_i =  w * h * 4 + image_data;
-
 
35
	for (i = image_data; i < max_i; i += 4)	if (DSDWORD[i]==old_color) DSDWORD[i] = new_color;
-
 
36
}
29
 
37
 
30
#endif
38
#endif