first thanks for thoses who helped me with my MaxColor checking proc

now here's a proc i'll use in my project if i can fix the problems i have

1st assume src point to a picture pixels array (in mem)
assume dest point to the dest data array (in mem)
assume num is the len of the src in byte
assume src size is equal to dest size
assume cantbl is a byte array looking like that db color_code,color_code_replacement
assume the len of cantbl is 2*num2
assume num2 is the number of color for the replacement

now that i whant to do is to scan the src pic
check for each pixel the color code
compare to the cantabl|color_code] and if equal then wrote the cantbl index to the dest
and if it's not equal to any of the cantbl color_code then wrote 0 to the dest

so for the dest a 0 is non replace able color code else the index in the tabl for the replacement

please help me again and don't esitate to ask me some questions on my mail

and if it's not enough clear for you i can post the whole project .

here's my func but it's only putting 01 or 00 to dest

i attach a txt file describe the format of the layer file i'll produce and a layer for one of my pic

it can certainly help you


ProfileDatamap proc,src:dword,dest:dword,num:dword,cantbl:dword,num2:dword
.data
profiledatamapindex dd 0
.code
pusha
mov esi,src
mov edi,dest
mov ecx,num
xor eax,eax
ProfileDatamapBou:
lodsb
mov data1,eax
pusha
mov esi,cantbl
mov ecx,num2
mov ebx,data1
xor eax,eax
ProfileDatamapBou1:
lodsb
cmp eax,ebx
jne ProfileDatamapBou1R0
inc esi
jmp ProfileDatamapBou1R1
ProfileDatamapBou1R0:
mov eax,num2
sub eax,ecx
mov data2,eax
jmp ProfileDatamapBou1R3

ProfileDatamapBou1R1:
loop ProfileDatamapBou1
mov eax,0
mov data2,eax
ProfileDatamapBou1R3:
popa
mov eax,data2
stosb
loop ProfileDatamapBou
popa
ret
ProfileDatamap endp
Posted on 2002-11-11 17:20:57 by Thor0Asgard
Can your table cantbl be rearranged so that instead of interleaving it like color,replacement,color,replacement.., it is color,color,color....,replacement,replacement,replacement. In other words, the colors are together, followed by the replacements also together in the same order. If you do that, it would make the code much easier and simpler. Ratch
Posted on 2002-11-11 19:19:27 by Ratch
here's the whole code all the bitmap manipulation functions are into bitmap.dll (bitmap.asm)

so feel free to modify the code as you want the important thing matter to me is to fix that problem

thanks and go on
please help me
Posted on 2002-11-12 03:43:28 by Thor0Asgard
I am not going to plow through all the code you send me. I assume that I can change the tables a little. I changed the compare table format to be color,color,color,....,change, change,change.... . In other words, for each color entry, there is a twin change entry located in the same order, but at the end of the color entries. You should be getting the idea of how these programs can be coded. Notice that the code is much easier to read when the control instructions are indented. I am passing the code to you as an attachement. Hopefully, the spaces will not be compressed out like it seems to be in the messages. Ratch
Posted on 2002-11-12 13:54:27 by Ratch