Subversion Repositories Kolibri OS

Rev

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