1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| .586
.model flat,STDCALL
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
.const
TRUE equ 1
FALSE equ 0
.data
len db ?
wid dd ?
heig dd ?
mult dd 1
handle dd ?
Message db "hdc: ",13,10,"dc2: ",0
bte db "papi",0
btt db "ok",0
r db 90000 dup (0);memoire du rouge
v db 90000 dup (0) ;"v
b db 90000 dup (0) ;"b
.code
DllEntry proc hInstDLL:HINSTANCE, reason:DWORD, reserved1:DWORD
mov eax,TRUE
ret
DllEntry Endp
Moyimage PROC my1:dword,my2:dword,Nim:word
;;;;j'ai qu'une quinzaine de jours en asm ; soyez tolerant
;my1 -> hdc de limage webcam
;my2 -> hdc de limage traitée
pushf
;pushad
mov len,16;nombre d'image
mov heig,150;hauteur image
mov wid,150;largeur image
mov ebx,90000;longueur memoire pour les 3 couleurs
;lit l'image de la webcam
lens:
hig:
widt:
invoke GetPixel,my1,wid,heig
push eax
push eax
and eax,000000ffh
add dword ptr [r+ebx],eax;add du rouge
pop eax
and eax,0000ff00h
shr eax,8
add dword ptr [v+ebx],eax;add v
pop eax
and eax,00ff0000h
shr eax,16
add dword ptr [b+ebx],eax;add b
dec ebx;dwor +4
dec ebx
dec ebx
dec ebx
dec wid
jnz widt
mov wid,150
dec heig
jnz hig
mov heig,150
;;;;;;;;attend la fin de balayage
mov dx,03dah
vbl_fin:
in al,dx
test al,08h
jnz vbl_fin
vbl_recom:
in al,dx
test al,08h
jz vbl_recom
;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;ICI !comment faire un event ?;;;;;;;;;;;;;;;;
mov ebx,90000
dec len
jnz lens
;fin des 16 images
xor eax,eax
mov heig,150
mov wid,150
mov ebx,90000
;écrit limage traitée
heig2:
wid2:
shr dword ptr [r+ebx],4;div par 16(image)
shr dword ptr [v+ebx],4
shr dword ptr [b+ebx],4
;coul du pixel dans eax
mov eax,dword ptr [r+ebx]
shl dword ptr [v+ebx],8
add eax,dword ptr [v+ebx]
shl dword ptr [b+ebx],16
add eax,dword ptr [b+ebx]
invoke SetPixel,my2,wid,heig,eax
mov dword ptr [r+ebx],0h;mise a 0 en hex de la memoire
mov dword ptr [v+ebx],0h;ne fonctionne pas en dec ?
mov dword ptr [b+ebx],0h
dec ebx
dec ebx
dec ebx
dec ebx
dec wid
jnz wid2
mov wid,150
dec heig
jnz heig2
;popad
popf
ret
Moyimage ENDP
End DllEntry |
Partager