FilterFactory - Function "src"

Back to function listing

Channel z for the pixel at coordinates x,y

Syntax

src(x,y,z)

Synonyms

src0
src1

Original Machine Code (in OPER resource) of Filter Factory 3.0 and 3.0.4 for Photoshop/Win32

(1) Calculated memory area:

Pixel(param_x,param_y,param_z) =
CANVAS <-- pointer to the canvas data
+ (param_z - zmin)
+ (param_y - ymin)*ROW_SIZE <-- ROW_SIZE ?= (X-xmin) * (Z-zmin)
+ (param_x - xmin)*(Z-zmin)

Note: If values get out of bound, the border-pixels will be choosen.

5A pop edx (param_z) .
59 pop ecx (param_y) .
5B pop ebx (param_x) .
3B 57 5C cmp edx,[edi+$5c] (zmin) .
7C 53 jl +$53 (@@5) if (param_z < zmin) goto @@5; // return 0
3B 57 60 cmp edx,[edi+$60] (Z) .
7D 4E jnl +$4e (@@5) if (param_z >= Z) goto @@5; // return 0
8B 77 44 mov esi,[edi+$44] (xmin) .
3B DE cmp ebx,esi .
7D 02 jnl +$02 (@@1) if (param_x >= xmin) goto @@1;
8B DE mov ebx,esi param_x = xmin; // correcting value
@@1: @@1: // param_x >= xmin
8B 47 48 mov eax,[edi+$48] (X) .
3B D8 cmp ebx,eax .
7C 03 jl +$03 (@@2) if (param_x < X) goto @@2;
8D 58 FF lea ebx,[eax-$01 (1)] param_x = X-1; // correcting value
@@2: @@2: // param_x < X
8B 47 50 mov eax,[edi+$50] (ymin) .
3B C8 cmp ecx,eax .
7D 02 jnl +$02 (@@3) if (param_y >= ymin) goto @@3;
8B C8 mov ecx,eax param_y = ymin; // correcting value
@@3: @@3: // param_y >= ymin
8B 47 54 mov eax,[edi+$54] (Y) .
3B C8 cmp ecx,eax .
7C 03 jl +$03 (@@4) if (param_y < Y) goto @@4;
8D 48 FF lea ecx,[eax-$01 (1)] param_y = Y-1; // correcting value
@@4: @@4: // param_y < Y
8B 87 A8 45 00 00 mov eax,[edi+$000045a8] (CANVAS) res = CANVAS;
2B 57 5C sub edx,[edi+$5c] (zmin) param_z -= zmin;
03 C2 add eax,edx res += param_z;
2B 4F 50 sub ecx,[edi+$50] (ymin) param_y -= ymin;
0F AF 8F A0 45 00 00 imul ecx,[edi+$000045a0] (ROW_SIZE) param_y *= ROW_SIZE;
03 C1 add eax,ecx res += param_y;
2B DE sub ebx,esi param_x -= xmin;
8B 57 60 mov edx,[edi+$60] (Z) param_z = Z;
2B 57 5C sub edx,[edi+$5c] (zmin) param_z -= zmin;
0F AF DA imul ebx,edx param_x *= param_z;
0F B6 04 18 movzx eax,[eax+ebx] res = (res + param_x)*; // (1)
EB 02 jmp +$02 (@@6) goto @@6;
@@5: @@5:
2B C0 sub eax,eax res = 0;
@@6: @@6:
50 push eax return res;

Differences in the 3.00a (beta version) Windows implementation

src(x,y,z) usesd the input rectangle (top,left,bottom,right) instead of the canvas dimensions (ymin,xmin,ymax,xmax) in the beta version 3.00a.

Version 3.00a (beta version) Version 3.00b (internal build), 3.00 (final), and 3.0.4
pop edx ; param_z
pop ecx ; param_y
pop ebx ; param_x
cmp edx,DWORD PTR [edi+0x5c] ; zmin
jl @@5
cmp edx,DWORD PTR [edi+0x60] ; Z
jge @@5
mov esi,DWORD PTR [edi+0x84] ; inRectLeft
cmp ebx,esi
jge @@x1
mov ebx,esi
@@x1:
mov eax,DWORD PTR [edi+0x8c] ; inRectRight
cmp ebx,eax
jl @@x2
lea ebx,[eax-0x1]
@@x2:
mov eax,DWORD PTR [edi+0x88] ; inRectTop
cmp ecx,eax
jge @@x3
mov ecx,eax
@@x3:
mov eax,DWORD PTR [edi+0x90] ; inRectBottom
cmp ecx,eax
jl @@x4
lea ecx,[eax-0x1]
@@x4:
mov eax,DWORD PTR [edi+0x45a8] ; *CANVAS
sub edx,DWORD PTR [edi+0x5c] ; zmin
add eax,edx
sub ecx,DWORD PTR [edi+0x88] ; inRectTop
imul ecx,DWORD PTR [edi+0x45a0] ; ROW_SIZE
add eax,ecx
sub ebx,esi
mov edx,DWORD PTR [edi+0x60] ; Z
sub edx,DWORD PTR [edi+0x5c] ; zmin
imul ebx,edx
movzx eax,BYTE PTR [eax+ebx*1]
jmp @@6
@@5:
sub eax,eax
@@6:
push eax 
pop edx ; param_z
pop ecx ; param_y
pop ebx ; param_x
cmp edx,DWORD PTR [edi+0x5c] ; zmin
jl @@5
cmp edx,DWORD PTR [edi+0x60] ; Z
jge @@5
mov esi,DWORD PTR [edi+0x44] ; xmin
cmp ebx,esi
jge @@x1
mov ebx,esi
@@x1:
mov eax,DWORD PTR [edi+0x48] ; X
cmp ebx,eax
jl @@x2
lea ebx,[eax-0x1]
@@x2:
mov eax,DWORD PTR [edi+0x50] ; ymin
cmp ecx,eax
jge @@x3
mov ecx,eax
@@x3:
mov eax,DWORD PTR [edi+0x54] ; Y
cmp ecx,eax
jl @@x4
lea ecx,[eax-0x1]
@@x4:
mov eax,DWORD PTR [edi+0x45a8] ; *CANVAS
sub edx,DWORD PTR [edi+0x5c] ; zmin
add eax,edx
sub ecx,DWORD PTR [edi+0x50] ; ymin
imul ecx,DWORD PTR [edi+0x45a0] ; ROW_SIZE
add eax,ecx
sub ebx,esi
mov edx,DWORD PTR [edi+0x60] ; Z
sub edx,DWORD PTR [edi+0x5c] ; zmin
imul ebx,edx
movzx eax,BYTE PTR [eax+ebx*1]
jmp @@6
@@5:
sub eax,eax
@@6:
push eax