Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
255 heavyiron 1
;-----------------------------------------------------------
2
;-------analizing picture to palette------------------------
3
;-----------------------------------------------------------
4
analizing_picture_to_palette:
5
 
6
	 mov eax,[Picture_SizeX]
7
	 mov ebx,[Picture_SizeY]
8
	 imul eax,ebx
9
	 mov ecx,eax
10
	 mov edx,[PointerToPicture]
11
	 mov esi,1 ;counter colors in palette
12
 
13
	 ;put firs color of picture how one color in palette
14
	 mov ebp,[PointerToPalette]
15
	 mov eax,[edx]
16
	 and eax,0xffffff
17
	 mov [ebp],eax
18
 
19
	 analizing_to_palette:
20
	 mov eax,[edx]
21
	 and eax,0xffffff
22
 
23
	 mov edi,esi
24
	 mov ebp,[PointerToPalette]
25
	 next_color_in_palette:
26
	 mov ebx,[ebp]
27
	 and ebx,0xffffff
28
	 cmp ebx,eax	     ;this is color have in palette
29
	 je exit_loop_palette
30
	 add ebp,4
31
	 dec edi
32
	 jnz next_color_in_palette
33
 
34
	 inc esi
35
	 cmp esi,256 ;256 colors
36
	 ja more_than_256_colors
37
	 mov ebp,[PointerToPalette]
38
	 mov ebx,esi
39
	 dec ebx
40
	 shl ebx,2
41
	 add ebp,ebx
42
	 mov [ebp],ax
43
	 shr eax,16
44
	 mov [ebp+2],al
45
 
46
	 exit_loop_palette:
47
 
48
	 add edx,3
49
	 dec ecx
50
	 jnz analizing_to_palette
51
 
52
 
53
	 more_than_256_colors:
54
	 mov eax,esi
55
 
56
	 ret