CRIMP
Changes On Branch infinite-plane
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch infinite-plane Excluding Merge-Ins

This is equivalent to a diff from 7f6910b5a1 to 518fed782b

2012-05-31
17:51
Branch "infinite-plane" completed, merged back to main. This is now version 0.2, although some more development may happen before its tagged and bagged. check-in: eec1625aca user: andreask tags: trunk
17:47
Undone the parts of [36a89e6461] changing the buffer API. Going back to int's, adapting all users for the same, and putting a compile-time-assert in place to check that its sizeof(int) is good enough (>= 4). Which should be true on most machines this will get compiled on. Small embedded system where this is most likely violated (i.e. int == short) are not a target for crimp anyway. Closed-Leaf check-in: 518fed782b user: andreask tags: infinite-plane
2012-05-30
23:07
Casts added and tweaks made to reduce number of warnings. check-in: 36a89e6461 user: andreask tags: infinite-plane
21:52
Merged trunk to infinite-plane, brought the changes into line with new macros and structure. Added missing binary operators. check-in: 529bbc9938 user: andreask tags: infinite-plane
2012-05-23
18:12
Updated install guide to include the crimp's tcllib/tklib dependencies. Regenerated embedded documentation. check-in: 7f6910b5a1 user: andreask tags: trunk
2012-03-22
17:29
Extended the set of scale operators to the greyN types, and exposed them through a new public method (crimp scale). Updated documentation. Regenerated embedded documentation. Tweaked the output generated by critcl a bit (feedback while reading .crimp files). check-in: 89cea61f4a user: andreask tags: trunk

Changes to c/buffer.c.
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
    if (n < 0) {
	n = strlen (str);
    }

    CRIMP_ASSERT_BOUNDS (n,(buf->sentinel - buf->here));

    if (strncmp(buf->here, (unsigned char*) str, n) != 0) {
	return 0;
    }

    buf->here += n;
    return 1;
}








|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
    if (n < 0) {
	n = strlen (str);
    }

    CRIMP_ASSERT_BOUNDS (n,(buf->sentinel - buf->here));

    if (strncmp((char*) buf->here, str, n) != 0) {
	return 0;
    }

    buf->here += n;
    return 1;
}

Changes to c/buffer.h.
15
16
17
18
19
20
21









22
23
24
25
26
27
28
    unsigned char* buf;      /* Start of data */
    unsigned char* here;     /* Current byte, read location */
    unsigned char* sentinel; /* End of buffer, behind last byte */
    int            length;   /* Size of buffer, sentinel - buf */
} crimp_buffer;

#define crimp_buf_at(b) ((b)->here)










/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:







>
>
>
>
>
>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    unsigned char* buf;      /* Start of data */
    unsigned char* here;     /* Current byte, read location */
    unsigned char* sentinel; /* End of buffer, behind last byte */
    int            length;   /* Size of buffer, sentinel - buf */
} crimp_buffer;

#define crimp_buf_at(b) ((b)->here)

/*
 * BUILD ASSERTION: The buffer API assumes that a variable of type 'int' can
 * hold (at least) 4 bytes (See the crimp_read_*int32* functions).  Failure in
 * the line below tells us that this is not true for the chosen combination of
 * OS, compiler, and compiler flags.
 */

CRIMP_BUILD_ASSERT (sizeof(int) >= 4);

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
Changes to c/common.h.
1
2
3
4
5














6
7
8
9
10
11
12
#ifndef CRIMP_COMMON_H
#define CRIMP_COMMON_H
/*
 * CRIMP :: Common Declarations :: PUBLIC
 * (C) 2011.














 */

#define CRIMP_RANGEOK(i,n) ((0 <= (i)) && (i < (n)))

/*
 * Convenient checking of image types.
 */




|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
#ifndef CRIMP_COMMON_H
#define CRIMP_COMMON_H
/*
 * CRIMP :: Common Declarations :: PUBLIC
 * (C) 2011-2012.
 */

/*
 * Support compile time assertions. While mostly intended for type size
 * checks, all C expressions are allowed.
 */
 
#define CRIMP_BUILD_ASSERT(expr)       typedef char CRIMP_BA_UNIQUE_NAME [(expr)?1:-1]
#define CRIMP_BA_UNIQUE_NAME           CRIMP_BA_MAKE_NAME(__LINE__)
#define CRIMP_BA_MAKE_NAME(line)       CRIMP_BA_MAKE_NAME2(line)
#define CRIMP_BA_MAKE_NAME2(line)      __crimp_build_assert_ ## line

/*
 * Checking of 0-based ranges.
 */

#define CRIMP_RANGEOK(i,n) ((0 <= (i)) && (i < (n)))

/*
 * Convenient checking of image types.
 */
Changes to c/gauss.c.
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
    switch(filterPtr->type) {
    case GFT_FIR:
	FIRDestroyFilterSet(&filterPtr->filters.fir);
	break;
    default: 
	break;
    }
    ckfree(filterPtr);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianFilter01 --
 *







|







283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
    switch(filterPtr->type) {
    case GFT_FIR:
	FIRDestroyFilterSet(&filterPtr->filters.fir);
	break;
    default: 
	break;
    }
    ckfree((char*)filterPtr);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianFilter01 --
 *
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage = ckalloc(area * sizeof(float));

    /* 
     * Filter first the rows and then the columns.
     */

    GaussianFilter01(filterPtr, 0, height, width, inputImage, tempImage);
    GaussianFilter10(filterPtr, 0, height, width, tempImage, outputImage);

    ckfree(tempImage);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianGradientX2D --
 *







|








|







387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage = (float*) ckalloc(area * sizeof(float));

    /* 
     * Filter first the rows and then the columns.
     */

    GaussianFilter01(filterPtr, 0, height, width, inputImage, tempImage);
    GaussianFilter10(filterPtr, 0, height, width, tempImage, outputImage);

    ckfree((char*)tempImage);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianGradientX2D --
 *
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage = ckalloc(area * sizeof(float));
    int i;

    /* 
     * Derivative-filter the rows.
     */

    GaussianFilter01(filterPtr, 1, height, width, inputImage, tempImage);

    /*
     * Gaussian-filter the columns
     */

    GaussianFilter10(filterPtr, 0, height, width, tempImage, outputImage);

    ckfree(tempImage);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianGradientY2D --
 *







|














|







429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage = (float*) ckalloc(area * sizeof(float));
    int i;

    /* 
     * Derivative-filter the rows.
     */

    GaussianFilter01(filterPtr, 1, height, width, inputImage, tempImage);

    /*
     * Gaussian-filter the columns
     */

    GaussianFilter10(filterPtr, 0, height, width, tempImage, outputImage);

    ckfree((char*)tempImage);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianGradientY2D --
 *
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage = ckalloc(area * sizeof(float));
    int i;

    /* 
     * Gaussian-filter the rows.
     */

    GaussianFilter01(filterPtr, 0, height, width, inputImage, tempImage);

    /*
     * Derivative-filter the columns
     */

    GaussianFilter10(filterPtr, 1, height, width, tempImage, outputImage);

    ckfree(tempImage);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianGradientMagnitude2D --
 *







|














|







477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage = (float*) ckalloc(area * sizeof(float));
    int i;

    /* 
     * Gaussian-filter the rows.
     */

    GaussianFilter01(filterPtr, 0, height, width, inputImage, tempImage);

    /*
     * Derivative-filter the columns
     */

    GaussianFilter10(filterPtr, 1, height, width, tempImage, outputImage);

    ckfree((char*)tempImage);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianGradientMagnitude2D --
 *
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int i;
    int area = height * width;
    float* tempImageX = ckalloc(area * sizeof(float));

    GaussianGradientX2D(filterPtr, height, width, inputImage, tempImageX);
    GaussianGradientY2D(filterPtr, height, width, inputImage, outputImage);
    for (i = 0; i < area; ++i) {
	outputImage[i] = hypotf(tempImageX[i], outputImage[i]);
    }
    ckfree(tempImageX);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianLaplacian2D --
 *







|






|







526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int i;
    int area = height * width;
    float* tempImageX = (float*) ckalloc(area * sizeof(float));

    GaussianGradientX2D(filterPtr, height, width, inputImage, tempImageX);
    GaussianGradientY2D(filterPtr, height, width, inputImage, outputImage);
    for (i = 0; i < area; ++i) {
	outputImage[i] = hypotf(tempImageX[i], outputImage[i]);
    }
    ckfree((char*)tempImageX);
}

/*
 *-----------------------------------------------------------------------------
 *
 * GaussianLaplacian2D --
 *
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage1 = ckalloc(area * sizeof(float));
    float* tempImage2 = ckalloc(area * sizeof(float));
    int i;

    /* Gaussian filter by rows */

    GaussianFilter01(filterPtr, 0, height, width, inputImage, tempImage1);

    /* Second-derivative-filter by columns */







|
|







565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
    int width,			/* Width of the images */
    float* inputImage,		/* Input image: (height x width) array of
				 * float's, row-major order */
    float* outputImage		/* Output image: (height x width) array of
				 * float's, row-major order */
) {
    int area = height * width;
    float* tempImage1 = (float*) ckalloc(area * sizeof(float));
    float* tempImage2 = (float*) ckalloc(area * sizeof(float));
    int i;

    /* Gaussian filter by rows */

    GaussianFilter01(filterPtr, 0, height, width, inputImage, tempImage1);

    /* Second-derivative-filter by columns */
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607

    /* Sum the two results */

    for (i = 0; i < area; ++i) {
	outputImage[i] += tempImage2[i];
    }

    ckfree(tempImage1);
    ckfree(tempImage2);
}

/*
 *-----------------------------------------------------------------------------
 *
 * FIRInitFilterSet --
 *







|
|







592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607

    /* Sum the two results */

    for (i = 0; i < area; ++i) {
	outputImage[i] += tempImage2[i];
    }

    ckfree((char*)tempImage1);
    ckfree((char*)tempImage2);
}

/*
 *-----------------------------------------------------------------------------
 *
 * FIRInitFilterSet --
 *
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
    for (i = 0; i < 3; ++i) {
	filterPtr->coefs[i].n0 /= s[i];
	filterPtr->coefs[i].n1 /= s[i];
	filterPtr->coefs[i].n2 /= s[i];
	filterPtr->coefs[i].n3 /= s[i];
    }

    ckfree(y2);
    ckfree(y1);
    ckfree(y0);
    ckfree(x);
}

/*
 *-----------------------------------------------------------------------------
 *
 * DericheApply --
 *







|
|
|
|







981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
    for (i = 0; i < 3; ++i) {
	filterPtr->coefs[i].n0 /= s[i];
	filterPtr->coefs[i].n1 /= s[i];
	filterPtr->coefs[i].n2 /= s[i];
	filterPtr->coefs[i].n3 /= s[i];
    }

    ckfree((char*)y2);
    ckfree((char*)y1);
    ckfree((char*)y0);
    ckfree((char*)x);
}

/*
 *-----------------------------------------------------------------------------
 *
 * DericheApply --
 *
Changes to c/geometry.c.
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
}

crimp_image*
crimp_geo_warp_init (crimp_image* input, crimp_image* forward, int* origx, int* origy)
{
    /*
     * Run the four corners of the input through the forward transformation to
     * get their locations, and use the results to determine dimensions of the
     * output image and the location of its origin point.
     *
     * NOTE: The input image may already come with origin point data. We have
     * to and are taking this into account when computing the input corners.
     */


    double xlu, xru, xld, xrd, left, right;
    double ylu, yru, yld, yrd, up, down;
    int ileft, iright, iup, idown, w, h, iorigx, iorigy, oc = 0;
    Tcl_Obj* meta;
    Tcl_Obj* key1 = Tcl_NewStringObj ("crimp", -1);
    Tcl_Obj* key2 = Tcl_NewStringObj ("origin", -1);
    Tcl_Obj* cmeta = NULL;
    Tcl_Obj* corig = NULL;
    Tcl_Obj* orig [2] = {NULL, NULL};

    if (!input->meta ||	(Tcl_DictObjGet(NULL, input->meta, key1, &cmeta) != TCL_OK) ||
	!cmeta       ||	(Tcl_DictObjGet(NULL, cmeta, key2, &corig)       != TCL_OK) ||
	!corig       || (Tcl_ListObjGetElements(NULL, corig, &oc, &orig) != TCL_OK) ||
	!orig[0]     || (Tcl_GetIntFromObj(NULL,orig[0], &iorigx)        != TCL_OK) ||
	!orig[1]     || (Tcl_GetIntFromObj(NULL,orig[1], &iorigy)        != TCL_OK)) {
	iorigx = iorigy = 0;
    }

    xlu = - iorigx;
    ylu = - iorigy;
    crimp_geo_warp_point (forward, &xlu, &ylu);

    xru = - iorigx + input->w - 1;
    yru = - iorigy;
    crimp_geo_warp_point (forward, &xru, &yru);

    xld = - iorigx;
    yld = - iorigy + input->h - 1;
    crimp_geo_warp_point (forward, &xld, &yld);

    xrd = - iorigx + input->w - 1;
    yrd = - iorigy + input->h - 1;
    crimp_geo_warp_point (forward, &xrd, &yrd);

    left  = MIN (MIN (xlu,xld), MIN (xru,xrd));
    right = MAX (MAX (xlu,xld), MAX (xru,xrd));
    up    = MIN (MIN (ylu,yld), MIN (yru,yrd));
    down  = MAX (MAX (ylu,yld), MAX (yru,yrd));

    ileft  = left;  if (ileft  > left)  ileft --;
    iright = right; if (iright < right) iright ++;
    iup    = up;    if (iup    > up)    iup --;
    idown  = down;  if (idown  < down)  idown ++;

    w = iright - ileft + 1;
    h = idown  - iup   + 1;

    *origx = ileft;
    *origy = iup;

    orig [0] = Tcl_NewIntObj (ileft);
    orig [1] = Tcl_NewIntObj (iup);

    corig = Tcl_NewListObj (2, orig);










    cmeta = Tcl_NewDictObj (); Tcl_DictObjPut (NULL, cmeta, key2, corig);




    meta  = Tcl_NewDictObj (); Tcl_DictObjPut (NULL, meta,  key1, cmeta);




    return crimp_newm (input->itype, w, h, meta);



}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */







|
|

|
|


>



<
<
<
<
<
<

<
<
<
|
<
|
<





|




|


|
|


















|
|
|
|
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>

|
>
>
>









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
}

crimp_image*
crimp_geo_warp_init (crimp_image* input, crimp_image* forward, int* origx, int* origy)
{
    /*
     * Run the four corners of the input through the forward transformation to
     * get their locations, and use the results to determine geometry of the
     * output image, i.e. dimensions and location of its origin point.
     *
     * NOTE: We have to take the origin of the input image into account when
     * computing the input corners.
     */

    crimp_image* result;
    double xlu, xru, xld, xrd, left, right;
    double ylu, yru, yld, yrd, up, down;
    int ileft, iright, iup, idown, w, h, iorigx, iorigy, oc = 0;










    iorigx = crimp_x (input);

    iorigy = crimp_y (input);


    xlu = - iorigx;
    ylu = - iorigy;
    crimp_geo_warp_point (forward, &xlu, &ylu);

    xru = - iorigx + crimp_w(input) - 1;
    yru = - iorigy;
    crimp_geo_warp_point (forward, &xru, &yru);

    xld = - iorigx;
    yld = - iorigy + crimp_h(input);
    crimp_geo_warp_point (forward, &xld, &yld);

    xrd = - iorigx + crimp_w(input) - 1;
    yrd = - iorigy + crimp_h(input) - 1;
    crimp_geo_warp_point (forward, &xrd, &yrd);

    left  = MIN (MIN (xlu,xld), MIN (xru,xrd));
    right = MAX (MAX (xlu,xld), MAX (xru,xrd));
    up    = MIN (MIN (ylu,yld), MIN (yru,yrd));
    down  = MAX (MAX (ylu,yld), MAX (yru,yrd));

    ileft  = left;  if (ileft  > left)  ileft --;
    iright = right; if (iright < right) iright ++;
    iup    = up;    if (iup    > up)    iup --;
    idown  = down;  if (idown  < down)  idown ++;

    w = iright - ileft + 1;
    h = idown  - iup   + 1;

    *origx = ileft;
    *origy = iup;

    result = crimp_new_at (input->itype, ileft, iup, w, h);
    return result;
}

extern void
crimp_rect_union (const crimp_geometry* a,
		  const crimp_geometry* b,
		  crimp_geometry* result)
{
    /*
     * Compute the bounding box first, as min and max of the individual
     * boundaries. The max values are one too high, which is canceled
     * when computing the dimensions.
     */

    int minx = MIN (a->x, b->x);
    int miny = MIN (a->y, b->y);
    int maxx = MAX (a->x + a->w, b->x + b->w);
    int maxy = MAX (a->y + a->h, b->y + b->h);

    /*
     * And convert back into a plain geometry with location dimensions.
     */

    result->x = minx;
    result->y = miny;
    result->w = maxx - minx;
    result->h = maxy - miny;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to c/geometry.h.
12
13
14
15
16
17
18





19
20
21
22
23
24
25
 * API :: Core. 
 */

extern void         crimp_geo_warp_point (crimp_image* matrix, double* x, double* y);
extern crimp_image* crimp_geo_warp_init  (crimp_image* input,
					  crimp_image* forward,
					  int* origx, int* origy);






/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:







>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 * API :: Core. 
 */

extern void         crimp_geo_warp_point (crimp_image* matrix, double* x, double* y);
extern crimp_image* crimp_geo_warp_init  (crimp_image* input,
					  crimp_image* forward,
					  int* origx, int* origy);

extern void crimp_rect_union (const crimp_geometry* a,
			      const crimp_geometry* b,
			      crimp_geometry* result);


/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
Changes to c/image.c.
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
};

/*
 * Definitions :: Core.
 */

crimp_image*
crimp_new (const crimp_imagetype* itype, int w, int h)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t       size  = sizeof (crimp_image) + CRIMP_RECT_AREA (w, h) * itype->size;
    crimp_image* image = (crimp_image*) ckalloc (size);

    image->itype = itype;

    image->w     = w;
    image->h     = h;




    image->meta  = NULL;

    return image;
}

crimp_image*
crimp_newm (const crimp_imagetype* itype, int w, int h, Tcl_Obj* meta)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t       size  = sizeof (crimp_image) + CRIMP_RECT_AREA (w, h) * itype->size;
    crimp_image* image = (crimp_image*) ckalloc (size);

    image->itype = itype;

    image->w     = w;
    image->h     = h;




    image->meta  = meta;

    if (meta) {
	Tcl_IncrRefCount (meta);
    }

    return image;







|









>
|
|
>
>
>
>






|









>
|
|
>
>
>
>







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
};

/*
 * Definitions :: Core.
 */

crimp_image*
crimp_new_at (const crimp_imagetype* itype, int x, int y, int w, int h)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t       size  = sizeof (crimp_image) + CRIMP_RECT_AREA (w, h) * itype->size;
    crimp_image* image = (crimp_image*) ckalloc (size);

    image->itype = itype;

    image->geo.x = x;
    image->geo.y = y;

    image->geo.w = w;
    image->geo.h = h;

    image->meta  = NULL;

    return image;
}

crimp_image*
crimp_newm_at (const crimp_imagetype* itype, int x, int y, int w, int h, Tcl_Obj* meta)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t       size  = sizeof (crimp_image) + CRIMP_RECT_AREA (w, h) * itype->size;
    crimp_image* image = (crimp_image*) ckalloc (size);

    image->itype = itype;

    image->geo.x = x;
    image->geo.y = y;

    image->geo.w = w;
    image->geo.h = h;

    image->meta  = meta;

    if (meta) {
	Tcl_IncrRefCount (meta);
    }

    return image;
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185

    /* image type */
    Tcl_DStringAppendElement (&ds, ci->itype->name);

    /* image width */
    {
	char wstring [20];
	sprintf (wstring, "%u", ci->w);
	Tcl_DStringAppendElement (&ds, wstring);
    }

    /* image width */
    {
	char hstring [20];
	sprintf (hstring, "%u", ci->h);
	Tcl_DStringAppendElement (&ds, hstring);
    }

    /* image client data */
    if (ci->meta) {
	Tcl_DStringAppendElement (&ds, Tcl_GetString (ci->meta));
    } else {







|






|







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

    /* image type */
    Tcl_DStringAppendElement (&ds, ci->itype->name);

    /* image width */
    {
	char wstring [20];
	sprintf (wstring, "%u", ci->geo.w);
	Tcl_DStringAppendElement (&ds, wstring);
    }

    /* image width */
    {
	char hstring [20];
	sprintf (hstring, "%u", ci->geo.h);
	Tcl_DStringAppendElement (&ds, hstring);
    }

    /* image client data */
    if (ci->meta) {
	Tcl_DStringAppendElement (&ds, Tcl_GetString (ci->meta));
    } else {
Changes to c/image.h.
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
130
131
132
133
134
135
136
137
138
139









140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155



156

157


158






159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#ifndef CRIMP_IMAGE_H
#define CRIMP_IMAGE_H
/*
 * CRIMP :: Image Declarations, and API :: PUBLIC
 * (C) 2010 - 2011
 */

#include "common.h"
#include "image_type.h"

/*
 * Structures describing images.




 */

typedef unsigned char* crimp_pixel_array;








typedef struct crimp_image {
    Tcl_Obj*               meta;     /* Tcl level client data */
    const crimp_imagetype* itype;    /* Reference to type descriptor */
    int                    w;        /* Image dimension, width  */
    int                    h;        /* Image dimension, height */
    unsigned char          pixel[4]; /* Integrated pixel storage */
} crimp_image;

/*
 * Pixel Access Macros. General access to a 'color' channel.
 */

#define CRIMP_CHAN(iptr,c,x,y) ((c) + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))
#define CH(iptr,c,x,y)   (iptr)->pixel [CRIMP_CHAN (iptr,c,x,y)]

/*
 * Pixel Access Macros. RGBA / RGB
 */

/*
 * Manually optimized, factored the pixelsize out of the summands. It
 * is not sure if this is faster (easier to optimize), or if we should
 * precompute the pitch (w*pixelsize), and have the pixel size mult
 * in each x ... As the pixel size is mostly 1, 2, 4, i.e. redundant
 * removed unity, or a power of 2, i.e handled as shift this should be
 * good enough. The only not so sure case is RGB, with pixel size of 3.
 */

#define SZ(iptr) ((iptr)->itype->size)

#define RED(iptr,x,y)   (0 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))
#define GREEN(iptr,x,y) (1 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))
#define BLUE(iptr,x,y)  (2 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))
#define ALPHA(iptr,x,y) (3 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))

#if 0 /* Unoptimized formulas */
#define RED(iptr,x,y)   (0 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->w)))
#define GREEN(iptr,x,y) (1 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->w)))
#define BLUE(iptr,x,y)  (2 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->w)))
#define ALPHA(iptr,x,y) (3 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->w)))
#endif

#define R(iptr,x,y) (iptr)->pixel [RED   (iptr,x,y)]
#define G(iptr,x,y) (iptr)->pixel [GREEN (iptr,x,y)]
#define B(iptr,x,y) (iptr)->pixel [BLUE  (iptr,x,y)]
#define A(iptr,x,y) (iptr)->pixel [ALPHA (iptr,x,y)]

/*
 * Pixel Access Macros. GREY8, GREY16, GREY32, FLOATP.
 *
 * NOTE: The casts should use standard types where we we know the size in
 *       bytes exactly, by definition.
 */

#define CRIMP_INDEX(iptr,x,y) \
    (((x)*SZ (iptr)) + \
     ((y)*SZ (iptr)*(((size_t) (iptr)->w))))

#define GREY8(iptr,x,y)  *((unsigned char*)  &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))
#define GREY16(iptr,x,y) *((unsigned short*) &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))
#define GREY32(iptr,x,y) *((unsigned int* )  &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))
#define FLOATP(iptr,x,y) *((float*)          &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))

/*
 * Pixel as 2-complement numbers (-128..127, instead of unsigned 0..255).
 */

#define SGREY8(iptr,x,y) *((signed char*)  &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))

/*
 * Pixel Access Macros. HSV.
 */

#define HUE(iptr,x,y) (0 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))
#define SAT(iptr,x,y) (1 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))
#define VAL(iptr,x,y) (2 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))

#define H(iptr,x,y) (iptr)->pixel [HUE (iptr,x,y)]
#define S(iptr,x,y) (iptr)->pixel [SAT (iptr,x,y)]
#define V(iptr,x,y) (iptr)->pixel [VAL (iptr,x,y)]

/*
 * Pixel Access Macros. FPCOMPLEX.
 */

#define REAL(iptr,x,y)      (0             + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))
#define IMAGINARY(iptr,x,y) (sizeof(float) + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->w)))

#define RE(iptr,x,y) *((float*) &((iptr)->pixel [REAL      (iptr,x,y)]))
#define IM(iptr,x,y) *((float*) &((iptr)->pixel [IMAGINARY (iptr,x,y)]))

/*
 * Other constants
 */

#define BLACK 0
#define WHITE 255

#define OPAQUE      255
#define TRANSPARENT 0

/*
 * Area calculations macros.
 */

#define CRIMP_RECT_AREA(w,h) (((size_t) (w)) * (h))
#define crimp_image_area(iptr) (CRIMP_RECT_AREA ((iptr)->w, (iptr)->h))













/*
 * Convenience macros for the creation of images with predefined image types.
 */





#define crimp_new_hsv(w,h)       (crimp_new (crimp_imagetype_find ("crimp::image::hsv"),     (w), (h)))
#define crimp_new_rgba(w,h)      (crimp_new (crimp_imagetype_find ("crimp::image::rgba"),    (w), (h)))
#define crimp_new_rgb(w,h)       (crimp_new (crimp_imagetype_find ("crimp::image::rgb"),     (w), (h)))
#define crimp_new_grey8(w,h)     (crimp_new (crimp_imagetype_find ("crimp::image::grey8"),   (w), (h)))
#define crimp_new_grey16(w,h)    (crimp_new (crimp_imagetype_find ("crimp::image::grey16"),  (w), (h)))
#define crimp_new_grey32(w,h)    (crimp_new (crimp_imagetype_find ("crimp::image::grey32"),  (w), (h)))
#define crimp_new_float(w,h)     (crimp_new (crimp_imagetype_find ("crimp::image::float"),   (w), (h)))
#define crimp_new_fpcomplex(w,h) (crimp_new (crimp_imagetype_find ("crimp::image::fpcomplex"), (w), (h)))

#define crimp_new_like(image)           (crimp_newm ((image)->itype, (image)->w, (image)->h, (image)->meta))
#define crimp_new_like_transpose(image) (crimp_newm ((image)->itype, (image)->h, (image)->w, (image)->meta))










/*
 * Convenience macros for input image handling.
 */

#define crimp_input(objvar,imagevar,itype) \
    if (crimp_get_image_from_obj (interp, (objvar), &(imagevar)) != TCL_OK) { \
	return TCL_ERROR; \
    } \
    CRIMP_ASSERT_IMGTYPE (imagevar, itype)

#define crimp_input_any(objvar,imagevar) \
    if (crimp_get_image_from_obj (interp, (objvar), &(imagevar)) != TCL_OK) { \
	return TCL_ERROR; \
    }




#define crimp_eq_dim(imagea,imageb) \

    (((imagea)->w == (imageb)->w) && ((imagea)->h == (imageb)->h))









#define crimp_eq_height(imagea,imageb) \
    ((imagea)->h == (imageb)->h)

#define crimp_eq_width(imagea,imageb) \
    ((imagea)->w == (imageb)->w)

#define crimp_require_dim(image,rw,rh)					\
    (((image)->w == (rw)) && ((image)->h == (rh)))

#define crimp_require_height(image,rh)					\
    ((image)->h == (rh))

#define crimp_require_width(image,rw)					\
    ((image)->w == (rw))


/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
#endif /* CRIMP_IMAGE_H */












>
>
>
>



>
>
>
>
>
>
>




|
<







|

















|
|
|
|


|
|
|
|
















|
















|
|
|









|
|



















|
>
>
>
>
>
>
>
>
>
>
>
>




>
>
>
>










|
|
>
>
>
>
>
>
>
>
>
















>
>
>

>
|
>
>

>
>
>
>
>
>

|


|


|


|


|










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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#ifndef CRIMP_IMAGE_H
#define CRIMP_IMAGE_H
/*
 * CRIMP :: Image Declarations, and API :: PUBLIC
 * (C) 2010 - 2011
 */

#include "common.h"
#include "image_type.h"

/*
 * Structures describing images.
 *
 * - A convenient name for a memory block of pixel data
 * - The geometry (bounding box) of an image.
 * - The image itself.
 */

typedef unsigned char* crimp_pixel_array;

typedef struct crimp_geometry {
    int x; /* Location of the image in the infinite 2D plane */
    int y; /* s.a. */
    int w; /* Image dimension, width  */
    int h; /* Image dimension, height */
} crimp_geometry;

typedef struct crimp_image {
    Tcl_Obj*               meta;     /* Tcl level client data */
    const crimp_imagetype* itype;    /* Reference to type descriptor */
    crimp_geometry         geo;      /* Image geometry, bounding box */

    unsigned char          pixel[4]; /* Integrated pixel storage */
} crimp_image;

/*
 * Pixel Access Macros. General access to a 'color' channel.
 */

#define CRIMP_CHAN(iptr,c,x,y) ((c) + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))
#define CH(iptr,c,x,y)   (iptr)->pixel [CRIMP_CHAN (iptr,c,x,y)]

/*
 * Pixel Access Macros. RGBA / RGB
 */

/*
 * Manually optimized, factored the pixelsize out of the summands. It
 * is not sure if this is faster (easier to optimize), or if we should
 * precompute the pitch (w*pixelsize), and have the pixel size mult
 * in each x ... As the pixel size is mostly 1, 2, 4, i.e. redundant
 * removed unity, or a power of 2, i.e handled as shift this should be
 * good enough. The only not so sure case is RGB, with pixel size of 3.
 */

#define SZ(iptr) ((iptr)->itype->size)

#define RED(iptr,x,y)   (0 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))
#define GREEN(iptr,x,y) (1 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))
#define BLUE(iptr,x,y)  (2 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))
#define ALPHA(iptr,x,y) (3 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))

#if 0 /* Unoptimized formulas */
#define RED(iptr,x,y)   (0 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->geo.w)))
#define GREEN(iptr,x,y) (1 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->geo.w)))
#define BLUE(iptr,x,y)  (2 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->geo.w)))
#define ALPHA(iptr,x,y) (3 + ((x)*SZ (iptr)) + ((y)*SZ (iptr)*((size_t) (iptr)->geo.w)))
#endif

#define R(iptr,x,y) (iptr)->pixel [RED   (iptr,x,y)]
#define G(iptr,x,y) (iptr)->pixel [GREEN (iptr,x,y)]
#define B(iptr,x,y) (iptr)->pixel [BLUE  (iptr,x,y)]
#define A(iptr,x,y) (iptr)->pixel [ALPHA (iptr,x,y)]

/*
 * Pixel Access Macros. GREY8, GREY16, GREY32, FLOATP.
 *
 * NOTE: The casts should use standard types where we we know the size in
 *       bytes exactly, by definition.
 */

#define CRIMP_INDEX(iptr,x,y) \
    (((x)*SZ (iptr)) + \
     ((y)*SZ (iptr)*(((size_t) (iptr)->geo.w))))

#define GREY8(iptr,x,y)  *((unsigned char*)  &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))
#define GREY16(iptr,x,y) *((unsigned short*) &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))
#define GREY32(iptr,x,y) *((unsigned int* )  &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))
#define FLOATP(iptr,x,y) *((float*)          &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))

/*
 * Pixel as 2-complement numbers (-128..127, instead of unsigned 0..255).
 */

#define SGREY8(iptr,x,y) *((signed char*)  &((iptr)->pixel [CRIMP_INDEX (iptr,x,y)]))

/*
 * Pixel Access Macros. HSV.
 */

#define HUE(iptr,x,y) (0 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))
#define SAT(iptr,x,y) (1 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))
#define VAL(iptr,x,y) (2 + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))

#define H(iptr,x,y) (iptr)->pixel [HUE (iptr,x,y)]
#define S(iptr,x,y) (iptr)->pixel [SAT (iptr,x,y)]
#define V(iptr,x,y) (iptr)->pixel [VAL (iptr,x,y)]

/*
 * Pixel Access Macros. FPCOMPLEX.
 */

#define REAL(iptr,x,y)      (0             + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))
#define IMAGINARY(iptr,x,y) (sizeof(float) + SZ(iptr) * ((x) + (y)*((size_t) (iptr)->geo.w)))

#define RE(iptr,x,y) *((float*) &((iptr)->pixel [REAL      (iptr,x,y)]))
#define IM(iptr,x,y) *((float*) &((iptr)->pixel [IMAGINARY (iptr,x,y)]))

/*
 * Other constants
 */

#define BLACK 0
#define WHITE 255

#define OPAQUE      255
#define TRANSPARENT 0

/*
 * Area calculations macros.
 */

#define CRIMP_RECT_AREA(w,h) (((size_t) (w)) * (h))
#define crimp_image_area(iptr) (CRIMP_RECT_AREA (crimp_w(iptr), crimp_h(iptr)))

#define crimp_place(image,ix,iy)			\
    ((image)->geo.x = (ix), (image)->geo.y = (iy))

#define crimp_inside(image,px,py) \
    ((crimp_x(image) <= (px)) && ((px) < (crimp_x(image) + crimp_w(image))) && \
     (crimp_y(image) <= (py)) && ((py) < (crimp_y(image) + crimp_h(image))))

#define crimp_x(image) ((image)->geo.x)
#define crimp_y(image) ((image)->geo.y)
#define crimp_w(image) ((image)->geo.w)
#define crimp_h(image) ((image)->geo.h)

/*
 * Convenience macros for the creation of images with predefined image types.
 */

#define crimp_new_atg(type,g)     (crimp_new_at  ((type), (g).x, (g).y, (g).w, (g).h))
#define crimp_new(type,w,h)       (crimp_new_at  ((type), 0, 0, (w), (h)))
#define crimp_newm(type,w,h,meta) (crimp_newm_at ((type), 0, 0, (w), (h), (meta)))

#define crimp_new_hsv(w,h)       (crimp_new (crimp_imagetype_find ("crimp::image::hsv"),     (w), (h)))
#define crimp_new_rgba(w,h)      (crimp_new (crimp_imagetype_find ("crimp::image::rgba"),    (w), (h)))
#define crimp_new_rgb(w,h)       (crimp_new (crimp_imagetype_find ("crimp::image::rgb"),     (w), (h)))
#define crimp_new_grey8(w,h)     (crimp_new (crimp_imagetype_find ("crimp::image::grey8"),   (w), (h)))
#define crimp_new_grey16(w,h)    (crimp_new (crimp_imagetype_find ("crimp::image::grey16"),  (w), (h)))
#define crimp_new_grey32(w,h)    (crimp_new (crimp_imagetype_find ("crimp::image::grey32"),  (w), (h)))
#define crimp_new_float(w,h)     (crimp_new (crimp_imagetype_find ("crimp::image::float"),   (w), (h)))
#define crimp_new_fpcomplex(w,h) (crimp_new (crimp_imagetype_find ("crimp::image::fpcomplex"), (w), (h)))

#define crimp_new_like(image)           (crimp_newm_at ((image)->itype, crimp_x(image), crimp_y(image), crimp_w(image), crimp_h(image), (image)->meta))
#define crimp_new_like_transpose(image) (crimp_newm_at ((image)->itype, crimp_x(image), crimp_y(image), crimp_h(image), crimp_w(image), (image)->meta))

#define crimp_new_hsv_at(x,y,w,h)       (crimp_new_at (crimp_imagetype_find ("crimp::image::hsv"),       (x), (y), (w), (h)))
#define crimp_new_rgba_at(x,y,w,h)      (crimp_new_at (crimp_imagetype_find ("crimp::image::rgba"),      (x), (y), (w), (h)))
#define crimp_new_rgb_at(x,y,w,h)       (crimp_new_at (crimp_imagetype_find ("crimp::image::rgb"),       (x), (y), (w), (h)))
#define crimp_new_grey8_at(x,y,w,h)     (crimp_new_at (crimp_imagetype_find ("crimp::image::grey8"),     (x), (y), (w), (h)))
#define crimp_new_grey16_at(x,y,w,h)    (crimp_new_at (crimp_imagetype_find ("crimp::image::grey16"),    (x), (y), (w), (h)))
#define crimp_new_grey32_at(x,y,w,h)    (crimp_new_at (crimp_imagetype_find ("crimp::image::grey32"),    (x), (y), (w), (h)))
#define crimp_new_float_at(x,y,w,h)     (crimp_new_at (crimp_imagetype_find ("crimp::image::float"),     (x), (y), (w), (h)))
#define crimp_new_fpcomplex_at(x,y,w,h) (crimp_new_at (crimp_imagetype_find ("crimp::image::fpcomplex"), (x), (y), (w), (h)))

/*
 * Convenience macros for input image handling.
 */

#define crimp_input(objvar,imagevar,itype) \
    if (crimp_get_image_from_obj (interp, (objvar), &(imagevar)) != TCL_OK) { \
	return TCL_ERROR; \
    } \
    CRIMP_ASSERT_IMGTYPE (imagevar, itype)

#define crimp_input_any(objvar,imagevar) \
    if (crimp_get_image_from_obj (interp, (objvar), &(imagevar)) != TCL_OK) { \
	return TCL_ERROR; \
    }

#define crimp_eq_geo(imagea,imageb) \
    (crimp_eq_dim(imagea,imageb) && crimp_eq_loc(imagea,imageb))

#define crimp_eq_dim(imagea,imageb) \
    (crimp_eq_width(imagea,imageb) && crimp_eq_height(imagea,imageb))

#define crimp_eq_loc(imagea,imageb) \
    (crimp_eq_x(imagea,imageb) && crimp_eq_y(imagea,imageb))

#define crimp_eq_x(imagea,imageb) \
    (crimp_x(imagea) == crimp_x(imageb))

#define crimp_eq_y(imagea,imageb) \
    (crimp_y(imagea) == crimp_y(imageb))

#define crimp_eq_height(imagea,imageb) \
    (crimp_h(imagea) == crimp_h(imageb))

#define crimp_eq_width(imagea,imageb) \
    (crimp_w(imagea) == crimp_w(imageb))

#define crimp_require_dim(image,rw,rh)					\
    ((crimp_w(image) == (rw)) && (crimp_h(image) == (rh)))

#define crimp_require_height(image,rh)					\
    (crimp_h(image) == (rh))

#define crimp_require_width(image,rw)					\
    (crimp_w(image) == (rw))


/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
#endif /* CRIMP_IMAGE_H */
Changes to c/labelcc.c.
160
161
162
163
164
165
166
167
168


169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
    const void* bgValue,
				/* Pointer to the pixel value that will be
				 * used as background. All background pixels
				 * are coalesced into a single component.
				 * NULL means not to use a background value. */
    crimp_image* imagePtr	/* Input image to segment. */
) {
    int height = imagePtr->h;	/* Height of the image */
    int width = imagePtr->w;	/* Width of the image */


    int esize = SZ(imagePtr);	/* Size of a pixel value */
    int wm1 = width - 1;
    int wp1 = width + 1;
    size_t area = (size_t)width * (size_t)height;
				/* Area of the image in pixels */
    size_t* parent = (size_t*) ckalloc(area * sizeof(size_t));
				/* Parent link data structure for
				 * UNION-FIND partition */
    crimp_image* result = crimp_new_grey32(width, height);
				/* Result image containing subset ranks
				 * during the UNION-FIND calculation and
				 * component numbers during the component
				 * numbering pass. */
    RANK_TYPE* rank = (RANK_TYPE*) result->pixel;
				/* Pixel array for the result image */
    int i, j;			/* Row and column indices */







|
|
>
>








|







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
    const void* bgValue,
				/* Pointer to the pixel value that will be
				 * used as background. All background pixels
				 * are coalesced into a single component.
				 * NULL means not to use a background value. */
    crimp_image* imagePtr	/* Input image to segment. */
) {
    int height = crimp_h(imagePtr);	/* Height of the image */
    int width = crimp_w(imagePtr);	/* Width of the image */
    int locx = crimp_x(imagePtr);	/* Location of the image */
    int locy = crimp_y(imagePtr);	/* Location of the image */
    int esize = SZ(imagePtr);	/* Size of a pixel value */
    int wm1 = width - 1;
    int wp1 = width + 1;
    size_t area = (size_t)width * (size_t)height;
				/* Area of the image in pixels */
    size_t* parent = (size_t*) ckalloc(area * sizeof(size_t));
				/* Parent link data structure for
				 * UNION-FIND partition */
    crimp_image* result = crimp_new_grey32_at (locx, locy, width, height);
				/* Result image containing subset ranks
				 * during the UNION-FIND calculation and
				 * component numbers during the component
				 * numbering pass. */
    RANK_TYPE* rank = (RANK_TYPE*) result->pixel;
				/* Pixel array for the result image */
    int i, j;			/* Row and column indices */
Changes to c/linearalgebra.c.
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
    return result;
}

crimp_image*
crimp_la_multiply_matrix (crimp_image* a, crimp_image* b)
{
    crimp_image* result;
    int x, y, w;

    CRIMP_ASSERT_IMGTYPE (a, float);
    CRIMP_ASSERT_IMGTYPE (b, float);
    CRIMP_ASSERT (crimp_require_height(a, b->w),"Unable to multiply matrices, size mismatch");
    CRIMP_ASSERT (crimp_require_height(b, a->w),"Unable to multiply matrices, size mismatch");




    result = crimp_new_float (a->h, a->h);

    for (y = 0; y < a->h; y++) {
	for (x = 0; x < a->h; x++) {

	    FLOATP (result, x, y) = 0;
	    for (w = 0; w < a->w; w++) {
		FLOATP (result, x, y) += FLOATP (a, w, y) * FLOATP (b, x, w);
	    }
	}
    }

    return result;
}







|



|
|

>
>
>
|

|
|


|







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
    return result;
}

crimp_image*
crimp_la_multiply_matrix (crimp_image* a, crimp_image* b)
{
    crimp_image* result;
    int x, y, w, n, m;

    CRIMP_ASSERT_IMGTYPE (a, float);
    CRIMP_ASSERT_IMGTYPE (b, float);
    CRIMP_ASSERT (crimp_require_height(a, crimp_w(b)),"Unable to multiply matrices, size mismatch");
    CRIMP_ASSERT (crimp_require_height(b, crimp_w(a)),"Unable to multiply matrices, size mismatch");

    n = crimp_h (a);
    m = crimp_w (a);

    result = crimp_new_float (n, n);

    for (y = 0; y < n; y++) {
	for (x = 0; x < n; x++) {

	    FLOATP (result, x, y) = 0;
	    for (w = 0; w < m; w++) {
		FLOATP (result, x, y) += FLOATP (a, w, y) * FLOATP (b, x, w);
	    }
	}
    }

    return result;
}
Changes to c/volume.c.
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
};

/*
 * Definitions :: Core.
 */

crimp_volume*
crimp_vnew (const crimp_imagetype* itype, int w, int h, int d)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t        size   = sizeof (crimp_volume) + CRIMP_RECT_VOLUME (w, h, d) * itype->size;
    crimp_volume* volume = (crimp_volume*) ckalloc (size);

    volume->itype = itype;

    volume->w     = w;
    volume->h     = h;
    volume->d     = d;





    volume->meta  = NULL;

    return volume;
}

crimp_volume*
crimp_vnewm (const crimp_imagetype* itype, int w, int h, int d, Tcl_Obj* meta)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t        size   = sizeof (crimp_volume) + CRIMP_RECT_VOLUME (w, h, d) * itype->size;
    crimp_volume* volume = (crimp_volume*) ckalloc (size);

    volume->itype = itype;

    volume->w     = w;
    volume->h     = h;
    volume->d     = d;





    volume->meta  = meta;

    if (meta) {
	Tcl_IncrRefCount (meta);
    }

    return volume;







|









>
|
|
|
>
>
>
>
>






|









>
|
|
|
>
>
>
>
>







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
};

/*
 * Definitions :: Core.
 */

crimp_volume*
crimp_vnew_at (const crimp_imagetype* itype, int x, int y, int z, int w, int h, int d)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t        size   = sizeof (crimp_volume) + CRIMP_RECT_VOLUME (w, h, d) * itype->size;
    crimp_volume* volume = (crimp_volume*) ckalloc (size);

    volume->itype = itype;

    volume->geo.x = x;
    volume->geo.y = y;
    volume->geo.z = z;

    volume->geo.w = w;
    volume->geo.h = h;
    volume->geo.d = d;

    volume->meta  = NULL;

    return volume;
}

crimp_volume*
crimp_vnewm_at (const crimp_imagetype* itype, int x, int y, int z, int w, int h, int d, Tcl_Obj* meta)
{
    /*
     * Note: Pixel storage and header describing it are allocated together.
     */

    size_t        size   = sizeof (crimp_volume) + CRIMP_RECT_VOLUME (w, h, d) * itype->size;
    crimp_volume* volume = (crimp_volume*) ckalloc (size);

    volume->itype = itype;

    volume->geo.x = x;
    volume->geo.y = y;
    volume->geo.z = z;

    volume->geo.w = w;
    volume->geo.h = h;
    volume->geo.d = d;

    volume->meta  = meta;

    if (meta) {
	Tcl_IncrRefCount (meta);
    }

    return volume;
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

    /* volume type */
    Tcl_DStringAppendElement (&ds, cv->itype->name);

    /* volume width */
    {
	char wstring [20];
	sprintf (wstring, "%u", cv->w);
	Tcl_DStringAppendElement (&ds, wstring);
    }

    /* volume height */
    {
	char hstring [20];
	sprintf (hstring, "%u", cv->h);
	Tcl_DStringAppendElement (&ds, hstring);
    }

    /* volume depth */
    {
	char dstring [20];
	sprintf (dstring, "%u", cv->d);
	Tcl_DStringAppendElement (&ds, dstring);
    }

    /* volume client data */
    if (cv->meta) {
	Tcl_DStringAppendElement (&ds, Tcl_GetString (cv->meta));
    } else {







|






|






|







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206

    /* volume type */
    Tcl_DStringAppendElement (&ds, cv->itype->name);

    /* volume width */
    {
	char wstring [20];
	sprintf (wstring, "%u", cv->geo.w);
	Tcl_DStringAppendElement (&ds, wstring);
    }

    /* volume height */
    {
	char hstring [20];
	sprintf (hstring, "%u", cv->geo.h);
	Tcl_DStringAppendElement (&ds, hstring);
    }

    /* volume depth */
    {
	char dstring [20];
	sprintf (dstring, "%u", cv->geo.d);
	Tcl_DStringAppendElement (&ds, dstring);
    }

    /* volume client data */
    if (cv->meta) {
	Tcl_DStringAppendElement (&ds, Tcl_GetString (cv->meta));
    } else {
Changes to c/volume.h.
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
#ifndef CRIMP_VOLUME_H
#define CRIMP_VOLUME_H
/*
 * CRIMP :: Volume Declarations, and API :: PUBLIC
 * (C) 2010 - 2011
 */

#include "common.h"
#include "image_type.h"

/*
 * Structures describing volumes.



 */










typedef struct crimp_volume {
    Tcl_Obj*               meta;     /* Tcl level client data */
    const crimp_imagetype* itype;    /* Reference to type descriptor */
    int                    w;        /* Volume dimension, width  */
    int                    h;        /* Volume dimension, height */
    int                    d;        /* Volume dimension, depth */
    unsigned char          voxel[4]; /* Integrated voxel storage */
} crimp_volume;

/*
 * Voxel Access Macros.
 */

#define CRIMP_VINDEX(iptr,x,y,z) \
    (((x)*SZ (iptr)) + \
     ((y)*SZ (iptr)*((iptr)->w)) + \
     ((z)*SZ (iptr)*((iptr)->w)*((size_t) (iptr)->h)))

#define VFLOATP(iptr,x,y,z) *((float*) &((iptr)->voxel [CRIMP_VINDEX (iptr,x,y,z)]))

/*
 * Convenience macros for the creation of volumes with predefined image types.
 */





#define crimp_vnew_hsv(w,h,d)       (crimp_vnew (crimp_imagetype_find ("crimp::image::hsv"),     (w), (h), (d)))
#define crimp_vnew_rgba(w,h,d)      (crimp_vnew (crimp_imagetype_find ("crimp::image::rgba"),    (w), (h), (d)))
#define crimp_vnew_rgb(w,h,d)       (crimp_vnew (crimp_imagetype_find ("crimp::image::rgb"),     (w), (h), (d)))
#define crimp_vnew_grey8(w,h,d)     (crimp_vnew (crimp_imagetype_find ("crimp::image::grey8"),   (w), (h), (d)))
#define crimp_vnew_grey16(w,h,d)    (crimp_vnew (crimp_imagetype_find ("crimp::image::grey16"),  (w), (h), (d)))
#define crimp_vnew_grey32(w,h,d)    (crimp_vnew (crimp_imagetype_find ("crimp::image::grey32"),  (w), (h), (d)))
#define crimp_vnew_float(w,h,d)     (crimp_vnew (crimp_imagetype_find ("crimp::image::float"),   (w), (h), (d)))
#define crimp_vnew_fpcomplex(w,h,d) (crimp_vnew (crimp_imagetype_find ("crimp::image::fpcomplex"), (w), (h), (d)))

#define crimp_vnew_like(volume)           (crimp_vnewm ((volume)->itype, (volume)->w, (volume)->h, (volume)->d, (volume)->meta))
#define crimp_vnew_like_transpose(volume) (crimp_vnewm ((volume)->itype, (volume)->h, (volume)->w, (volume)->d, (volume)->meta))

/*
 * Volume calculations macros.
 */

#define CRIMP_RECT_VOLUME(w,h,d) (((size_t) (w)) * (h) * (d))
#define crimp_volume_vol(vptr) (CRIMP_RECT_VOLUME ((vptr)->w, (vptr)->h, (vptr)->d))
















/*
 * Convenience macros for input volume handling.
 */

#define crimp_vinput(objvar,volumevar,itype) \
    if (crimp_get_volume_from_obj (interp, (objvar), &(volumevar)) != TCL_OK) { \












>
>
>

>
>
>
>
>
>
>
>
>




|
<
<









|
|






>
>
>
>










|
|






|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
#ifndef CRIMP_VOLUME_H
#define CRIMP_VOLUME_H
/*
 * CRIMP :: Volume Declarations, and API :: PUBLIC
 * (C) 2010 - 2011
 */

#include "common.h"
#include "image_type.h"

/*
 * Structures describing volumes.
 *
 * - The geometry (bounding box) of a volume.
 * - The volume itself.
 */

typedef struct crimp_geometry3d {
    int x; /* Location of the volume in the infinite 3D volume */
    int y; /* s.a. */
    int z; /* s.a. */
    int w; /* Volume dimension, width  */
    int h; /* Volume dimension, height */
    int d; /* Volume dimension, depth */
} crimp_geometry3d;

typedef struct crimp_volume {
    Tcl_Obj*               meta;     /* Tcl level client data */
    const crimp_imagetype* itype;    /* Reference to type descriptor */
    crimp_geometry3d       geo;      /* Volume geometry, bounding box */


    unsigned char          voxel[4]; /* Integrated voxel storage */
} crimp_volume;

/*
 * Voxel Access Macros.
 */

#define CRIMP_VINDEX(iptr,x,y,z) \
    (((x)*SZ (iptr)) + \
     ((y)*SZ (iptr)*((iptr)->geo.w)) + \
     ((z)*SZ (iptr)*((iptr)->geo.w)*((size_t) (iptr)->geo.h)))

#define VFLOATP(iptr,x,y,z) *((float*) &((iptr)->voxel [CRIMP_VINDEX (iptr,x,y,z)]))

/*
 * Convenience macros for the creation of volumes with predefined image types.
 */

#define crimp_vnew_atg(type,g)       (crimp_vnew_at  ((type), (g).x, (g).y, (g).z, (g).w, (g).h, (g).d))
#define crimp_vnew(type,w,h,d)       (crimp_vnew_at  ((type), 0, 0, 0, (w), (h), (d)))
#define crimp_vnewm(type,w,h,d,meta) (crimp_vnewm_at ((type), 0, 0, 0, (w), (h), (d), (meta)))

#define crimp_vnew_hsv(w,h,d)       (crimp_vnew (crimp_imagetype_find ("crimp::image::hsv"),     (w), (h), (d)))
#define crimp_vnew_rgba(w,h,d)      (crimp_vnew (crimp_imagetype_find ("crimp::image::rgba"),    (w), (h), (d)))
#define crimp_vnew_rgb(w,h,d)       (crimp_vnew (crimp_imagetype_find ("crimp::image::rgb"),     (w), (h), (d)))
#define crimp_vnew_grey8(w,h,d)     (crimp_vnew (crimp_imagetype_find ("crimp::image::grey8"),   (w), (h), (d)))
#define crimp_vnew_grey16(w,h,d)    (crimp_vnew (crimp_imagetype_find ("crimp::image::grey16"),  (w), (h), (d)))
#define crimp_vnew_grey32(w,h,d)    (crimp_vnew (crimp_imagetype_find ("crimp::image::grey32"),  (w), (h), (d)))
#define crimp_vnew_float(w,h,d)     (crimp_vnew (crimp_imagetype_find ("crimp::image::float"),   (w), (h), (d)))
#define crimp_vnew_fpcomplex(w,h,d) (crimp_vnew (crimp_imagetype_find ("crimp::image::fpcomplex"), (w), (h), (d)))

#define crimp_vnew_like(volume)           (crimp_vnewm ((volume)->itype, (volume)->geo.w, (volume)->geo.h, (volume)->geo.d, (volume)->meta))
#define crimp_vnew_like_transpose(volume) (crimp_vnewm ((volume)->itype, (volume)->geo.h, (volume)->geo.w, (volume)->geo.d, (volume)->meta))

/*
 * Volume calculations macros.
 */

#define CRIMP_RECT_VOLUME(w,h,d) (((size_t) (w)) * (h) * (d))
#define crimp_volume_vol(vptr) (CRIMP_RECT_VOLUME ((vptr)->geo.w, (vptr)->geo.h, (vptr)->geo.d))

#define crimp_vplace(image,ix,iy,iz)			\
    ((image)->geo.x = (ix), (image)->geo.y = (iy), (image)->geo.z = (iz))

#define crimp_vinside(volume,px,py,pz)					\
    (((volume)->geo.x <= (px)) && ((px) < ((volume)->geo.x + (volume)->geo.w)) && \
     ((volume)->geo.y <= (py)) && ((py) < ((volume)->geo.y + (volume)->geo.h)) && \
     ((volume)->geo.z <= (pz)) && ((pz) < ((volume)->geo.z + (volume)->geo.d)))

#define crimp_vx(volume) ((volume)->geo.x)
#define crimp_vy(volume) ((volume)->geo.y)
#define crimp_vz(volume) ((volume)->geo.z)
#define crimp_vw(volume) ((volume)->geo.w)
#define crimp_vh(volume) ((volume)->geo.h)
#define crimp_vd(volume) ((volume)->geo.d)

/*
 * Convenience macros for input volume handling.
 */

#define crimp_vinput(objvar,volumevar,itype) \
    if (crimp_get_volume_from_obj (interp, (objvar), &(volumevar)) != TCL_OK) { \
Deleted cop/binop_float_float.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, float);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = BINOP (FLOATP (imageA, x, y), FLOATP (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_float_float_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_v = ina ? FLOATP (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_float_fpcomplex_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, fpcomplex);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_v = ina ? FLOATP (imageA, pxa, pya) : BLACK;
	double b_re = inb ? RE (imageB, pxb, pyb) : BLACK;
	double b_im = inb ? IM (imageB, pxb, pyb) : BLACK;
	
	double z_vre = BINOP (a_v, b_re);
	double z_vim = BINOP (a_v, b_im);
	
	RE (result, px, py) = BINOP_POST (z_vre);
	IM (result, px, py) = BINOP_POST (z_vim);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_float_grey16.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, grey16);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = BINOP (FLOATP (imageA, x, y), GREY16 (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_float_grey16_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_v = ina ? FLOATP (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_float_grey32.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, grey32);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = BINOP (FLOATP (imageA, x, y), GREY32 (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_float_grey32_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_v = ina ? FLOATP (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_float_grey8.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, grey8);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = BINOP (FLOATP (imageA, x, y), GREY8 (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_float_grey8_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, float);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_v = ina ? FLOATP (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_fpcomplex_float_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, fpcomplex);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_re = ina ? RE (imageA, pxa, pya) : BLACK;
	double a_im = ina ? IM (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	double z_rev = BINOP (a_re, b_v);
	double z_imv = BINOP (a_im, b_v);
	
	RE (result, px, py) = BINOP_POST (z_rev);
	IM (result, px, py) = BINOP_POST (z_imv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_fpcomplex_fpcomplex.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA,fpcomplex);
crimp_input (imageBObj, imageB,fpcomplex);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	RE (result, x, y) = BINOP (RE (imageA, x, y), RE (imageB, x, y));
	IM (result, x, y) = BINOP (IM (imageA, x, y), IM (imageB, x, y));
	}
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Added cop/binop_fpcomplex_fpcomplex_fpcomplex.c.








































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, fpcomplex);
crimp_input (imageBObj, imageB, fpcomplex);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_re = ina ? RE (imageA, pxa, pya) : BLACK;
	double a_im = ina ? IM (imageA, pxa, pya) : BLACK;
	double b_re = inb ? RE (imageB, pxb, pyb) : BLACK;
	double b_im = inb ? IM (imageB, pxb, pyb) : BLACK;
	
	double z_rere = BINOP (a_re, b_re);
	double z_imim = BINOP (a_im, b_im);
	
	RE (result, px, py) = BINOP_POST (z_rere);
	IM (result, px, py) = BINOP_POST (z_imim);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_fpcomplex_fpcomplex_fpcomplex2.c.








































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, fpcomplex);
crimp_input (imageBObj, imageB, fpcomplex);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_GLOBAL
#define BINOP_GLOBAL(a,b,c,d)
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_re = ina ? RE (imageA, pxa, pya) : BLACK;
	double a_im = ina ? IM (imageA, pxa, pya) : BLACK;
	double b_re = inb ? RE (imageB, pxb, pyb) : BLACK;
	double b_im = inb ? IM (imageB, pxb, pyb) : BLACK;

	BINOP_GLOBAL (a_re, a_im, b_re, b_im);
	
	RE (result, px, py) = BINOP_RE (a_re, a_im, b_re, b_im);
	IM (result, px, py) = BINOP_IM (a_re, a_im, b_re, b_im);
    }
}

#undef BINOP_RE
#undef BINOP_IM
#undef BINOP_GLOBAL

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_fpcomplex_grey16_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, fpcomplex);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_re = ina ? RE (imageA, pxa, pya) : BLACK;
	double a_im = ina ? IM (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	double z_rev = BINOP (a_re, b_v);
	double z_imv = BINOP (a_im, b_v);
	
	RE (result, px, py) = BINOP_POST (z_rev);
	IM (result, px, py) = BINOP_POST (z_imv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_fpcomplex_grey32_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, fpcomplex);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_re = ina ? RE (imageA, pxa, pya) : BLACK;
	double a_im = ina ? IM (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	double z_rev = BINOP (a_re, b_v);
	double z_imv = BINOP (a_im, b_v);
	
	RE (result, px, py) = BINOP_POST (z_rev);
	IM (result, px, py) = BINOP_POST (z_imv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_fpcomplex_grey8_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, fpcomplex);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	double a_re = ina ? RE (imageA, pxa, pya) : BLACK;
	double a_im = ina ? IM (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	double z_rev = BINOP (a_re, b_v);
	double z_imv = BINOP (a_im, b_v);
	
	RE (result, px, py) = BINOP_POST (z_rev);
	IM (result, px, py) = BINOP_POST (z_imv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey16_float.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, float);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = BINOP (GREY16 (imageA, x, y), FLOATP (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_grey16_float_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey16_float_grey16.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey16_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY16 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey16_fpcomplex_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, fpcomplex);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	double b_re = inb ? RE (imageB, pxb, pyb) : BLACK;
	double b_im = inb ? IM (imageB, pxb, pyb) : BLACK;
	
	double z_vre = BINOP (a_v, b_re);
	double z_vim = BINOP (a_v, b_im);
	
	RE (result, px, py) = BINOP_POST (z_vre);
	IM (result, px, py) = BINOP_POST (z_vim);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey16_grey16.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, grey16);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY16 (result, x, y) = BINOP (GREY16 (imageA, x, y), GREY16 (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_grey16_grey16_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey16_grey16_grey16.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey16_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY16 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey16_grey32_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey16_grey32_grey32.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey32_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY32 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey16_grey8_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey16_grey8_grey16.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey16);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey16_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY16 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY16 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey32_float.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, float);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = BINOP (GREY32 (imageA, x, y), FLOATP (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_grey32_float_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey32_float_grey32.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey32_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY32 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey32_fpcomplex_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, fpcomplex);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	double b_re = inb ? RE (imageB, pxb, pyb) : BLACK;
	double b_im = inb ? IM (imageB, pxb, pyb) : BLACK;
	
	double z_vre = BINOP (a_v, b_re);
	double z_vim = BINOP (a_v, b_im);
	
	RE (result, px, py) = BINOP_POST (z_vre);
	IM (result, px, py) = BINOP_POST (z_vim);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey32_grey16_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey32_grey16_grey32.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey32_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY32 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey32_grey32.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, grey32);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY32 (result, x, y) = BINOP (GREY32 (imageA, x, y), GREY32 (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_grey32_grey32_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey32_grey32_grey32.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey32_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY32 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey32_grey8_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey32_grey8_grey32.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey32);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey32_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY32 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY32 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey8_float.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, float);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = BINOP (GREY8 (imageA, x, y), FLOATP (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_grey8_float_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey8_float_grey8.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, float);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey8_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	double b_v = inb ? FLOATP (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY8 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey8_fpcomplex_fpcomplex.c.






































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, fpcomplex);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	double b_re = inb ? RE (imageB, pxb, pyb) : BLACK;
	double b_im = inb ? IM (imageB, pxb, pyb) : BLACK;
	
	double z_vre = BINOP (a_v, b_re);
	double z_vim = BINOP (a_v, b_im);
	
	RE (result, px, py) = BINOP_POST (z_vre);
	IM (result, px, py) = BINOP_POST (z_vim);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey8_grey16_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey8_grey16_grey16.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, grey16);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey16_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY16 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY16 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey8_grey32_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey8_grey32_grey32.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, grey32);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey32_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY32 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY32 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey8_grey8.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, grey8);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY8 (result, x, y) = BINOP (GREY8 (imageA, x, y), GREY8 (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Added cop/binop_grey8_grey8_float.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	double z_vv = BINOP (a_v, b_v);
	
	FLOATP (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_grey8_grey8_grey8.c.
































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_grey8_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	int    z_vv = BINOP (a_v, b_v);
	
	GREY8 (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey8_rgb.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, rgb);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageB);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (GREY8 (imageA, x, y), R (imageB, x, y));
	G (result, x, y) = BINOP (GREY8 (imageA, x, y), G (imageB, x, y));
	B (result, x, y) = BINOP (GREY8 (imageA, x, y), B (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Added cop/binop_grey8_rgb_rgb.c.












































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, rgb);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgb_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    b_r = inb ? R (imageB, pxb, pyb) : BLACK;
	int    b_g = inb ? G (imageB, pxb, pyb) : BLACK;
	int    b_b = inb ? B (imageB, pxb, pyb) : BLACK;
	
	int    z_vr = BINOP (a_v, b_r);
	int    z_vg = BINOP (a_v, b_g);
	int    z_vb = BINOP (a_v, b_b);
	
	R (result, px, py) = BINOP_POST (z_vr);
	G (result, px, py) = BINOP_POST (z_vg);
	B (result, px, py) = BINOP_POST (z_vb);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_grey8_rgba.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, rgba);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageB);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (GREY8 (imageA, x, y), R (imageB, x, y));
	G (result, x, y) = BINOP (GREY8 (imageA, x, y), G (imageB, x, y));
	B (result, x, y) = BINOP (GREY8 (imageA, x, y), B (imageB, x, y));
	A (result, x, y) =                              A (imageB, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Added cop/binop_grey8_rgba_rgba.c.










































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, grey8);
crimp_input (imageBObj, imageB, rgba);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_v = ina ? GREY8 (imageA, pxa, pya) : BLACK;
	int    a_a = ina ? OPAQUE : BLACK;
	int    b_r = inb ? R (imageB, pxb, pyb) : BLACK;
	int    b_g = inb ? G (imageB, pxb, pyb) : BLACK;
	int    b_b = inb ? B (imageB, pxb, pyb) : BLACK;
	int    b_a = inb ? A (imageB, pxb, pyb) : BLACK;
	
	R (result, px, py) = BINOP (a_v, b_r);
	G (result, px, py) = BINOP (a_v, b_g);
	B (result, px, py) = BINOP (a_v, b_b);
	A (result, px, py) = MAX   (a_a, b_a);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_hsv_hsv_hsv.c.
















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, hsv);
crimp_input (imageBObj, imageB, hsv);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_hsv_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_h = ina ? H (imageA, pxa, pya) : BLACK;
	int    a_s = ina ? S (imageA, pxa, pya) : BLACK;
	int    a_v = ina ? V (imageA, pxa, pya) : BLACK;
	int    b_h = inb ? H (imageB, pxb, pyb) : BLACK;
	int    b_s = inb ? S (imageB, pxb, pyb) : BLACK;
	int    b_v = inb ? V (imageB, pxb, pyb) : BLACK;
	
	int    z_hh = BINOP (a_h, b_h);
	int    z_ss = BINOP (a_s, b_s);
	int    z_vv = BINOP (a_v, b_v);
	
	H (result, px, py) = BINOP_POST (z_hh);
	S (result, px, py) = BINOP_POST (z_ss);
	V (result, px, py) = BINOP_POST (z_vv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_rgb_grey8.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, rgb);
crimp_input (imageBObj, imageB, grey8);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (R (imageA, x, y), GREY8 (imageB, x, y));
	G (result, x, y) = BINOP (G (imageA, x, y), GREY8 (imageB, x, y));
	B (result, x, y) = BINOP (B (imageA, x, y), GREY8 (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Added cop/binop_rgb_grey8_rgb.c.












































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, rgb);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgb_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_r = ina ? R (imageA, pxa, pya) : BLACK;
	int    a_g = ina ? G (imageA, pxa, pya) : BLACK;
	int    a_b = ina ? B (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	
	int    z_rv = BINOP (a_r, b_v);
	int    z_gv = BINOP (a_g, b_v);
	int    z_bv = BINOP (a_b, b_v);
	
	R (result, px, py) = BINOP_POST (z_rv);
	G (result, px, py) = BINOP_POST (z_gv);
	B (result, px, py) = BINOP_POST (z_bv);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_rgb_rgb.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, rgb);
crimp_input (imageBObj, imageB, rgb);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (R (imageA, x, y), R (imageB, x, y));
	G (result, x, y) = BINOP (G (imageA, x, y), G (imageB, x, y));
	B (result, x, y) = BINOP (B (imageA, x, y), B (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Added cop/binop_rgb_rgb_rgb.c.
















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, rgb);
crimp_input (imageBObj, imageB, rgb);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgb_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_r = ina ? R (imageA, pxa, pya) : BLACK;
	int    a_g = ina ? G (imageA, pxa, pya) : BLACK;
	int    a_b = ina ? B (imageA, pxa, pya) : BLACK;
	int    b_r = inb ? R (imageB, pxb, pyb) : BLACK;
	int    b_g = inb ? G (imageB, pxb, pyb) : BLACK;
	int    b_b = inb ? B (imageB, pxb, pyb) : BLACK;
	
	int    z_rr = BINOP (a_r, b_r);
	int    z_gg = BINOP (a_g, b_g);
	int    z_bb = BINOP (a_b, b_b);
	
	R (result, px, py) = BINOP_POST (z_rr);
	G (result, px, py) = BINOP_POST (z_gg);
	B (result, px, py) = BINOP_POST (z_bb);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_rgb_rgba.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, rgb);
crimp_input (imageBObj, imageB, rgba);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (R (imageA, x, y), R (imageB, x, y));
	G (result, x, y) = BINOP (G (imageA, x, y), G (imageB, x, y));
	B (result, x, y) = BINOP (B (imageA, x, y), B (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Added cop/binop_rgb_rgba_rgba.c.














































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, rgb);
crimp_input (imageBObj, imageB, rgba);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_r = ina ? R (imageA, pxa, pya) : BLACK;
	int    a_g = ina ? G (imageA, pxa, pya) : BLACK;
	int    a_b = ina ? B (imageA, pxa, pya) : BLACK;
	int    a_a = ina ? OPAQUE : BLACK;
	int    b_r = inb ? R (imageB, pxb, pyb) : BLACK;
	int    b_g = inb ? G (imageB, pxb, pyb) : BLACK;
	int    b_b = inb ? B (imageB, pxb, pyb) : BLACK;
	int    b_a = inb ? A (imageB, pxb, pyb) : BLACK;
	
	R (result, px, py) = BINOP (a_r, b_r);
	G (result, px, py) = BINOP (a_g, b_g);
	B (result, px, py) = BINOP (a_b, b_b);
	A (result, px, py) = MAX   (a_a, b_a);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_rgba_grey8.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, rgba);
crimp_input (imageBObj, imageB, grey8);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (R (imageA, x, y), GREY8 (imageB, x, y));
	G (result, x, y) = BINOP (G (imageA, x, y), GREY8 (imageB, x, y));
	B (result, x, y) = BINOP (B (imageA, x, y), GREY8 (imageB, x, y));
	A (result, x, y) = A (imageA, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Added cop/binop_rgba_grey8_rgba.c.










































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, rgba);
crimp_input (imageBObj, imageB, grey8);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_r = ina ? R (imageA, pxa, pya) : BLACK;
	int    a_g = ina ? G (imageA, pxa, pya) : BLACK;
	int    a_b = ina ? B (imageA, pxa, pya) : BLACK;
	int    a_a = ina ? A (imageA, pxa, pya) : BLACK;
	int    b_v = inb ? GREY8 (imageB, pxb, pyb) : BLACK;
	int    b_a = inb ? OPAQUE : BLACK;
	
	R (result, px, py) = BINOP (a_r, b_v);
	G (result, px, py) = BINOP (a_g, b_v);
	B (result, px, py) = BINOP (a_b, b_v);
	A (result, px, py) = MAX   (a_a, b_a);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_rgba_rgb.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, rgba);
crimp_input (imageBObj, imageB, rgb);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (R (imageA, x, y), R (imageB, x, y));
	G (result, x, y) = BINOP (G (imageA, x, y), G (imageB, x, y));
	B (result, x, y) = BINOP (B (imageA, x, y), B (imageB, x, y));
	A (result, x, y) = A (imageA, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Added cop/binop_rgba_rgb_rgba.c.














































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, rgba);
crimp_input (imageBObj, imageB, rgb);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_r = ina ? R (imageA, pxa, pya) : BLACK;
	int    a_g = ina ? G (imageA, pxa, pya) : BLACK;
	int    a_b = ina ? B (imageA, pxa, pya) : BLACK;
	int    a_a = ina ? A (imageA, pxa, pya) : BLACK;
	int    b_r = inb ? R (imageB, pxb, pyb) : BLACK;
	int    b_g = inb ? G (imageB, pxb, pyb) : BLACK;
	int    b_b = inb ? B (imageB, pxb, pyb) : BLACK;
	int    b_a = inb ? OPAQUE : BLACK;
	
	R (result, px, py) = BINOP (a_r, b_r);
	G (result, px, py) = BINOP (a_g, b_g);
	B (result, px, py) = BINOP (a_b, b_b);
	A (result, px, py) = MAX   (a_a, b_a);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Deleted cop/binop_rgba_rgba.c.
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA, rgba);
crimp_input (imageBObj, imageB, rgba);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = BINOP (R (imageA, x, y), R (imageB, x, y));
	G (result, x, y) = BINOP (G (imageA, x, y), G (imageB, x, y));
	B (result, x, y) = BINOP (B (imageA, x, y), B (imageB, x, y));
	A (result, x, y) = BINOP (A (imageA, x, y), A (imageB, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Added cop/binop_rgba_rgba_rgba.c.














































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, rgba);
crimp_input (imageBObj, imageB, rgba);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

	int    a_r = ina ? R (imageA, pxa, pya) : BLACK;
	int    a_g = ina ? G (imageA, pxa, pya) : BLACK;
	int    a_b = ina ? B (imageA, pxa, pya) : BLACK;
	int    a_a = ina ? A (imageA, pxa, pya) : BLACK;
	int    b_r = inb ? R (imageB, pxb, pyb) : BLACK;
	int    b_g = inb ? G (imageB, pxb, pyb) : BLACK;
	int    b_b = inb ? B (imageB, pxb, pyb) : BLACK;
	int    b_a = inb ? A (imageB, pxb, pyb) : BLACK;
	
	R (result, px, py) = BINOP (a_r, b_r);
	G (result, px, py) = BINOP (a_g, b_g);
	B (result, px, py) = BINOP (a_b, b_b);
	A (result, px, py) = MAX   (a_a, b_a);
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/binop_template.c.






















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int px, py, lx, ly, oxa, oya, oxb, oyb;
int pxa, pya, pxb, pyb;
crimp_geometry bb;

crimp_input (imageAObj, imageA, @TYPE_A@);
crimp_input (imageBObj, imageB, @TYPE_B@);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageA->geo, &imageB->geo, &bb);

result = crimp_new_@TYPE_Z@_at (bb.x, bb.y, bb.w, bb.h);
oxa = crimp_x (imageA);
oya = crimp_y (imageA);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

#ifndef BINOP_POST
#define BINOP_POST(z) z
#endif

for (py = 0, ly = bb.y, pya = bb.y - oya, pyb = bb.y - oyb;
     py < bb.h;
     py++, ly++, pya++, pyb++) {

    for (px = 0, lx = bb.x, pxa = bb.x - oxa, pxb = bb.x - oxb;
	 px < bb.w;
	 px++, lx++, pxa++, pxb++) {

	int ina = crimp_inside (imageA, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead.
	 */

@TRANSFORM@
    }
}

#undef BINOP
#undef BINOP_POST

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to cop/expand_op.c.
10
11
12
13
14
15
16
17




18
19
20
21
22
23
24
    int          xo, yo, xi, yi;

    if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
	Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
	return TCL_ERROR;
    }

    result = crimp_new (image->itype, image->w + ww + we, image->h + hn + hs);





    /*
     * Nine quadrants to fill:
     *
     * NW N NE
     *  W C E
     * SW S SE







|
>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    int          xo, yo, xi, yi;

    if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
	Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
	return TCL_ERROR;
    }

    result = crimp_new_at (image->itype, 
			   crimp_x (image) - ww,
			   crimp_y (image) - hn,
			   crimp_w (image) + ww + we,
			   crimp_h (image) + hn + hs);

    /*
     * Nine quadrants to fill:
     *
     * NW N NE
     *  W C E
     * SW S SE
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

    /*
     * North.
     */

    if (hn) {
	for (yo = 0; yo < hn; yo++) {
	    for (xo = 0; xo < image->w; xo++) {
		FILL_N (xo + ww, yo);
	    }
	}
    }

    /*
     * North East.
     */

    if (hn && we) {
	for (yo = 0; yo < hn; yo++) {
	    for (xo = 0; xo < we; xo++) {
		FILL_NE (xo + image->w + ww, yo);
	    }
	}
    }

    /*
     * West.
     */

    if (ww) {
	for (xo = 0; xo < ww; xo++) {
	    for (yo = 0; yo < image->h; yo++) {
		FILL_W (xo, yo + hn);
	    }
	}
    }

    /*
     * East.
     */

    if (we) {
	for (xo = 0; xo < we; xo++) {
	    for (yo = 0; yo < image->h; yo++) {
		FILL_E (xo + image->w + ww, yo + hn);
	    }
	}
    }

    /*
     * South West.
     */

    if (hs && ww) {
	for (yo = 0; yo < hs; yo++) {
	    for (xo = 0; xo < ww; xo++) {
		FILL_SW (xo, yo + image->h + hn);
	    }
	}
    }

    /*
     * South.
     */

    if (hs) {
	for (yo = 0; yo < hs; yo++) {
	    for (xo = 0; xo < image->w; xo++) {
		FILL_S (xo + ww, yo + image->h + hn);
	    }
	}
    }

    /*
     * South East.
     */

    if (hs && we) {
	for (yo = 0; yo < hs; yo++) {
	    for (xo = 0; xo < we; xo++) {
		FILL_SE (xo + image->w + ww, yo + image->h + hn);
	    }
	}
    }

    /*
     * Central. Copy of the input image.
     */

    for (yo = hn, yi = 0; yi < image->h; yo++, yi++) {
	for (xo = ww, xi = 0; xi < image->w; xo++, xi++) {
	    COPY (xo, yo, xi, yi);
	}
    }

    Tcl_SetObjResult(interp, crimp_new_image_obj (result));
    return TCL_OK;








|












|










|











|
|











|










|
|











|








|
|







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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

    /*
     * North.
     */

    if (hn) {
	for (yo = 0; yo < hn; yo++) {
	    for (xo = 0; xo < crimp_w (image); xo++) {
		FILL_N (xo + ww, yo);
	    }
	}
    }

    /*
     * North East.
     */

    if (hn && we) {
	for (yo = 0; yo < hn; yo++) {
	    for (xo = 0; xo < we; xo++) {
		FILL_NE (xo + crimp_w (image) + ww, yo);
	    }
	}
    }

    /*
     * West.
     */

    if (ww) {
	for (xo = 0; xo < ww; xo++) {
	    for (yo = 0; yo < crimp_h (image); yo++) {
		FILL_W (xo, yo + hn);
	    }
	}
    }

    /*
     * East.
     */

    if (we) {
	for (xo = 0; xo < we; xo++) {
	    for (yo = 0; yo < crimp_h (image); yo++) {
		FILL_E (xo + crimp_w (image) + ww, yo + hn);
	    }
	}
    }

    /*
     * South West.
     */

    if (hs && ww) {
	for (yo = 0; yo < hs; yo++) {
	    for (xo = 0; xo < ww; xo++) {
		FILL_SW (xo, yo + crimp_h (image) + hn);
	    }
	}
    }

    /*
     * South.
     */

    if (hs) {
	for (yo = 0; yo < hs; yo++) {
	    for (xo = 0; xo < crimp_w (image); xo++) {
		FILL_S (xo + ww, yo + crimp_h (image) + hn);
	    }
	}
    }

    /*
     * South East.
     */

    if (hs && we) {
	for (yo = 0; yo < hs; yo++) {
	    for (xo = 0; xo < we; xo++) {
		FILL_SE (xo + crimp_w (image) + ww, yo + crimp_h (image) + hn);
	    }
	}
    }

    /*
     * Central. Copy of the input image.
     */

    for (yo = hn, yi = 0; yi < crimp_h (image); yo++, yi++) {
	for (xo = ww, xi = 0; xi < crimp_w (image); xo++, xi++) {
	    COPY (xo, yo, xi, yi);
	}
    }

    Tcl_SetObjResult(interp, crimp_new_image_obj (result));
    return TCL_OK;

Added cop/generate.tcl.




















































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
#!/bin/sh
# -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}
# # ## ### ##### ######## ############# ######################
## Requisites

package require Tcl 8.5

# # ## ### ##### ######## ############# ######################
## Configuration

set simple_types {float grey32 grey16 grey8}
set multi_types  {rgb rgba fpcomplex}

array set accessor {
    float     {FLOATP v}
    grey32    {GREY32 v}
    grey16    {GREY16 v}
    grey8     {GREY8  v}
    hsv       {H h S s V v}
    rgb       {R r G g B b}
    rgba      {R r G g B b A a}
    fpcomplex {RE re IM im}
}

array set ctype {
    float     double
    grey32    {int   }
    grey16    {int   }
    grey8     {int   }
    hsv       {int   }
    rgb       {int   }
    rgba      {int   }
    fpcomplex double
}

# # ## ### ##### ######## ############# ######################
## Input

set basedir  [file dirname [file normalize [info script]]]
set template [apply {{template} {
    set c [open $template r]
    set data [read $c]
    close $c
    return $data
}} [file join $basedir binop_template.c]]

# # ## ### ##### ######## ############# ######################
## Generator core.

proc retrieve {type input image zero {expand 0} {alpha {}}} {
    global ctype accessor
    upvar 1 lines lines
    set variables {}

    set vprefix ${input}_
    set guard   in$input
    set ox      px$input
    set oy      py$input

    foreach {get var} $accessor($type) {
	lappend lines "$ctype($type) $vprefix$var = $guard ? $get ($image, $ox, $oy) : $zero;"
	lappend variables $vprefix$var
    }

    if {$expand} {
	set v [lindex $variables end]
	while {[llength $variables] < $expand} { lappend variables $v }
    }

    if {$alpha ne {}} {
	set var a
	lappend lines "$ctype($type) $vprefix$var = $guard ? OPAQUE : $zero;"
	lappend variables $vprefix$var
    }

    return $variables
}

proc assign {type avariables bvariables} {
    upvar 1 lines lines
    global accessor ctype

    lappend lines {}
    foreach av $avariables bv $bvariables {
	set zv z_[lindex [split $av _] end][lindex [split $bv _] end]
	lappend zvariables $zv
	lappend lines "$ctype($type) $zv = BINOP ($av, $bv);"
    }

    lappend lines {}
    foreach {put _} $accessor($type) zv $zvariables av $avariables bv $bvariables {
	lappend lines "$put (result, px, py) = BINOP_POST ($zv);"
    }
    return
}

proc assignA {type avariables bvariables} {
    upvar 1 lines lines
    global accessor

    # Match variable lists.
    while {[llength $bvariables] < [llength $avariables]} { lappend bvariables [lindex $bvariables end] }
    while {[llength $avariables] < [llength $bvariables]} { lappend avariables [lindex $avariables end] }

    lappend lines {}
    foreach {put _} $accessor($type) av $avariables bv $bvariables {
	if {$put eq "A"} {
	    lappend lines "$put (result, px, py) = MAX   ($av, $bv);"
	} else {
	    lappend lines "$put (result, px, py) = BINOP ($av, $bv);"
	}
    }
    return
}

proc gen {a b z} {
    global basedir template
    upvar 1 lines lines

    lappend map @TYPE_A@    $a
    lappend map @TYPE_B@    $b
    lappend map @TYPE_Z@    $z
    lappend map @TRANSFORM@ \t[join $lines \n\t]

    #puts \t[join $lines \n\t]

    set dst [file join $basedir binop_${a}_${b}_${z}.c]
    set ch  [open $dst w]
    puts -nonewline $ch [string map $map $template]
    close $ch
}

proc generate {a b z} {
    global accessor

    puts -nonewline "Generating $z = $a x $b ... "

    set la [dict size $accessor($a)]
    set lb [dict size $accessor($b)]
    set lz [dict size $accessor($z)]

    # .... generation with A channel ...

    if {($la == $lb) && ($la == $lz) &&
	[dict exists $accessor($a) A] &&
	[dict exists $accessor($b) A]} {
	puts {Av/A x Bv/A}
	# A, B vectors, identical length, element-wise operation.

	set av [retrieve $a a imageA BLACK]
	set bv [retrieve $b b imageB BLACK]
	assignA $z $av $bv
	gen $a $b $z
	return
    }

    if {($la > $lb) && ($la == $lz) &&
	[dict exists $accessor($a) A]} {
	puts {Av/A x B}
	# A vector, B scalar/vector expanded to match for element-wise
	# operation, pseudo-alpha for the scalar

	incr la -1
	set av [retrieve $a a imageA BLACK]
	set bv [retrieve $b b imageB BLACK $la alpha]
	assignA $z $av $bv
	gen $a $b $z
	return
    }

    if {($lb > $la) && ($lb == $lz) &&
	[dict exists $accessor($b) A]} {
	puts {A x Bv/A}
	# B vector, A scalar/vector expanded to match for element-wise
	# operation, pseudo-alpha for the scalar

	incr lb -1
	set av [retrieve $a a imageA BLACK $lb alpha]
	set bv [retrieve $b b imageB BLACK]
	assignA $z $av $bv
	gen $a $b $z
	return
    }

    # Generation without A channel.

    if {($la == $lb) && ($la == $lz)} {
	puts {Av x Bv}
	# A, B vectors, identical length, element-wise operation.

	set av [retrieve $a a imageA BLACK]
	set bv [retrieve $b b imageB BLACK]
	assign $z $av $bv
	gen $a $b $z
	return
    }

    if {($la > $lb) && ($la == $lz) && ($lb == 1)} {
	puts {Av x B}
	# A vector, B scalar expanded to match for element-wise operation

	set av [retrieve $a a imageA BLACK]
	set bv [retrieve $b b imageB BLACK $la]
	assign $z $av $bv
	gen $a $b $z
	return
    }

    if {($lb > $la) && ($lb == $lz) && ($la == 1)} {
	puts {A x Bv}
	# B vector, A scalar expanded to match for element-wise operation

	set av [retrieve $a a imageA BLACK $lb]
	set bv [retrieve $b b imageB BLACK]
	assign $z $av $bv
	gen $a $b $z
	return
    }

    puts "ERR"
    return -code error "Bad configuration ($z = $a x $b)"
}

# # ## ### ##### ######## ############# ######################
## Generate the various configurations

# # ## ### ##### ######## ############# ######################
## Simple vs simple.

generate float     float     float
generate float     grey16    float
generate float     grey32    float
generate float     grey8     float

generate grey16    float     float
generate grey16    grey16    grey16
generate grey16    grey32    grey32
generate grey16    grey8     grey16

generate grey32    float     float
generate grey32    grey16    grey32
generate grey32    grey32    grey32
generate grey32    grey8     grey32

generate grey8     float     float
generate grey8     grey16    grey16
generate grey8     grey32    grey32
generate grey8     grey8     grey8

# # ## ### ##### ######## ############# ######################
## Some operation always generate float, regardless of input types
## Examples: hypot, atan2, pow.

generate grey16    grey16    float
generate grey16    grey32    float
generate grey16    grey8     float

generate grey32    grey16    float
generate grey32    grey32    float
generate grey32    grey8     float

generate grey8     grey16    float
generate grey8     grey32    float
generate grey8     grey8     float

# # ## ### ##### ######## ############# ######################
## Thresholding against spatial floating point.

generate grey8     float     grey8
generate grey16    float     grey16
generate grey32    float     grey32

# # ## ### ##### ######## ############# ######################
## Complex vs. others, self and simple.

generate fpcomplex fpcomplex fpcomplex

generate fpcomplex float     fpcomplex
generate fpcomplex grey16    fpcomplex
generate fpcomplex grey32    fpcomplex
generate fpcomplex grey8     fpcomplex

generate float     fpcomplex fpcomplex
generate grey16    fpcomplex fpcomplex
generate grey32    fpcomplex fpcomplex
generate grey8     fpcomplex fpcomplex

# # ## ### ##### ######## ############# ######################
## RGB vs others, self and simple (grey8 only).

generate rgb       rgb       rgb

generate grey8     rgb       rgb
generate rgb       grey8     rgb

# # ## ### ##### ######## ############# ######################

generate hsv       hsv       hsv

# # ## ### ##### ######## ############# ######################
## RGBA vs self, RGB, and simple (grey8 only).

generate rgba  rgba  rgba

generate grey8 rgba  rgba
generate rgba  grey8 rgba

generate rgb   rgba  rgba
generate rgba  rgb   rgba

# # ## ### ##### ######## ############# ######################
exit

Added cop/generate_unary.tcl.
































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/sh
# -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}
# # ## ### ##### ######## ############# ######################
## Requisites

package require Tcl 8.5

# # ## ### ##### ######## ############# ######################
## Configuration

set simple_types {float grey32 grey16 grey8}
set multi_types  {rgb rgba fpcomplex}

array set accessor {
    float     {FLOATP v}
    grey32    {GREY32 v}
    grey16    {GREY16 v}
    grey8     {GREY8  v}
    hsv       {H h S s V v}
    rgb       {R r G g B b}
    rgba      {R r G g B b A a}
    fpcomplex {RE re IM im}
}

array set ctype {
    float     double
    grey32    int
    grey16    int
    grey8     int
    hsv       int
    rgb       int
    rgba      int
    fpcomplex double
}

# # ## ### ##### ######## ############# ######################
## Input

set basedir  [file dirname [file normalize [info script]]]
set template [apply {{template} {
    set c [open $template r]
    set data [read $c]
    close $c
    return $data
}} [file join $basedir unop_template.c]]

# # ## ### ##### ######## ############# ######################
## Generator core.

proc retrieve {type image zero {expand 0} {alpha {}}} {
    global ctype accessor
    upvar 1 lines lines
    set variables {}

    set vprefix _
    set guard   inside
    set ox      pxi
    set oy      pyi

    foreach {get var} $accessor($type) {
	lappend lines "$ctype($type) $vprefix$var = $guard ? $get ($image, $ox, $oy) : $zero;"
	lappend variables $vprefix$var
    }

    if {$expand} {
	set v [lindex $variables end]
	while {[llength $variables] < $expand} { lappend variables $v }
    }

    if {$alpha ne {}} {
	set var a
	lappend lines "$ctype($type) $vprefix$var = $guard ? OPAQUE : $zero;"
	lappend variables $vprefix$var
    }

    return $variables
}

proc assign {type avariables} {
    upvar 1 lines lines
    global accessor

    lappend lines {}
    foreach {put _} $accessor($type) av $avariables {
	lappend lines "$put (result, px, py) = UNOP ($av);"
    }
    return
}

proc assignA {type avariables} {
    upvar 1 lines lines
    global accessor

    lappend lines {}
    foreach {put _} $accessor($type) av $avariables {
	if {$put eq "A"} {
	    lappend lines "$put (result, px, py) = $av;"
	} else {
	    lappend lines "$put (result, px, py) = UNOP ($av);"
	}
    }
    return
}

proc gen {a z} {
    global basedir template
    upvar 1 lines lines

    lappend map @TYPE_IN@    $a
    lappend map @TYPE_OUT@   $z
    lappend map @TRANSFORM@ \t[join $lines \n\t]

    #puts \t[join $lines \n\t]

    set dst [file join $basedir unop_${a}.c]
    set ch  [open $dst w]
    puts -nonewline $ch [string map $map $template]
    close $ch
}

proc generate {a z} {
    global accessor

    puts -nonewline "Generating $z = $a ... "

    set la [dict size $accessor($a)]
    set lz [dict size $accessor($z)]

    # .... generation with A channel ...

    if {($la == $lz) &&
	[dict exists $accessor($a) A]} {
	puts {Av/A}
	# A vector, element-wise operation.

	set av [retrieve $a image BLACK]
	assignA $z $av
	gen $a $z
	return
    }

    # Generation without A channel.

    if {($la == $lz)} {
	puts {Av}
	# A vector, element-wise operation.

	set av [retrieve $a image BLACK]
	assign $z $av
	gen $a $z
	return
    }

    puts "ERR"
    return -code error "Bad configuration ($z = $a x $b)"
}

# # ## ### ##### ######## ############# ######################
## Generate the various configurations

# # ## ### ##### ######## ############# ######################

generate float     float
generate grey16    grey16
generate grey32    grey32
generate grey8     grey8

generate fpcomplex fpcomplex
generate rgb       rgb
generate rgba      rgba
generate hsv       hsv

# # ## ### ##### ######## ############# ######################
exit

Changes to cop/map_scalar.c.
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
 * #define OTYPE     unsigned char
 * (or whatever types are appropriate to the current instance)
 */

#define MAPNAME2(IN,OUT) crimp_piecewise_linear_map_ ## IN ## _ ## OUT
#define MAPNAME(IN,OUT) MAPNAME2(IN,OUT)

#define NEWNAME2(OUT) crimp_new_ ## OUT
#define NEWNAME(OUT) NEWNAME2(OUT)

#define STRINGIZE2(NAME) #NAME
#define STRINGIZE(NAME) STRINGIZE2(NAME)

crimp_image* inImage;
crimp_image* resultImage;

crimp_input(inImageObj, inImage, INTYPENAME);

resultImage = NEWNAME(OUTTYPENAME)(inImage->w, inImage->h);


if (MAPNAME(INTYPENAME,OUTTYPENAME)(interp,
				    mapObj,
				    (size_t) (inImage->w * inImage->h),
		                    (const INTYPE*)inImage->pixel, 
                                    (size_t) 1,
				    (OUTTYPE*)resultImage->pixel, 
                                    (size_t) 1)
    != TCL_OK) {
    return TCL_ERROR;
}







|










|
>



|







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
 * #define OTYPE     unsigned char
 * (or whatever types are appropriate to the current instance)
 */

#define MAPNAME2(IN,OUT) crimp_piecewise_linear_map_ ## IN ## _ ## OUT
#define MAPNAME(IN,OUT) MAPNAME2(IN,OUT)

#define NEWNAME2(OUT) crimp_new_ ## OUT ## _at
#define NEWNAME(OUT) NEWNAME2(OUT)

#define STRINGIZE2(NAME) #NAME
#define STRINGIZE(NAME) STRINGIZE2(NAME)

crimp_image* inImage;
crimp_image* resultImage;

crimp_input(inImageObj, inImage, INTYPENAME);

resultImage = NEWNAME(OUTTYPENAME)(crimp_x (inImage), crimp_y (inImage),
				   crimp_w (inImage), crimp_h (inImage));

if (MAPNAME(INTYPENAME,OUTTYPENAME)(interp,
				    mapObj,
				    (size_t) (crimp_w (inImage) * crimp_h (inImage)),
		                    (const INTYPE*)inImage->pixel, 
                                    (size_t) 1,
				    (OUTTYPE*)resultImage->pixel, 
                                    (size_t) 1)
    != TCL_OK) {
    return TCL_ERROR;
}
Added cop/unop_float.c.






































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, float);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_float_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	double _v = inside ? FLOATP (image, pxi, pyi) : BLACK;
	
	FLOATP (result, px, py) = UNOP (_v);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_fpcomplex.c.










































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, fpcomplex);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_fpcomplex_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	double _re = inside ? RE (image, pxi, pyi) : BLACK;
	double _im = inside ? IM (image, pxi, pyi) : BLACK;
	
	RE (result, px, py) = UNOP (_re);
	IM (result, px, py) = UNOP (_im);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_grey16.c.






































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, grey16);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_grey16_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	int _v = inside ? GREY16 (image, pxi, pyi) : BLACK;
	
	GREY16 (result, px, py) = UNOP (_v);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_grey32.c.






































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, grey32);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_grey32_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	int _v = inside ? GREY32 (image, pxi, pyi) : BLACK;
	
	GREY32 (result, px, py) = UNOP (_v);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_grey8.c.






































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, grey8);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_grey8_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	int _v = inside ? GREY8 (image, pxi, pyi) : BLACK;
	
	GREY8 (result, px, py) = UNOP (_v);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_hsv.c.














































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, hsv);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_hsv_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	int _h = inside ? H (image, pxi, pyi) : BLACK;
	int _s = inside ? S (image, pxi, pyi) : BLACK;
	int _v = inside ? V (image, pxi, pyi) : BLACK;
	
	H (result, px, py) = UNOP (_h);
	S (result, px, py) = UNOP (_s);
	V (result, px, py) = UNOP (_v);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_rgb.c.














































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, rgb);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_rgb_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	int _r = inside ? R (image, pxi, pyi) : BLACK;
	int _g = inside ? G (image, pxi, pyi) : BLACK;
	int _b = inside ? B (image, pxi, pyi) : BLACK;
	
	R (result, px, py) = UNOP (_r);
	G (result, px, py) = UNOP (_g);
	B (result, px, py) = UNOP (_b);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_rgba.c.


















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, rgba);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_rgba_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

	int _r = inside ? R (image, pxi, pyi) : BLACK;
	int _g = inside ? G (image, pxi, pyi) : BLACK;
	int _b = inside ? B (image, pxi, pyi) : BLACK;
	int _a = inside ? A (image, pxi, pyi) : BLACK;
	
	R (result, px, py) = UNOP (_r);
	G (result, px, py) = UNOP (_g);
	B (result, px, py) = UNOP (_b);
	A (result, px, py) = _a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added cop/unop_template.c.


































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* x, y, w, h - Parameters of the output image. Provided by caller */

crimp_image*     result;
crimp_image*     image;

int px, py, lx, ly, ox, oy, pxi, pyi;

crimp_input (imageObj, image, @TYPE_IN@);

/*
 * Get the area of the input image to process.
 */

result = crimp_new_@TYPE_OUT@_at (x, y, w, h);
ox = crimp_x (image);
oy = crimp_y (image);

/*
 * px, py are physical coordinates in the result, starting from 0. The
 * associated logical coordinates in the 2D plane are
 *
 *  lx = px + x(result)
 *  lx = py + y(result)
 *
 * And when we are inside an input its physical coordinates, from the logical
 * are
 *
 *  px' = lx - x(input)
 *  py' = ly - y(input)
 *
 * Important to note, we can compute all these directly as loop variables, as
 * they are all linearly related to each other.
 */

for (py = 0, ly = y, pyi = y - oy;
     py < h;
     py++, ly++, pyi++) {

    for (px = 0, lx = x, pxi = x - ox;
	 px < w;
	 px++, lx++, pxi++) {

	int inside = crimp_inside (image, lx, ly);

	/*
	 * The result depends on where we are relative to the input. Inside
	 * of the input we take the respective value of the pixel. Outside of
	 * the input we take BLACK as the value instead.
	 */

@TRANSFORM@
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added core/at.crimp.














































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
at
Tcl_Obj* imageObj

crimp_image* image;
Tcl_Obj* list [2];

crimp_input_any (imageObj, image);

list [0] = Tcl_NewIntObj (crimp_x(image));
list [1] = Tcl_NewIntObj (crimp_y(image));

Tcl_SetObjResult (interp, Tcl_NewListObj (2, list));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added core/bbox2.crimp.


































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
bbox2
int ax
int ay
int aw
int ah
int bx
int by
int bw
int bh

crimp_geometry a;
crimp_geometry b;
crimp_geometry z;
Tcl_Obj* list [4];

/*
 * Compute union area of the two geometries to process.
 */

a.x = ax; b.x = bx;
a.y = ay; b.y = by;
a.w = aw; b.w = bw;
a.h = ah; b.h = bh;

crimp_rect_union (&a, &b, &z);

list [0] = Tcl_NewIntObj (z.x);
list [1] = Tcl_NewIntObj (z.y);
list [2] = Tcl_NewIntObj (z.w);
list [3] = Tcl_NewIntObj (z.h);

Tcl_SetObjResult (interp, Tcl_NewListObj (4, list));
return TCL_OK;
Changes to core/dimensions.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
dimensions
Tcl_Obj* imageObj

crimp_image* image;
Tcl_Obj* list [2];

crimp_input_any (imageObj, image);

list [0] = Tcl_NewIntObj (image->w);
list [1] = Tcl_NewIntObj (image->h);

Tcl_SetObjResult (interp, Tcl_NewListObj (2, list));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*








|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
dimensions
Tcl_Obj* imageObj

crimp_image* image;
Tcl_Obj* list [2];

crimp_input_any (imageObj, image);

list [0] = Tcl_NewIntObj (crimp_w (image));
list [1] = Tcl_NewIntObj (crimp_h (image));

Tcl_SetObjResult (interp, Tcl_NewListObj (2, list));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
Added core/geometry.crimp.


















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
geometry
Tcl_Obj* imageObj

crimp_image* image;
Tcl_Obj* list [4];

crimp_input_any (imageObj, image);

list [0] = Tcl_NewIntObj (crimp_x (image));
list [1] = Tcl_NewIntObj (crimp_y (image));
list [2] = Tcl_NewIntObj (crimp_w (image));
list [3] = Tcl_NewIntObj (crimp_h (image));

Tcl_SetObjResult (interp, Tcl_NewListObj (4, list));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to core/height.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
height
Tcl_Obj* imageObj

crimp_image* image;

crimp_input_any (imageObj, image);

Tcl_SetObjResult (interp, Tcl_NewIntObj (image->h));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
height
Tcl_Obj* imageObj

crimp_image* image;

crimp_input_any (imageObj, image);

Tcl_SetObjResult (interp, Tcl_NewIntObj (crimp_h (image)));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
Changes to core/meta_set.crimp.
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
}

/*
 * Create a new image with the modified meta data reference and otherwise
 * identical.
 */

image = crimp_newm (image->itype, image->w, image->h, metaObj);

Tcl_SetObjResult(interp, crimp_new_image_obj (image));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
}

/*
 * Create a new image with the modified meta data reference and otherwise
 * identical.
 */

image = crimp_newm (image->itype, crimp_w(image), crimp_h(image), metaObj);

Tcl_SetObjResult(interp, crimp_new_image_obj (image));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
Changes to core/pixel.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pixel
Tcl_Obj* imageObj

crimp_image*   image;
unsigned char* bytes;
int            length;

crimp_input_any (imageObj, image);

bytes  = image->pixel;
length = image->w * image->h * image->itype->size;

Tcl_SetObjResult (interp, Tcl_NewByteArrayObj (bytes, length));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pixel
Tcl_Obj* imageObj

crimp_image*   image;
unsigned char* bytes;
int            length;

crimp_input_any (imageObj, image);

bytes  = image->pixel;
length = crimp_image_area(image) * image->itype->size;

Tcl_SetObjResult (interp, Tcl_NewByteArrayObj (bytes, length));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
Added core/place.crimp.
















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
place
Tcl_Obj* imageObj
int x
int y

crimp_image* image;

crimp_input_any (imageObj, image);

image = crimp_dup (image);
crimp_place (image, x, y);

Tcl_SetObjResult (interp, crimp_new_image_obj(image));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to core/width.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
width
Tcl_Obj* imageObj

crimp_image* image;

crimp_input_any (imageObj, image);

Tcl_SetObjResult (interp, Tcl_NewIntObj (image->w));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
width
Tcl_Obj* imageObj

crimp_image* image;

crimp_input_any (imageObj, image);

Tcl_SetObjResult (interp, Tcl_NewIntObj (crimp_w (image)));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
Changes to core/write-tcl-complex.crimp.
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
write::Str_tcl_fpcomplex
Tcl_Obj* imageObj

Tcl_Obj*           res;
Tcl_Obj*           line;
Tcl_Obj*           pair;
crimp_image*       image;
int x, y;

crimp_input (imageObj, image, fpcomplex);

res = Tcl_NewListObj (0, NULL);

for (y = 0; y < image->h; y++) {

    line = Tcl_NewListObj (0, NULL);

    for (x = 0; x < image->w; x++) {
	double re = RE (image, x, y);
	double im = IM (image, x, y);

	pair = Tcl_NewListObj (0, NULL);

	Tcl_ListObjAppendElement (interp, pair, Tcl_NewDoubleObj (re));
	Tcl_ListObjAppendElement (interp, pair, Tcl_NewDoubleObj (im));













|



|







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
write::Str_tcl_fpcomplex
Tcl_Obj* imageObj

Tcl_Obj*           res;
Tcl_Obj*           line;
Tcl_Obj*           pair;
crimp_image*       image;
int x, y;

crimp_input (imageObj, image, fpcomplex);

res = Tcl_NewListObj (0, NULL);

for (y = 0; y < crimp_h(image); y++) {

    line = Tcl_NewListObj (0, NULL);

    for (x = 0; x < crimp_w(image); x++) {
	double re = RE (image, x, y);
	double im = IM (image, x, y);

	pair = Tcl_NewListObj (0, NULL);

	Tcl_ListObjAppendElement (interp, pair, Tcl_NewDoubleObj (re));
	Tcl_ListObjAppendElement (interp, pair, Tcl_NewDoubleObj (im));
Changes to core/write-tcl-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
write::Str_tcl_float
Tcl_Obj* imageObj

Tcl_Obj*           res;
Tcl_Obj*           line;
crimp_image*       image;
int x, y;

crimp_input (imageObj, image, float);

res = Tcl_NewListObj (0, NULL);

for (y = 0; y < image->h; y++) {

    line = Tcl_NewListObj (0, NULL);

    for (x = 0; x < image->w; x++) {
	Tcl_ListObjAppendElement (interp, line,
				  Tcl_NewDoubleObj (FLOATP (image, x, y)));

    }
    Tcl_ListObjAppendElement (interp, res, line);
}













|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
write::Str_tcl_float
Tcl_Obj* imageObj

Tcl_Obj*           res;
Tcl_Obj*           line;
crimp_image*       image;
int x, y;

crimp_input (imageObj, image, float);

res = Tcl_NewListObj (0, NULL);

for (y = 0; y < crimp_h(image); y++) {

    line = Tcl_NewListObj (0, NULL);

    for (x = 0; x < crimp_w(image); x++) {
	Tcl_ListObjAppendElement (interp, line,
				  Tcl_NewDoubleObj (FLOATP (image, x, y)));

    }
    Tcl_ListObjAppendElement (interp, res, line);
}

Added core/x.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
x
Tcl_Obj* imageObj

crimp_image* image;

crimp_input_any (imageObj, image);

Tcl_SetObjResult (interp, Tcl_NewIntObj (crimp_x (image)));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added core/y.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
y
Tcl_Obj* imageObj

crimp_image* image;

crimp_input_any (imageObj, image);

Tcl_SetObjResult (interp, Tcl_NewIntObj (crimp_y (image)));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to crimp.tcl.
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
## them up too in the ensembles.

critcl::tsources policy.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. types and stubs)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>







|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
## them up too in the ensembles.

critcl::tsources policy.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. types and stubs)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>
199
200
201
202
203
204
205
206
207
208
209

if {![critcl::load]} {
    error "Building and loading CRIMP failed."
}

# # ## ### ##### ######## #############

package provide crimp 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



199
200
201
202
203
204
205
206
207
208
209

if {![critcl::load]} {
    error "Building and loading CRIMP failed."
}

# # ## ### ##### ######## #############

package provide crimp 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_bmp.tcl.
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
## them up too in the ensembles.

critcl::tsources policy_bmp.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/bmp.c







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
## them up too in the ensembles.

critcl::tsources policy_bmp.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/bmp.c
83
84
85
86
87
88
89
90
91
92
93

if {![critcl::load]} {
    error "Building and loading CRIMP::BMP failed."
}

# # ## ### ##### ######## #############

package provide crimp::bmp 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



83
84
85
86
87
88
89
90
91
92
93

if {![critcl::load]} {
    error "Building and loading CRIMP::BMP failed."
}

# # ## ### ##### ######## #############

package provide crimp::bmp 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_core.tcl.
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
    crimp_imagetype** imagetype
}

# - -- --- ----- -------- -------------
## image.h

# API :: Core. Image lifecycle management.
critcl::api function crimp_image* crimp_new {
    {const crimp_imagetype*} type


    int w
    int h
}
critcl::api function crimp_image* crimp_newm {
    {const crimp_imagetype*} type


    int w
    int h
    Tcl_Obj* meta
}

critcl::api function crimp_image* crimp_dup  {
    crimp_image* image
}
critcl::api function void crimp_del {
    crimp_image* image
}








|

>
>



|

>
>




>







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
    crimp_imagetype** imagetype
}

# - -- --- ----- -------- -------------
## image.h

# API :: Core. Image lifecycle management.
critcl::api function crimp_image* crimp_new_at {
    {const crimp_imagetype*} type
    int x
    int y
    int w
    int h
}
critcl::api function crimp_image* crimp_newm_at {
    {const crimp_imagetype*} type
    int x
    int y
    int w
    int h
    Tcl_Obj* meta
}

critcl::api function crimp_image* crimp_dup  {
    crimp_image* image
}
critcl::api function void crimp_del {
    crimp_image* image
}

128
129
130
131
132
133
134
135
136



137
138
139
140
141
142



143
144
145
146
147

148
149
150
151
152
153
154
    crimp_image** image
}

# - -- --- ----- -------- -------------
## volume.h

# API :: Core. Volume lifecycle management.
critcl::api function crimp_volume* crimp_vnew {
    {const crimp_imagetype*} type



    int w
    int h
    int d
}
critcl::api function crimp_volume* crimp_vnewm {
    {const crimp_imagetype*} type



    int w
    int h
    int d
    Tcl_Obj* meta
}

critcl::api function crimp_volume* crimp_vdup {
    crimp_volume* volume
}
critcl::api function void crimp_vdel {
    crimp_volume* volume
}








|

>
>
>




|

>
>
>





>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    crimp_image** image
}

# - -- --- ----- -------- -------------
## volume.h

# API :: Core. Volume lifecycle management.
critcl::api function crimp_volume* crimp_vnew_at {
    {const crimp_imagetype*} type
    int x
    int y
    int z
    int w
    int h
    int d
}
critcl::api function crimp_volume* crimp_vnewm_at {
    {const crimp_imagetype*} type
    int x
    int y
    int z
    int w
    int h
    int d
    Tcl_Obj* meta
}

critcl::api function crimp_volume* crimp_vdup {
    crimp_volume* volume
}
critcl::api function void crimp_vdel {
    crimp_volume* volume
}

285
286
287
288
289
290
291
292
293
294
295

if {![critcl::load]} {
    error "Building and loading CRIMP failed."
}

# # ## ### ##### ######## #############

package provide crimp::core 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



297
298
299
300
301
302
303
304
305
306
307

if {![critcl::load]} {
    error "Building and loading CRIMP failed."
}

# # ## ### ##### ######## #############

package provide crimp::core 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_pcx.tcl.
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## them up too in the ensembles.

critcl::tsources policy_pcx.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/pcx.c







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## them up too in the ensembles.

critcl::tsources policy_pcx.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/pcx.c
79
80
81
82
83
84
85
86
87
88
89

if {![critcl::load]} {
    error "Building and loading CRIMP::PCX failed."
}

# # ## ### ##### ######## #############

package provide crimp::pcx 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



79
80
81
82
83
84
85
86
87
88
89

if {![critcl::load]} {
    error "Building and loading CRIMP::PCX failed."
}

# # ## ### ##### ######## #############

package provide crimp::pcx 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_pfm.tcl.
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
## them up too in the ensembles.

critcl::tsources policy_pfm.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>







|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
## them up too in the ensembles.

critcl::tsources policy_pfm.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>
83
84
85
86
87
88
89
90
91
92
93

if {![critcl::load]} {
    error "Building and loading CRIMP::PFM failed."
}

# # ## ### ##### ######## #############

package provide crimp::pfm 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



83
84
85
86
87
88
89
90
91
92
93

if {![critcl::load]} {
    error "Building and loading CRIMP::PFM failed."
}

# # ## ### ##### ######## #############

package provide crimp::pfm 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_pgm.tcl.
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## them up too in the ensembles.

critcl::tsources policy_pgm.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## them up too in the ensembles.

critcl::tsources policy_pgm.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>
81
82
83
84
85
86
87
88
89
90
91

if {![critcl::load]} {
    error "Building and loading CRIMP::PGM failed."
}

# # ## ### ##### ######## #############

package provide crimp::pgm 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



81
82
83
84
85
86
87
88
89
90
91

if {![critcl::load]} {
    error "Building and loading CRIMP::PGM failed."
}

# # ## ### ##### ######## #############

package provide crimp::pgm 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_ppm.tcl.
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## them up too in the ensembles.

critcl::tsources policy_ppm.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## them up too in the ensembles.

critcl::tsources policy_ppm.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>
81
82
83
84
85
86
87
88
89
90
91

if {![critcl::load]} {
    error "Building and loading CRIMP::PPM failed."
}

# # ## ### ##### ######## #############

package provide crimp::ppm 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



81
82
83
84
85
86
87
88
89
90
91

if {![critcl::load]} {
    error "Building and loading CRIMP::PPM failed."
}

# # ## ### ##### ######## #############

package provide crimp::ppm 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_sgi.tcl.
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## them up too in the ensembles.

critcl::tsources policy_sgi.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/sgi.c







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## them up too in the ensembles.

critcl::tsources policy_sgi.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/sgi.c
80
81
82
83
84
85
86
87
88
89
90

if {![critcl::load]} {
    error "Building and loading CRIMP::SGI failed."
}

# # ## ### ##### ######## #############

package provide crimp::sgi 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



80
81
82
83
84
85
86
87
88
89
90

if {![critcl::load]} {
    error "Building and loading CRIMP::SGI failed."
}

# # ## ### ##### ######## #############

package provide crimp::sgi 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_sun.tcl.
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## them up too in the ensembles.

critcl::tsources policy_sun.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/sun.c







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## them up too in the ensembles.

critcl::tsources policy_sun.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {}

critcl::csources format/sun.c
80
81
82
83
84
85
86
87
88
89
90

if {![critcl::load]} {
    error "Building and loading CRIMP::SUN failed."
}

# # ## ### ##### ######## #############

package provide crimp::sun 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



80
81
82
83
84
85
86
87
88
89
90

if {![critcl::load]} {
    error "Building and loading CRIMP::SUN failed."
}

# # ## ### ##### ######## #############

package provide crimp::sun 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to crimp_tk.tcl.
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
## Chart helpers.

critcl::tsources plot.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.1

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>







|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
## Chart helpers.

critcl::tsources plot.tcl

# # ## ### ##### ######## #############
## C-level API (i.e. stubs and types)

critcl::api import crimp::core 0.2

# # ## ### ##### ######## #############
## Main C section.

critcl::ccode {
    #include <math.h>
    #include <stdlib.h>
89
90
91
92
93
94
95
96
97
98
99

if {![critcl::load]} {
    error "Building and loading CRIMP::TK failed."
}

# # ## ### ##### ######## #############

package provide crimp::tk 0.1.1
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:







|



89
90
91
92
93
94
95
96
97
98
99

if {![critcl::load]} {
    error "Building and loading CRIMP::TK failed."
}

# # ## ### ##### ######## #############

package provide crimp::tk 0.2
return

# vim: set sts=4 sw=4 tw=80 et ft=tcl:
Changes to demos.tcl.
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
    set w $r ; incr w $r
    set h $r ; incr h $r

    incr x -$r
    incr y -$r

    # Now the block is explicity specified as rectangle with top-left
    # corner at x,y and width, height.

    # This may be outside of the image borders. We now shrink the
    # rectangle to fit the borders, and record this as expansion to be
    # done after extraction.

    set l 0 ; set r 0 ; set t 0 ; set b 0

    set iw [crimp width  $i]
    set ih [crimp height $i]

    # Completely outside.
    if {($x >= $iw) ||
	($y >= $ih) ||
	(($x+$w) < 0) ||
	(($y+$h) < 0)} {
	return [crimp blank [crimp::TypeOf $i] $w $h 0]
    }

    # At least partially inside. We cut the rectangle down to be
    # completely inside and remember how much was cut at each edge.
    if {$x < 0} {
	set  l [expr {- $x}]
	incr w $x
	set  x 0
    }
    if {$y < 0} {
	set  t [expr {- $y}]
	incr h $y
	set  y 0
    }

    if {($x+$w) >= $iw} {
	set  r [expr {($x+$w) - $iw}]
	incr w -$r
    }
    if {($y+$h) >= $ih} {
	set  b [expr {($y+$h) - $ih}]
	incr h -$b
    }

    # Cut (possibly shrunken) region, then expand the region back to
    # the full size, using black outside of the input.
    return [crimp expand const \
		[crimp cut $i $x $y $w $h] \
		$l $t $r $b 0]
}

proc gui {} {
    mag_init
    widgets
    layout
    bindings







|
|
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<







504
505
506
507
508
509
510
511
512



513

514


515






516


























517

518
519
520
521
522
523
524
    set w $r ; incr w $r
    set h $r ; incr h $r

    incr x -$r
    incr y -$r

    # Now the block is explicity specified as rectangle with top-left
    # corner at x,y and width,height; and x,y is relative to the
    # top-left corner of the input image. We can call cut directly,



    # without thinking about image borders. This is all handled inside

    # of the operation, filling BLACK into the parts which lay outside


    # of the input image.

































    return [crimp cut $i $x $y $w $h]

}

proc gui {} {
    mag_init
    widgets
    layout
    bindings
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905

proc show_image {image} {
    slide_stop
    #display [crimp gamma $image 2.2]
    #display [crimp degamma $image 2.2]
    display $image
    log TYPE=[crimp type       $image]
    log DIM_=[crimp dimensions $image]
    log META=[crimp::meta_get  $image]
    return
}

proc display {image} {
    global mag_base mag_bdef
    .c configure -scrollregion [list 0 0 {*}[crimp dimensions $image]]







|







852
853
854
855
856
857
858
859
860
861
862
863
864
865
866

proc show_image {image} {
    slide_stop
    #display [crimp gamma $image 2.2]
    #display [crimp degamma $image 2.2]
    display $image
    log TYPE=[crimp type       $image]
    log "DIM_=[crimp dimensions $image] @ [crimp at $image]"
    log META=[crimp::meta_get  $image]
    return
}

proc display {image} {
    global mag_base mag_bdef
    .c configure -scrollregion [list 0 0 {*}[crimp dimensions $image]]
Added demos/add-translated.tcl.


























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
def op_add_translated {
    label Add/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show
    }
    setup {
	variable scale  1
	variable offset 0

	proc show {args} {
	    variable scale
	    variable offset

	    show_image [crimp alpha opaque \
			    [crimp add \
				 [crimp place [base 0] -50 -50] \
				 [crimp place [base 1]  60  70] \
				 $scale $offset]]
	    return
	}

	scale .left.s -variable ::DEMO::scale  -from 1 -to 255 -orient vertical -command ::DEMO::show
	scale .left.o -variable ::DEMO::offset -from 0 -to 255 -orient vertical -command ::DEMO::show

	pack .left.s -side left -expand 1 -fill both
	pack .left.o -side left -expand 1 -fill both
    }
}
Changes to demos/add.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def op_add {
    label Add
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show
    }
    setup {
	variable scale  1
	variable offset 0



|
<
<
<
<
<







1
2
3





4
5
6
7
8
9
10
def op_add {
    label Add
    active { expr { [bases] == 2 } }





    setup_image {
	show
    }
    setup {
	variable scale  1
	variable offset 0

Changes to demos/blend_hsv.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def op_alpha_blend_hsv {
    label {Blend HSV}
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup {
	# We manage a cache of the blended images to make the
	# scrolling of the scale smoother over time. An improvement
	# would be to use timer events to precompute the various
	# blends.
	variable  cache
	array set cache {}


|
<
<
<
<
<







1
2
3





4
5
6
7
8
9
10
def op_alpha_blend_hsv {
    label {Blend HSV}
    active { expr { [bases] == 2 } }





    setup {
	# We manage a cache of the blended images to make the
	# scrolling of the scale smoother over time. An improvement
	# would be to use timer events to precompute the various
	# blends.
	variable  cache
	array set cache {}
Added demos/blend_hsv_translated.tcl.












































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
def op_alpha_blend_hsv_translated {
    label {Blend HSV/Translated}
    active { expr { [bases] == 2 } }
    setup {
	# We manage a cache of the blended images to make the
	# scrolling of the scale smoother over time. An improvement
	# would be to use timer events to precompute the various
	# blends.
	variable  cache
	array set cache {}
	set cache(255) [crimp place [base 0]  50  40]
	set cache(0)   [crimp place [base 1] -40 -50]
	variable fore  [crimp place [crimp convert 2hsv [base 0]]  50  40]
	variable back  [crimp place [crimp convert 2hsv [base 1]] -40 -50]
	variable alpha 255

	scale .left.s -variable DEMO::alpha \
	    -from 0 -to 255 \
	    -orient vertical \
	    -command [list ::apply {{thealpha} {
		variable cache
		variable fore
		variable back

		if {[info exists cache($thealpha)]} {
		    show_image  $cache($thealpha)
		    return
		}

		set theblend [crimp convert 2rgb [crimp alpha blend $fore $back $thealpha]]
		set cache($thealpha) $theblend
		show_image $theblend
		return
	    } ::DEMO}]

	pack .left.s -side left -fill both -expand 1
    }
}
Changes to demos/blend_rgb.tcl.
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
def op_alpha_blend_rgb {
    label {Blend RGB}
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup {
	# We manage a cache of the blended images to make the
	# scrolling of the scale smoother over time. An improvement
	# would be to use timer events to precompute the various
	# blends.
	variable  cache
	array set cache {}
	set cache(255) [base 0]
	set cache(0)   [base 1]


	variable alpha 255

	scale .left.s -variable DEMO::alpha \
	    -from 0 -to 255 \
	    -orient vertical \
	    -command [list ::apply {{thealpha} {
		variable cache



		if {[info exists cache($thealpha)]} {
		    show_image  $cache($thealpha)
		    return
		}

		set theblend [crimp alpha blend [base 0] [base 1] $thealpha]
		set cache($thealpha) $theblend
		show_image $theblend
		return
	    } ::DEMO}]

	pack .left.s -side left -fill both -expand 1
    }


|
<
<
<
<
<









>
>







>
>






|







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
def op_alpha_blend_rgb {
    label {Blend RGB}
    active { expr { [bases] == 2 } }





    setup {
	# We manage a cache of the blended images to make the
	# scrolling of the scale smoother over time. An improvement
	# would be to use timer events to precompute the various
	# blends.
	variable  cache
	array set cache {}
	set cache(255) [base 0]
	set cache(0)   [base 1]
	variable fore  $cache(255)
	variable back  $cache(0)
	variable alpha 255

	scale .left.s -variable DEMO::alpha \
	    -from 0 -to 255 \
	    -orient vertical \
	    -command [list ::apply {{thealpha} {
		variable cache
		variable fore
		variable back

		if {[info exists cache($thealpha)]} {
		    show_image  $cache($thealpha)
		    return
		}

		set theblend [crimp alpha blend $fore $back $thealpha]
		set cache($thealpha) $theblend
		show_image $theblend
		return
	    } ::DEMO}]

	pack .left.s -side left -fill both -expand 1
    }
Added demos/blend_rgb_translated.tcl.












































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
def op_alpha_blend_rgb_translated {
    label {Blend RGB/Translated}
    active { expr { [bases] == 2 } }
    setup {
	# We manage a cache of the blended images to make the
	# scrolling of the scale smoother over time. An improvement
	# would be to use timer events to precompute the various
	# blends.
	variable  cache
	array set cache {}
	set cache(255) [crimp place [base 0]  50  40]
	set cache(0)   [crimp place [base 1] -40 -50]
	variable fore  $cache(255)
	variable back  $cache(0)
	variable alpha 255

	scale .left.s -variable DEMO::alpha \
	    -from 0 -to 255 \
	    -orient vertical \
	    -command [list ::apply {{thealpha} {
		variable cache
		variable fore
		variable back

		if {[info exists cache($thealpha)]} {
		    show_image  $cache($thealpha)
		    return
		}

		set theblend [crimp alpha blend $fore $back $thealpha]
		set cache($thealpha) $theblend
		show_image $theblend
		return
	    } ::DEMO}]

	pack .left.s -side left -fill both -expand 1
    }
}
Added demos/difference-translated.tcl.




















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
def op_difference_translated {
    label Difference/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show_image [crimp alpha opaque \
			[crimp difference \
			     [crimp place [base 0] -50 -50] \
			     [crimp place [base 1] 60 70]]]
    }
}
Changes to demos/difference.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
def op_difference {
    label Difference
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show_image [crimp alpha opaque [crimp difference [base 0] [base 1]]]
    }
}


|
<
<
<
<
<




1
2
3





4
5
6
7
def op_difference {
    label Difference
    active { expr { [bases] == 2 } }





    setup_image {
	show_image [crimp alpha opaque [crimp difference [base 0] [base 1]]]
    }
}
Added demos/div-translated.tcl.




















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
def op_div_translated {
    label Division/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show_image [crimp alpha opaque \
			[crimp divide \
			     [crimp place [base 0] -50 -50] \
			     [crimp place [base 1] 60 70]]]
    }
}
Changes to demos/div.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
def op_div {
    label Division
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show_image [crimp divide [base 0] [base 1]]
    }
}


|
<
<
<
<
<




1
2
3





4
5
6
7
def op_div {
    label Division
    active { expr { [bases] == 2 } }





    setup_image {
	show_image [crimp divide [base 0] [base 1]]
    }
}
Added demos/geometry.tcl.


















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
def geometry {
    label {Geometry}
    setup_image {
	set image [base]
	log "[join [crimp dimensions $image] x] @ [join [crimp at $image] ,]"
	set image [crimp place [crimp cut $image 50 50 50 40] 5 -1]
	log "[join [crimp dimensions $image] x] @ [join [crimp at $image] ,]"
    }
}
Added demos/max-translated.tcl.




















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
def op_max_translated {
    label Max/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show_image [crimp alpha opaque \
			[crimp max \
			     [crimp place [base 0] -50 -50] \
			     [crimp place [base 1] 60 70]]]
    }
}
Changes to demos/max.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
def op_max {
    label Max
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show_image [crimp max [base 0] [base 1]]
    }
}


|
<
<
<
<
<




1
2
3





4
5
6
7
def op_max {
    label Max
    active { expr { [bases] == 2 } }





    setup_image {
	show_image [crimp max [base 0] [base 1]]
    }
}
Added demos/min-translated.tcl.




















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
def op_min_translated {
    label Min/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show_image [crimp alpha opaque \
			[crimp min \
			     [crimp place [base 0] -50 -50] \
			     [crimp place [base 1] 60 70]]]
    }
}
Changes to demos/min.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
def op_min {
    label Min
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show_image [crimp min [base 0] [base 1]]
    }
}


|
<
<
<
<
<




1
2
3





4
5
6
7
def op_min {
    label Min
    active { expr { [bases] == 2 } }





    setup_image {
	show_image [crimp min [base 0] [base 1]]
    }
}
Added demos/multiply-translated.tcl.




















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
def op_multiply_translated {
    label Multiply/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show_image [crimp alpha opaque \
			[crimp multiply \
			     [crimp place [base 0] -50 -50] \
			     [crimp place [base 1] 60 70]]]
    }
}
Changes to demos/multiply.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
def op_multiply {
    label Multiply
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show_image [crimp multiply [base 0] [base 1]]
    }
}


|
<
<
<
<
<




1
2
3





4
5
6
7
def op_multiply {
    label Multiply
    active { expr { [bases] == 2 } }





    setup_image {
	show_image [crimp multiply [base 0] [base 1]]
    }
}
Added demos/over-translated.tcl.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def op_alpha_over_translated {
    label Over/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	# We use the foreground image's luma as opacity (bright =
	# opaque, dark = transparent) to merge it with the background
	# image. At last we force fully opaque to avoid mix effects
	# against the canvas background color.

	show_image [crimp convert 2rgb \
			[crimp alpha over \
			     [crimp place \
				  [crimp alpha set \
				       [base] \
				       [crimp convert 2grey8 [base]]] \
				  -50 -50] \
			     [crimp place [base 1] 60 70]]]
    }
}
Changes to demos/over.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def op_alpha_over {
    label Over
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	# We use the foreground image's luma as opacity (bright =
	# opaque, dark = transparent) to merge it with the background
	# image. At last we force fully opaque to avoid mix effects
	# against the canvas background color.

	show_image [crimp convert 2rgb \


|
<
<
<
<
<







1
2
3





4
5
6
7
8
9
10
def op_alpha_over {
    label Over
    active { expr { [bases] == 2 } }





    setup_image {
	# We use the foreground image's luma as opacity (bright =
	# opaque, dark = transparent) to merge it with the background
	# image. At last we force fully opaque to avoid mix effects
	# against the canvas background color.

	show_image [crimp convert 2rgb \
Added demos/overi-translated.tcl.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def op_alpha_over_revers_translated {
    label {Over Revers/Translated}
    active { expr { [bases] == 2 } }
    setup_image {
	# We use the foreground image's luma as opacity (bright =
	# opaque, dark = transparent) to merge it with the background
	# image. At last we force fully opaque to avoid mix effects
	# against the canvas background color.

	show_image [crimp convert 2rgb \
			[crimp alpha over \
			     [crimp place \
				  [crimp alpha set \
				       [base 1] \
				       [crimp convert 2grey8 [base 1]]] \
				  60 70] \
			     [crimp place [base 0] -50 -50]]]
    }
}
Changes to demos/overi.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def op_alpha_over_revers {
    label {Over Revers}
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	# We use the foreground image's luma as opacity (bright =
	# opaque, dark = transparent) to merge it with the background
	# image. At last we force fully opaque to avoid mix effects
	# against the canvas background color.

	show_image [crimp convert 2rgb \


|
<
<
<
<
<







1
2
3





4
5
6
7
8
9
10
def op_alpha_over_revers {
    label {Over Revers}
    active { expr { [bases] == 2 } }





    setup_image {
	# We use the foreground image's luma as opacity (bright =
	# opaque, dark = transparent) to merge it with the background
	# image. At last we force fully opaque to avoid mix effects
	# against the canvas background color.

	show_image [crimp convert 2rgb \
Added demos/screen-translated.tcl.




















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
def op_screen_translated {
    label Screen/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show_image [crimp alpha opaque \
			[crimp screen \
			     [crimp place [base 0] -50 -50] \
			     [crimp place [base 1] 60 70]]]
    }
}
Changes to demos/screen.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
def op_screen {
    label Screen
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show_image [crimp screen [base 0] [base 1]]
    }
}


|
<
<
<
<
<




1
2
3





4
5
6
7
def op_screen {
    label Screen
    active { expr { [bases] == 2 } }





    setup_image {
	show_image [crimp screen [base 0] [base 1]]
    }
}
Added demos/subtract-translated.tcl.


























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
def op_subtract_translated {
    label Subtract/Translated
    active { expr { [bases] == 2 } }
    setup_image {
	show
    }
    setup {
	variable scale  1
	variable offset 0

	proc show {args} {
	    variable scale
	    variable offset

	    show_image [crimp alpha opaque \
			    [crimp subtract \
				 [crimp place [base 0] -50 -50] \
				 [crimp place [base 1] 60 70 ] \
				 $scale $offset]]
	    return
	}

	scale .left.s -variable ::DEMO::scale  -from 1 -to 255 -orient vertical -command ::DEMO::show
	scale .left.o -variable ::DEMO::offset -from 0 -to 255 -orient vertical -command ::DEMO::show

	pack .left.s -side left -expand 1 -fill both
	pack .left.o -side left -expand 1 -fill both
    }
}
Changes to demos/subtract.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def op_subtract {
    label Subtract
    active {
	expr {
	      ([bases] == 2) &&
	      ([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
	  }
    }
    setup_image {
	show
    }
    setup {
	variable scale  1
	variable offset 0



|
<
<
<
<
<







1
2
3





4
5
6
7
8
9
10
def op_subtract {
    label Subtract
    active { expr { [bases] == 2 } }





    setup_image {
	show
    }
    setup {
	variable scale  1
	variable offset 0

Changes to doc/crimp.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp n 0.1]
[include include/module.inc]
[titledesc {CRIMP - Manipulation and Processing}]
[require Tcl 8.5]
[require Tk 8.5]
[require crimp [opt 0.1]]
[require crimp::core [opt 0.1]]
[description]

This package, built on top of the [package crimp::core] package
provides the majority of CRIMPs power, manipulating and transforming
images in a number of ways.

[para] For a basic introduction of the whole CRIMP eco-system please read

|




|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp n 0.2]
[include include/module.inc]
[titledesc {CRIMP - Manipulation and Processing}]
[require Tcl 8.5]
[require Tk 8.5]
[require crimp [opt 0.2]]
[require crimp::core [opt 0.2]]
[description]

This package, built on top of the [package crimp::core] package
provides the majority of CRIMPs power, manipulating and transforming
images in a number of ways.

[para] For a basic introduction of the whole CRIMP eco-system please read
1038
1039
1040
1041
1042
1043
1044









1045
1046
1047
1048
1049
1050
1051

[call [cmd ::crimp] [method matchsize] [arg image1] [arg image2]]

This method takes two images, forces them to be of the same size by
expanding the smaller dimensions with black pixels, and then returns a
list of the expanded images. The images in the result are in the same
order as as arguments.










[call [cmd ::crimp] [method scale] [arg image] [arg scale]]

This method performs a pixel-wise multiplication of the image with a
constant factor. It is currently supported by all [const greyN] image
types, plus the types [const float] and [const fpcomplex]. The first
accept an integer scaling factor, whereas the last two accept any







>
>
>
>
>
>
>
>
>







1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060

[call [cmd ::crimp] [method matchsize] [arg image1] [arg image2]]

This method takes two images, forces them to be of the same size by
expanding the smaller dimensions with black pixels, and then returns a
list of the expanded images. The images in the result are in the same
order as as arguments.

[call [cmd ::crimp] [method matchgeo] [arg image] [arg bbox]]

This method takes an image and a bounding box (list of x, y, w, and h), 
and expands the image with black pixels to match the box. The result of
the expansion is returned.

[para] An error is thrown if the image is not fully contained within
the bounding box.

[call [cmd ::crimp] [method scale] [arg image] [arg scale]]

This method performs a pixel-wise multiplication of the image with a
constant factor. It is currently supported by all [const greyN] image
types, plus the types [const float] and [const fpcomplex]. The first
accept an integer scaling factor, whereas the last two accept any
Changes to doc/crimp_bmp.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_bmp n 0.1]
[include include/module.inc]
[titledesc {CRIMP - BMP handling, Windows Bitmap}]
[require Tcl 8.5]
[require crimp::bmp [opt 0.1]]
[keywords {Import BMP image} {BMP image import} {Import image, BMP} BMP]
[keywords {Export BMP image} {BMP image export} {Export image, BMP}]
[description]

This package provides commands for the conversion of Windows Bitmaps
(BMP) into CRIMP images. [emph Note] that this package does [emph not]
provide the ability to write images in the BMP format.

|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_bmp n 0.2]
[include include/module.inc]
[titledesc {CRIMP - BMP handling, Windows Bitmap}]
[require Tcl 8.5]
[require crimp::bmp [opt 0.2]]
[keywords {Import BMP image} {BMP image import} {Import image, BMP} BMP]
[keywords {Export BMP image} {BMP image export} {Export image, BMP}]
[description]

This package provides commands for the conversion of Windows Bitmaps
(BMP) into CRIMP images. [emph Note] that this package does [emph not]
provide the ability to write images in the BMP format.
Changes to doc/crimp_core.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_core n 0.1]
[include include/module.inc]
[titledesc {CRIMP - Foundation}]
[require Tcl 8.5]
[require crimp::core [opt 0.1]]
[keywords {image type}]
[keywords {image accessors}]
[description]

This package is the foundation for the whole of CRIMP, the C Raster
Image Manipulation Package.


|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_core n 0.2]
[include include/module.inc]
[titledesc {CRIMP - Foundation}]
[require Tcl 8.5]
[require crimp::core [opt 0.2]]
[keywords {image type}]
[keywords {image accessors}]
[description]

This package is the foundation for the whole of CRIMP, the C Raster
Image Manipulation Package.

255
256
257
258
259
260
261











262
263
264
265
266
267
268

This method returns the width and height of the [arg image] (in
pixels).  The result is a 2-element list containing width and height,
in this order.

[para] The method supports all image types.













[call [cmd ::crimp] [method height] [arg image]]

This method returns the height of the [arg image] (in pixels).

[para] The method supports all image types.








>
>
>
>
>
>
>
>
>
>
>







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279

This method returns the width and height of the [arg image] (in
pixels).  The result is a 2-element list containing width and height,
in this order.

[para] The method supports all image types.


[call [cmd ::crimp] [method geometry] [arg image]]
[keywords geometry {bounding box}]

This method returns the [term geometry] of the [arg image] (in
pixels). The result is a 4-element list containing x-, y-location,
width and height, in this order. This is also called the
[term {bounding box}] of the image.

[para] The method supports all image types.


[call [cmd ::crimp] [method height] [arg image]]

This method returns the height of the [arg image] (in pixels).

[para] The method supports all image types.

306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
[para] The method supports all image types.

[call [cmd ::crimp] [method type] [arg image]]

This method returns the type of the [arg image].

[para] The method supports all image types.


[call [cmd ::crimp] [method width] [arg image]]

This method returns the width of the [arg image] (in pixels).

[para] The method supports all image types.








<







317
318
319
320
321
322
323

324
325
326
327
328
329
330
[para] The method supports all image types.

[call [cmd ::crimp] [method type] [arg image]]

This method returns the type of the [arg image].

[para] The method supports all image types.


[call [cmd ::crimp] [method width] [arg image]]

This method returns the width of the [arg image] (in pixels).

[para] The method supports all image types.

422
423
424
425
426
427
428


















429
430
431
432
433
434
435
436

[list_begin definitions]
[def "[cmd Str_...] [arg image]"]
[def "[cmd Chan_...] [arg channel] [arg image]"]
[list_end]

[list_end]



















[section {C API}]

The C API of the core is of no interest to users of CRIMP, the audience
towards which this manpage is geared to.

[manpage_end]








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464

[list_begin definitions]
[def "[cmd Str_...] [arg image]"]
[def "[cmd Chan_...] [arg channel] [arg image]"]
[list_end]

[list_end]


[subsection Support]

[list_begin definitions]
[call [cmd ::crimp] [method bbox] [arg image]...]

This method takes one or more images and computes the union of their
geometries. The result is returned as a bounding box, a list of 4
numbers (x, y, width, and height).

[call [cmd ::crimp] [method bbox2] [arg box1] [arg box2]]

This method takes two bounding boxes (lists of 4 numbers (x, y, width,
and height)) and returns their union bounding box.

[list_end]


[section {C API}]

The C API of the core is of no interest to users of CRIMP, the audience
towards which this manpage is geared to.

[manpage_end]

Changes to doc/crimp_devguide.man.
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
[1]     width
[2]     Tcl_Obj* imageObj
[3]
[4]     crimp_image* image;
[5]
[6]     crimp_input_any (imageObj, image);
[7]
[8]     Tcl_SetObjResult (interp, Tcl_NewIntObj (image->w));
[9]     return TCL_OK;
}]

Line 1 contains the name of the primitive, "width".
Line 2 is the first line of the argument block.
Line 3 terminates this argument block.
Lines 4 to 9 are the implementation.







|







520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
[1]     width
[2]     Tcl_Obj* imageObj
[3]
[4]     crimp_image* image;
[5]
[6]     crimp_input_any (imageObj, image);
[7]
[8]     Tcl_SetObjResult (interp, Tcl_NewIntObj (crimp_w (image)));
[9]     return TCL_OK;
}]

Line 1 contains the name of the primitive, "width".
Line 2 is the first line of the argument block.
Line 3 terminates this argument block.
Lines 4 to 9 are the implementation.
Changes to doc/crimp_pcx.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_pcx n 0.1]
[include include/module.inc]
[titledesc {CRIMP - PCX handling}]
[require Tcl 8.5]
[require crimp::pcx [opt 0.1]]
[keywords {Import PCX image} {PCX image import} {Import image, PCX} PCX]
[keywords {Export PCX image} {PCX image export} {Export image, PCX}]
[description]

This package provides commands for the conversion of ZSoft Personal
Computer eXChange (PCX) images into CRIMP images. [emph Note] that
this package does [emph not] provide the ability to write images

|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_pcx n 0.2]
[include include/module.inc]
[titledesc {CRIMP - PCX handling}]
[require Tcl 8.5]
[require crimp::pcx [opt 0.2]]
[keywords {Import PCX image} {PCX image import} {Import image, PCX} PCX]
[keywords {Export PCX image} {PCX image export} {Export image, PCX}]
[description]

This package provides commands for the conversion of ZSoft Personal
Computer eXChange (PCX) images into CRIMP images. [emph Note] that
this package does [emph not] provide the ability to write images
Changes to doc/crimp_pfm.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_pfm n 0.1]
[include include/module.inc]
[titledesc {CRIMP - PFM handling, NetPBM}]
[require Tcl 8.5]
[require crimp::pfm [opt 0.1]]
[keywords {Import PFM image} {PFM image import} {Import image, PFM} PFM]
[keywords {Export PFM image} {PFM image export} {Export image, PFM}]
[description]

This package provides commands for the conversion of CRIMP images to
Portable Float Maps (PFM) and vice versa.


|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_pfm n 0.2]
[include include/module.inc]
[titledesc {CRIMP - PFM handling, NetPBM}]
[require Tcl 8.5]
[require crimp::pfm [opt 0.2]]
[keywords {Import PFM image} {PFM image import} {Import image, PFM} PFM]
[keywords {Export PFM image} {PFM image export} {Export image, PFM}]
[description]

This package provides commands for the conversion of CRIMP images to
Portable Float Maps (PFM) and vice versa.

Changes to doc/crimp_pgm.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_pgm n 0.1]
[include include/module.inc]
[titledesc {CRIMP - PGM handling, NetPBM}]
[require Tcl 8.5]
[require crimp::pgm [opt 0.1]]
[keywords {Import PGM image} {PGM image import} {Import image, PGM} PGM]
[keywords {Export PGM image} {PGM image export} {Export image, PGM}]
[description]

This package provides commands for the conversion of CRIMP images to
Portable Greymaps (PGM) and vice versa.


|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_pgm n 0.2]
[include include/module.inc]
[titledesc {CRIMP - PGM handling, NetPBM}]
[require Tcl 8.5]
[require crimp::pgm [opt 0.2]]
[keywords {Import PGM image} {PGM image import} {Import image, PGM} PGM]
[keywords {Export PGM image} {PGM image export} {Export image, PGM}]
[description]

This package provides commands for the conversion of CRIMP images to
Portable Greymaps (PGM) and vice versa.

Changes to doc/crimp_ppm.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_ppm n 0.1]
[include include/module.inc]
[titledesc {CRIMP - PPM handling, NetPBM}]
[require Tcl 8.5]
[require crimp::ppm [opt 0.1]]
[keywords {Import PPM image} {PPM image import} {Import image, PPM} PPM]
[keywords {Export PPM image} {PPM image export} {Export image, PPM}]
[description]

This package provides commands for the conversion of CRIMP images to
Portable Pixmaps (PPM) and vice versa.


|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_ppm n 0.2]
[include include/module.inc]
[titledesc {CRIMP - PPM handling, NetPBM}]
[require Tcl 8.5]
[require crimp::ppm [opt 0.2]]
[keywords {Import PPM image} {PPM image import} {Import image, PPM} PPM]
[keywords {Export PPM image} {PPM image export} {Export image, PPM}]
[description]

This package provides commands for the conversion of CRIMP images to
Portable Pixmaps (PPM) and vice versa.

Changes to doc/crimp_sgi.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_sgi n 0.1]
[include include/module.inc]
[titledesc {CRIMP - SGI RASTER handling}]
[require Tcl 8.5]
[require crimp::sgi [opt 0.1]]
[keywords {Import SGI Raster image} {SGI Raster image import} {Import image, SGI Raster} SGI]
[keywords {Export SGI Raster image} {SGI Raster image export} {Export image, SGI Raster}]
[description]

This package provides commands for the conversion of SGI raster images
into CRIMP images. [emph Note] that this package does [emph not]
provide the ability to write images in the SGI raster format.

|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_sgi n 0.2]
[include include/module.inc]
[titledesc {CRIMP - SGI RASTER handling}]
[require Tcl 8.5]
[require crimp::sgi [opt 0.2]]
[keywords {Import SGI Raster image} {SGI Raster image import} {Import image, SGI Raster} SGI]
[keywords {Export SGI Raster image} {SGI Raster image export} {Export image, SGI Raster}]
[description]

This package provides commands for the conversion of SGI raster images
into CRIMP images. [emph Note] that this package does [emph not]
provide the ability to write images in the SGI raster format.
Changes to doc/crimp_sun.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_sun n 0.1]
[include include/module.inc]
[titledesc {CRIMP - SUN RASTER handling}]
[require Tcl 8.5]
[require crimp::sun [opt 0.1]]
[keywords {Import SUN Raster image} {SUN Raster image import} {Import image, SUN Raster} SUN]
[keywords {Export SUN Raster image} {SUN Raster image export} {Export image, SUN Raster}]
[description]

This package provides commands for the conversion of Sun raster images
into CRIMP images. [emph Note] that this package does [emph not]
provide the ability to write images in the SUN raster format.

|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_sun n 0.2]
[include include/module.inc]
[titledesc {CRIMP - SUN RASTER handling}]
[require Tcl 8.5]
[require crimp::sun [opt 0.2]]
[keywords {Import SUN Raster image} {SUN Raster image import} {Import image, SUN Raster} SUN]
[keywords {Export SUN Raster image} {SUN Raster image export} {Export image, SUN Raster}]
[description]

This package provides commands for the conversion of Sun raster images
into CRIMP images. [emph Note] that this package does [emph not]
provide the ability to write images in the SUN raster format.
Changes to doc/crimp_tk.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_tk n 0.1]
[include include/module.inc]
[titledesc {CRIMP - Tk Photo Handling}]
[require Tcl 8.5]
[require Tk 8.5]
[require crimp::tk [opt 0.1]]
[keywords {Tk photo import} {Import tk photo}]
[keywords {Tk photo export} {Export tk photo}]
[description]

This package provides commands for the conversion of CRIMP images to
Tk photos image and vice versa, i.e. the export of images for display,
and import from a display.

|




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin crimp_tk n 0.2]
[include include/module.inc]
[titledesc {CRIMP - Tk Photo Handling}]
[require Tcl 8.5]
[require Tk 8.5]
[require crimp::tk [opt 0.2]]
[keywords {Tk photo import} {Import tk photo}]
[keywords {Tk photo export} {Export tk photo}]
[description]

This package provides commands for the conversion of CRIMP images to
Tk photos image and vice versa, i.e. the export of images for display,
and import from a display.
Changes to doc/figures/structures.dia.
1
2
3
4
5
6
7
8



9
10
11
12
13
14
15
# -*- tcl -*- tcl.tk//DSL diagram//EN//1.0
source [file join [file dirname [file normalize [info script]]] dsl_ctypes.inc]

## ====================================================================

allocated struct image {
    field Tcl_Obj*    meta
    field image_type* itype



    # Dimensions of the image
    field int         w
    field int         h
    # Integrated memory area for pixels.
    field char\[...\] "pixels\n  (Integrated)" \
	height [14 mm]
}








>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- tcl -*- tcl.tk//DSL diagram//EN//1.0
source [file join [file dirname [file normalize [info script]]] dsl_ctypes.inc]

## ====================================================================

allocated struct image {
    field Tcl_Obj*    meta
    field image_type* itype
    # Location of the image in the infinite 2d plane
    field int         x
    field int         y
    # Dimensions of the image
    field int         w
    field int         h
    # Integrated memory area for pixels.
    field char\[...\] "pixels\n  (Integrated)" \
	height [14 mm]
}
Changes to doc/figures/structures.png.

cannot compute difference between binary files

Changes to doc/figures/structures.txt.
1
2
3
4
5
6
7
8
9
10
11
12
13
              image
-------       ------------------
Tcl_Obj <----* Tcl_Obj*    meta
-------        image_type* itype *---> image_type
               int         w           -----------------
               int         h            char*  name  *------> "...\0"
               char[...]   pixel        int    size
              -------------------       int    channels       -------------------
                                        char** cname *------>  cname[0]
                                       -----------------       cname[1] *------> "...\0"
                                                                ...
                                                               cname[channels-1]
                                                              -------------------




|
|
|
|
|
|



1
2
3
4
5
6
7
8
9
10
11
12
13
              image
-------       ------------------
Tcl_Obj <----* Tcl_Obj*    meta
-------        image_type* itype *---> image_type
               int         x           -----------------
               int         y            char*  name  *------> "...\0"
               int         w            int    size
               int         h            int    channels       -------------------
               char[...]   pixel        char** cname *------>  cname[0]
              -------------------      -----------------       cname[1] *------> "...\0"
                                                                ...
                                                               cname[channels-1]
                                                              -------------------
Changes to embedded/man/files/crimp.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp \- CRIMP - Manipulation and Processing
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTk  8.5\fR
.sp
package require \fBcrimp  ?0.1?\fR
.sp
package require \fBcrimp::core  ?0.1?\fR
.sp
\fB::crimp\fR \fBhistogram\fR \fIimage\fR
.sp
\fB::crimp\fR \fBstatistics basic\fR \fIimage\fR
.sp
\fB::crimp\fR \fBstatistics otsu\fR \fIstats\fR
.sp







|








|

|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp \- CRIMP - Manipulation and Processing
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTk  8.5\fR
.sp
package require \fBcrimp  ?0.2?\fR
.sp
package require \fBcrimp::core  ?0.2?\fR
.sp
\fB::crimp\fR \fBhistogram\fR \fIimage\fR
.sp
\fB::crimp\fR \fBstatistics basic\fR \fIimage\fR
.sp
\fB::crimp\fR \fBstatistics otsu\fR \fIstats\fR
.sp
425
426
427
428
429
430
431


432
433
434
435
436
437
438
\fB::crimp\fR \fBpyramid gauss\fR \fIimage\fR \fIsteps\fR
.sp
\fB::crimp\fR \fBpyramid laplace\fR \fIimage\fR \fIsteps\fR
.sp
\fB::crimp\fR \fBremap\fR \fIimage\fR \fImap\fR...
.sp
\fB::crimp\fR \fBmatchsize\fR \fIimage1\fR \fIimage2\fR


.sp
\fB::crimp\fR \fBscale\fR \fIimage\fR \fIscale\fR
.sp
\fB::crimp\fR \fBscreen\fR \fIimage1\fR \fIimage2\fR
.sp
\fB::crimp\fR \fBsolarize\fR \fIimage\fR \fIthreshold\fR
.sp







>
>







425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
\fB::crimp\fR \fBpyramid gauss\fR \fIimage\fR \fIsteps\fR
.sp
\fB::crimp\fR \fBpyramid laplace\fR \fIimage\fR \fIsteps\fR
.sp
\fB::crimp\fR \fBremap\fR \fIimage\fR \fImap\fR...
.sp
\fB::crimp\fR \fBmatchsize\fR \fIimage1\fR \fIimage2\fR
.sp
\fB::crimp\fR \fBmatchgeo\fR \fIimage\fR \fIbbox\fR
.sp
\fB::crimp\fR \fBscale\fR \fIimage\fR \fIscale\fR
.sp
\fB::crimp\fR \fBscreen\fR \fIimage1\fR \fIimage2\fR
.sp
\fB::crimp\fR \fBsolarize\fR \fIimage\fR \fIthreshold\fR
.sp
1616
1617
1618
1619
1620
1621
1622








1623
1624
1625
1626
1627
1628
1629
\fBfloat\fR, and \fBbw\fR.
.TP
\fB::crimp\fR \fBmatchsize\fR \fIimage1\fR \fIimage2\fR
This method takes two images, forces them to be of the same size by
expanding the smaller dimensions with black pixels, and then returns a
list of the expanded images. The images in the result are in the same
order as as arguments.








.TP
\fB::crimp\fR \fBscale\fR \fIimage\fR \fIscale\fR
This method performs a pixel-wise multiplication of the image with a
constant factor. It is currently supported by all \fBgreyN\fR image
types, plus the types \fBfloat\fR and \fBfpcomplex\fR. The first
accept an integer scaling factor, whereas the last two accept any
floating point number.







>
>
>
>
>
>
>
>







1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
\fBfloat\fR, and \fBbw\fR.
.TP
\fB::crimp\fR \fBmatchsize\fR \fIimage1\fR \fIimage2\fR
This method takes two images, forces them to be of the same size by
expanding the smaller dimensions with black pixels, and then returns a
list of the expanded images. The images in the result are in the same
order as as arguments.
.TP
\fB::crimp\fR \fBmatchgeo\fR \fIimage\fR \fIbbox\fR
This method takes an image and a bounding box (list of x, y, w, and h),
and expands the image with black pixels to match the box. The result of
the expansion is returned.
.sp
An error is thrown if the image is not fully contained within
the bounding box.
.TP
\fB::crimp\fR \fBscale\fR \fIimage\fR \fIscale\fR
This method performs a pixel-wise multiplication of the image with a
constant factor. It is currently supported by all \fBgreyN\fR image
types, plus the types \fBfloat\fR and \fBfpcomplex\fR. The first
accept an integer scaling factor, whereas the last two accept any
floating point number.
Changes to embedded/man/files/crimp_bmp.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_bmp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_bmp.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_bmp" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_bmp \- CRIMP - BMP handling, Windows Bitmap
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::bmp  ?0.1?\fR
.sp
\fB::crimp\fR \fBread bmp\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of Windows Bitmaps
(BMP) into CRIMP images. \fINote\fR that this package does \fInot\fR







|






|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_bmp" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_bmp \- CRIMP - BMP handling, Windows Bitmap
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::bmp  ?0.2?\fR
.sp
\fB::crimp\fR \fBread bmp\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of Windows Bitmaps
(BMP) into CRIMP images. \fINote\fR that this package does \fInot\fR
Changes to embedded/man/files/crimp_core.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_core.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_core.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255


256
257
258
259
260
261
262
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_core" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_core \- CRIMP - Foundation
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::core  ?0.1?\fR
.sp
\fB::crimp\fR \fI...\fR
.sp
\fB::crimp\fR \fBchannels\fR \fIimage\fR
.sp
\fB::crimp\fR \fBdimensions\fR \fIimage\fR


.sp
\fB::crimp\fR \fBheight\fR \fIimage\fR
.sp
\fB::crimp\fR \fBmeta append\fR \fIimage\fR \fIkey\fR ?\fIstring\fR...?
.sp
\fB::crimp\fR \fBmeta create\fR \fIimage\fR ?\fIkey\fR \fIvalue\fR...?
.sp







|






|






>
>







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_core" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_core \- CRIMP - Foundation
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::core  ?0.2?\fR
.sp
\fB::crimp\fR \fI...\fR
.sp
\fB::crimp\fR \fBchannels\fR \fIimage\fR
.sp
\fB::crimp\fR \fBdimensions\fR \fIimage\fR
.sp
\fB::crimp\fR \fBgeometry\fR \fIimage\fR
.sp
\fB::crimp\fR \fBheight\fR \fIimage\fR
.sp
\fB::crimp\fR \fBmeta append\fR \fIimage\fR \fIkey\fR ?\fIstring\fR...?
.sp
\fB::crimp\fR \fBmeta create\fR \fIimage\fR ?\fIkey\fR \fIvalue\fR...?
.sp
306
307
308
309
310
311
312




313
314
315
316
317
318
319
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2file\fR \fIformat\fR \fIpath\fR \fIimage\fR
.sp




.BE
.SH DESCRIPTION
This package is the foundation for the whole of CRIMP, the C Raster
Image Manipulation Package.
.PP
For a basic introduction of the whole CRIMP eco-system please read
the \fICRIMP - Introduction to CRIMP\fR (sic!).







>
>
>
>







308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2file\fR \fIformat\fR \fIpath\fR \fIimage\fR
.sp
\fB::crimp\fR \fBbbox\fR \fIimage\fR...
.sp
\fB::crimp\fR \fBbbox2\fR \fIbox1\fR \fIbox2\fR
.sp
.BE
.SH DESCRIPTION
This package is the foundation for the whole of CRIMP, the C Raster
Image Manipulation Package.
.PP
For a basic introduction of the whole CRIMP eco-system please read
the \fICRIMP - Introduction to CRIMP\fR (sic!).
609
610
611
612
613
614
615








616
617
618
619
620
621
622
.TP
\fB::crimp\fR \fBdimensions\fR \fIimage\fR
This method returns the width and height of the \fIimage\fR (in
pixels).  The result is a 2-element list containing width and height,
in this order.
.sp
The method supports all image types.








.TP
\fB::crimp\fR \fBheight\fR \fIimage\fR
This method returns the height of the \fIimage\fR (in pixels).
.sp
The method supports all image types.
.TP
\fB::crimp\fR \fBmeta append\fR \fIimage\fR \fIkey\fR ?\fIstring\fR...?







>
>
>
>
>
>
>
>







615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
.TP
\fB::crimp\fR \fBdimensions\fR \fIimage\fR
This method returns the width and height of the \fIimage\fR (in
pixels).  The result is a 2-element list containing width and height,
in this order.
.sp
The method supports all image types.
.TP
\fB::crimp\fR \fBgeometry\fR \fIimage\fR
This method returns the \fIgeometry\fR of the \fIimage\fR (in
pixels). The result is a 4-element list containing x-, y-location,
width and height, in this order. This is also called the
\fIbounding box\fR of the image.
.sp
The method supports all image types.
.TP
\fB::crimp\fR \fBheight\fR \fIimage\fR
This method returns the height of the \fIimage\fR (in pixels).
.sp
The method supports all image types.
.TP
\fB::crimp\fR \fBmeta append\fR \fIimage\fR \fIkey\fR ?\fIstring\fR...?
771
772
773
774
775
776
777











778
779
780
781
782
783
784
785
786
787
788
.RS
.TP
\fBStr_...\fR \fIimage\fR
.TP
\fBChan_...\fR \fIchannel\fR \fIimage\fR
.RE
.PP











.SH "C API"
The C API of the core is of no interest to users of CRIMP, the audience
towards which this manpage is geared to.
.SH KEYWORDS
channels, computer vision, dimensions, document processing, image, image accessors, image type, matrix, photo, vector
.SH COPYRIGHT
.nf
Copyright (c) 2011 Andreas Kupries
Copyright (c) 2011 Documentation, Andreas Kupries

.fi







>
>
>
>
>
>
>
>
>
>
>




|






785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
.RS
.TP
\fBStr_...\fR \fIimage\fR
.TP
\fBChan_...\fR \fIchannel\fR \fIimage\fR
.RE
.PP
.SS SUPPORT
.TP
\fB::crimp\fR \fBbbox\fR \fIimage\fR...
This method takes one or more images and computes the union of their
geometries. The result is returned as a bounding box, a list of 4
numbers (x, y, width, and height).
.TP
\fB::crimp\fR \fBbbox2\fR \fIbox1\fR \fIbox2\fR
This method takes two bounding boxes (lists of 4 numbers (x, y, width,
and height)) and returns their union bounding box.
.PP
.SH "C API"
The C API of the core is of no interest to users of CRIMP, the audience
towards which this manpage is geared to.
.SH KEYWORDS
bounding box, channels, computer vision, dimensions, document processing, geometry, image, image accessors, image type, matrix, photo, vector
.SH COPYRIGHT
.nf
Copyright (c) 2011 Andreas Kupries
Copyright (c) 2011 Documentation, Andreas Kupries

.fi
Changes to embedded/man/files/crimp_devguide.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_devguide.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_devguide.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
.PP
.PS
.nf
              image
-------       ------------------
Tcl_Obj <----* Tcl_Obj*    meta
-------        image_type* itype *---> image_type
               int         w           -----------------
               int         h            char*  name  *------> "...\\0"
               char[...]   pixel        int    size
              -------------------       int    channels       -------------------
                                        char** cname *------>  cname[0]
                                       -----------------       cname[1] *------> "...\\0"
                                                                ...
                                                               cname[channels-1]
                                                              -------------------

.fi
.PE
.PP







|
|
|
|
|
|







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
.PP
.PS
.nf
              image
-------       ------------------
Tcl_Obj <----* Tcl_Obj*    meta
-------        image_type* itype *---> image_type
               int         x           -----------------
               int         y            char*  name  *------> "...\\0"
               int         w            int    size
               int         h            int    channels       -------------------
               char[...]   pixel        char** cname *------>  cname[0]
              -------------------      -----------------       cname[1] *------> "...\\0"
                                                                ...
                                                               cname[channels-1]
                                                              -------------------

.fi
.PE
.PP
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
[1]     width
[2]     Tcl_Obj* imageObj
[3]
[4]     crimp_image* image;
[5]
[6]     crimp_input_any (imageObj, image);
[7]
[8]     Tcl_SetObjResult (interp, Tcl_NewIntObj (image->w));
[9]     return TCL_OK;

.fi
Line 1 contains the name of the primitive, "width".
Line 2 is the first line of the argument block.
Line 3 terminates this argument block.
Lines 4 to 9 are the implementation.







|







750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
[1]     width
[2]     Tcl_Obj* imageObj
[3]
[4]     crimp_image* image;
[5]
[6]     crimp_input_any (imageObj, image);
[7]
[8]     Tcl_SetObjResult (interp, Tcl_NewIntObj (crimp_w (image)));
[9]     return TCL_OK;

.fi
Line 1 contains the name of the primitive, "width".
Line 2 is the first line of the argument block.
Line 3 terminates this argument block.
Lines 4 to 9 are the implementation.
Changes to embedded/man/files/crimp_installer.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_installer.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_installer.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
Changes to embedded/man/files/crimp_intro.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_intro.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
Changes to embedded/man/files/crimp_pcx.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_pcx.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_pcx.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_pcx" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_pcx \- CRIMP - PCX handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::pcx  ?0.1?\fR
.sp
\fB::crimp\fR \fBread pcx\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of ZSoft Personal
Computer eXChange (PCX) images into CRIMP images. \fINote\fR that







|






|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_pcx" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_pcx \- CRIMP - PCX handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::pcx  ?0.2?\fR
.sp
\fB::crimp\fR \fBread pcx\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of ZSoft Personal
Computer eXChange (PCX) images into CRIMP images. \fINote\fR that
Changes to embedded/man/files/crimp_pfm.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_pfm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_pfm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_pfm" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_pfm \- CRIMP - PFM handling, NetPBM
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::pfm  ?0.1?\fR
.sp
\fB::crimp\fR \fBread pfm\fR \fIstring\fR
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp







|






|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_pfm" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_pfm \- CRIMP - PFM handling, NetPBM
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::pfm  ?0.2?\fR
.sp
\fB::crimp\fR \fBread pfm\fR \fIstring\fR
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp
Changes to embedded/man/files/crimp_pgm.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_pgm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_pgm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_pgm" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_pgm \- CRIMP - PGM handling, NetPBM
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::pgm  ?0.1?\fR
.sp
\fB::crimp\fR \fBread pgm\fR \fIstring\fR
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp







|






|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_pgm" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_pgm \- CRIMP - PGM handling, NetPBM
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::pgm  ?0.2?\fR
.sp
\fB::crimp\fR \fBread pgm\fR \fIstring\fR
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp
Changes to embedded/man/files/crimp_ppm.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_ppm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_ppm.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_ppm" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_ppm \- CRIMP - PPM handling, NetPBM
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::ppm  ?0.1?\fR
.sp
\fB::crimp\fR \fBread ppm\fR \fIstring\fR
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp







|






|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_ppm" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_ppm \- CRIMP - PPM handling, NetPBM
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::ppm  ?0.2?\fR
.sp
\fB::crimp\fR \fBread ppm\fR \fIstring\fR
.sp
\fB::crimp\fR \fBwrite 2string\fR \fIformat\fR \fIimage\fR
.sp
\fB::crimp\fR \fBwrite 2chan\fR \fIformat\fR \fIchan\fR \fIimage\fR
.sp
Changes to embedded/man/files/crimp_sgi.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_sgi.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_sgi.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_sgi" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_sgi \- CRIMP - SGI RASTER handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::sgi  ?0.1?\fR
.sp
\fB::crimp\fR \fBread sgi\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of SGI raster images
into CRIMP images. \fINote\fR that this package does \fInot\fR







|






|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_sgi" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_sgi \- CRIMP - SGI RASTER handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::sgi  ?0.2?\fR
.sp
\fB::crimp\fR \fBread sgi\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of SGI raster images
into CRIMP images. \fINote\fR that this package does \fInot\fR
Changes to embedded/man/files/crimp_sources.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_sources.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_sources.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
Changes to embedded/man/files/crimp_sun.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_sun.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_sun.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_sun" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_sun \- CRIMP - SUN RASTER handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::sun  ?0.1?\fR
.sp
\fB::crimp\fR \fBread sun\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of Sun raster images
into CRIMP images. \fINote\fR that this package does \fInot\fR







|






|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_sun" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_sun \- CRIMP - SUN RASTER handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBcrimp::sun  ?0.2?\fR
.sp
\fB::crimp\fR \fBread sun\fR \fIstring\fR
.sp
.BE
.SH DESCRIPTION
This package provides commands for the conversion of Sun raster images
into CRIMP images. \fINote\fR that this package does \fInot\fR
Changes to embedded/man/files/crimp_tk.n.
1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-trunk/embedded/man/files/crimp_tk.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?

|







1
2
3
4
5
6
7
8
9
'\"
'\" Generated from file '/net/nas/data/andreask/Dev/Crimp/dev-infinite-plane/embedded/man/files/crimp_tk.n' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2011 Andreas Kupries
'\" Copyright (c) 2011 Documentation, Andreas Kupries
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_tk" n 0.1 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_tk \- CRIMP - Tk Photo Handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTk  8.5\fR
.sp
package require \fBcrimp::tk  ?0.1?\fR
.sp
\fB::crimp\fR \fBread tk\fR \fIphoto\fR
.sp
\fB::crimp\fR \fBwrite 2tk\fR \fIphoto\fR \fIimage\fR
.sp
.BE
.SH DESCRIPTION







|








|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH "crimp_tk" n 0.2 doc "C Raster Image Manipulation Package"
.BS
.SH NAME
crimp_tk \- CRIMP - Tk Photo Handling
.SH SYNOPSIS
package require \fBTcl  8.5\fR
.sp
package require \fBTk  8.5\fR
.sp
package require \fBcrimp::tk  ?0.2?\fR
.sp
\fB::crimp\fR \fBread tk\fR \fIphoto\fR
.sp
\fB::crimp\fR \fBwrite 2tk\fR \fIphoto\fR \fIimage\fR
.sp
.BE
.SH DESCRIPTION
Changes to embedded/man/index.n.
309
310
311
312
313
314
315






316
317
318
319
320
321
322
.RE
BMP image import
.RS
.TP
\fBfiles/crimp_bmp.n\fR
crimp_bmp
.RE






canny
.RS
.TP
\fBfiles/crimp.n\fR
crimp
.RE
channels







>
>
>
>
>
>







309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
.RE
BMP image import
.RS
.TP
\fBfiles/crimp_bmp.n\fR
crimp_bmp
.RE
bounding box
.RS
.TP
\fBfiles/crimp_core.n\fR
crimp_core
.RE
canny
.RS
.TP
\fBfiles/crimp.n\fR
crimp
.RE
channels
680
681
682
683
684
685
686



687
688
689
690
691
692
693
crimp
.RE
geometry
.RS
.TP
\fBfiles/crimp.n\fR
crimp



.RE
gradient
.RS
.TP
\fBfiles/crimp.n\fR
crimp
.RE







>
>
>







686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
crimp
.RE
geometry
.RS
.TP
\fBfiles/crimp.n\fR
crimp
.TP
\fBfiles/crimp_core.n\fR
crimp_core
.RE
gradient
.RS
.TP
\fBfiles/crimp.n\fR
crimp
.RE
Changes to embedded/www/doc/files/crimp.html.
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp - CRIMP - Manipulation and Processing</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>







|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp - CRIMP - Manipulation and Processing</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">Tk 8.5</b></li>
<li>package require <b class="pkgname">crimp <span class="opt">?0.1?</span></b></li>
<li>package require <b class="pkgname">crimp::core <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">histogram</b> <i class="arg">image</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">statistics basic</b> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">statistics otsu</b> <i class="arg">stats</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">add</b> <i class="arg">image1</i> <i class="arg">image2</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::crimp</b> <b class="method">alpha blend</b> <i class="arg">foreground</i> <i class="arg">background</i> <i class="arg">alpha</i></a></li>







|
|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">Tk 8.5</b></li>
<li>package require <b class="pkgname">crimp <span class="opt">?0.2?</span></b></li>
<li>package require <b class="pkgname">crimp::core <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">histogram</b> <i class="arg">image</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">statistics basic</b> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">statistics otsu</b> <i class="arg">stats</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">add</b> <i class="arg">image1</i> <i class="arg">image2</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::crimp</b> <b class="method">alpha blend</b> <i class="arg">foreground</i> <i class="arg">background</i> <i class="arg">alpha</i></a></li>
222
223
224
225
226
227
228

229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350

351
352
353
354
355
356
357
<li><a href="#83"><b class="cmd">::crimp</b> <b class="method">psychedelia</b> <i class="arg">width</i> <i class="arg">height</i> <i class="arg">frames</i></a></li>
<li><a href="#84"><b class="cmd">::crimp</b> <b class="method">pyramid run</b> <i class="arg">image</i> <i class="arg">steps</i> <i class="arg">stepcmd</i></a></li>
<li><a href="#85"><b class="cmd">&lt;stepcmd&gt;</b> <i class="arg">image</i></a></li>
<li><a href="#86"><b class="cmd">::crimp</b> <b class="method">pyramid gauss</b> <i class="arg">image</i> <i class="arg">steps</i></a></li>
<li><a href="#87"><b class="cmd">::crimp</b> <b class="method">pyramid laplace</b> <i class="arg">image</i> <i class="arg">steps</i></a></li>
<li><a href="#88"><b class="cmd">::crimp</b> <b class="method">remap</b> <i class="arg">image</i> <i class="arg">map</i>...</a></li>
<li><a href="#89"><b class="cmd">::crimp</b> <b class="method">matchsize</b> <i class="arg">image1</i> <i class="arg">image2</i></a></li>

<li><a href="#90"><b class="cmd">::crimp</b> <b class="method">scale</b> <i class="arg">image</i> <i class="arg">scale</i></a></li>
<li><a href="#91"><b class="cmd">::crimp</b> <b class="method">screen</b> <i class="arg">image1</i> <i class="arg">image2</i></a></li>
<li><a href="#92"><b class="cmd">::crimp</b> <b class="method">solarize</b> <i class="arg">image</i> <i class="arg">threshold</i></a></li>
<li><a href="#93"><b class="cmd">::crimp</b> <b class="method">square</b> <i class="arg">image</i></a></li>
<li><a href="#94"><b class="cmd">::crimp</b> <b class="method">subtract</b> <i class="arg">image1</i> <i class="arg">image2</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#95"><b class="cmd">::crimp</b> <b class="method">threshold global above</b> <i class="arg">image</i> <i class="arg">threshold</i></a></li>
<li><a href="#96"><b class="cmd">::crimp</b> <b class="method">threshold global below</b> <i class="arg">image</i> <i class="arg">threshold</i></a></li>
<li><a href="#97"><b class="cmd">::crimp</b> <b class="method">threshold global inside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#98"><b class="cmd">::crimp</b> <b class="method">threshold global outside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#99"><b class="cmd">::crimp</b> <b class="method">threshold global middle</b> <i class="arg">image</i></a></li>
<li><a href="#100"><b class="cmd">::crimp</b> <b class="method">threshold global mean</b> <i class="arg">image</i></a></li>
<li><a href="#101"><b class="cmd">::crimp</b> <b class="method">threshold global median</b> <i class="arg">image</i></a></li>
<li><a href="#102"><b class="cmd">::crimp</b> <b class="method">threshold global otsu</b> <i class="arg">image</i></a></li>
<li><a href="#103"><b class="cmd">::crimp</b> <b class="method">threshold local</b> <i class="arg">image</i> <i class="arg">threshold</i>...</a></li>
<li><a href="#104"><b class="cmd">::crimp</b> <b class="method">upsample xy</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#105"><b class="cmd">::crimp</b> <b class="method">upsample x</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#106"><b class="cmd">::crimp</b> <b class="method">upsample y</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#107"><b class="cmd">::crimp</b> <b class="method">wavy</b> <i class="arg">image</i> <i class="arg">offset</i> <i class="arg">adj1</i> <i class="arg">adjb</i></a></li>
<li><a href="#108"><b class="cmd">::crimp</b> <b class="method">flip horizontal</b> <i class="arg">image</i></a></li>
<li><a href="#109"><b class="cmd">::crimp</b> <b class="method">flip transpose</b> <i class="arg">image</i></a></li>
<li><a href="#110"><b class="cmd">::crimp</b> <b class="method">flip transverse</b> <i class="arg">image</i></a></li>
<li><a href="#111"><b class="cmd">::crimp</b> <b class="method">flip vertical</b> <i class="arg">image</i></a></li>
<li><a href="#112"><b class="cmd">::crimp</b> <b class="method">resize</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">w</i> <i class="arg">h</i></a></li>
<li><a href="#113"><b class="cmd">::crimp</b> <b class="method">rotate cw</b> <i class="arg">image</i></a></li>
<li><a href="#114"><b class="cmd">::crimp</b> <b class="method">rotate ccw</b> <i class="arg">image</i></a></li>
<li><a href="#115"><b class="cmd">::crimp</b> <b class="method">rotate half</b> <i class="arg">image</i></a></li>
<li><a href="#116"><b class="cmd">::crimp</b> <b class="method">warp field</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">xvec</i> <i class="arg">yvec</i></a></li>
<li><a href="#117"><b class="cmd">::crimp</b> <b class="method">warp projective</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">transform</i></a></li>
<li><a href="#118"><b class="cmd">::crimp</b> <b class="method">window</b> <i class="arg">image</i></a></li>
<li><a href="#119"><b class="cmd">::crimp</b> <b class="method">convert 2grey32</b> <i class="arg">image</i></a></li>
<li><a href="#120"><b class="cmd">::crimp</b> <b class="method">convert 2grey16</b> <i class="arg">image</i></a></li>
<li><a href="#121"><b class="cmd">::crimp</b> <b class="method">convert 2grey8</b> <i class="arg">image</i></a></li>
<li><a href="#122"><b class="cmd">::crimp</b> <b class="method">convert 2float</b> <i class="arg">image</i></a></li>
<li><a href="#123"><b class="cmd">::crimp</b> <b class="method">convert 2complex</b> <i class="arg">image</i></a></li>
<li><a href="#124"><b class="cmd">::crimp</b> <b class="method">convert 2hsv</b> <i class="arg">image</i></a></li>
<li><a href="#125"><b class="cmd">::crimp</b> <b class="method">convert 2rgba</b> <i class="arg">image</i></a></li>
<li><a href="#126"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></li>
<li><a href="#127"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></li>
<li><a href="#128"><b class="cmd">::crimp</b> <b class="method">complex magnitude</b> <i class="arg">image</i></a></li>
<li><a href="#129"><b class="cmd">::crimp</b> <b class="method">complex 2complex</b> <i class="arg">image</i></a></li>
<li><a href="#130"><b class="cmd">::crimp</b> <b class="method">complex imaginary</b> <i class="arg">image</i></a></li>
<li><a href="#131"><b class="cmd">::crimp</b> <b class="method">complex real</b> <i class="arg">image</i></a></li>
<li><a href="#132"><b class="cmd">::crimp</b> <b class="method">complex conjugate</b> <i class="arg">image</i></a></li>

<li><a href="#133"><b class="cmd">::crimp</b> <b class="method">join 2hsv</b> <i class="arg">hueImage</i> <i class="arg">satImage</i> <i class="arg">valImage</i></a></li>
<li><a href="#134"><b class="cmd">::crimp</b> <b class="method">join 2rgba</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i> <i class="arg">alphaImage</i></a></li>
<li><a href="#135"><b class="cmd">::crimp</b> <b class="method">join 2rgb</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i></a></li>
<li><a href="#136"><b class="cmd">::crimp</b> <b class="method">join 2complex</b> <i class="arg">realImage</i> <i class="arg">imaginaryImage</i></a></li>
<li><a href="#137"><b class="cmd">::crimp</b> <b class="method">join 2grey16</b> <i class="arg">msbImage</i> <i class="arg">lsbImage</i></a></li>
<li><a href="#138"><b class="cmd">::crimp</b> <b class="method">join 2grey32</b> <i class="arg">mmsbImage</i> <i class="arg">lmsbImage</i> <i class="arg">mlsbImage</i> <i class="arg">llsbImage</i></a></li>
<li><a href="#139"><b class="cmd">::crimp</b> <b class="method">split</b> <i class="arg">image</i></a></li>
<li><a href="#140"><b class="cmd">::crimp</b> <b class="method">read pgm</b> <i class="arg">string</i></a></li>
<li><a href="#141"><b class="cmd">::crimp</b> <b class="method">read ppm</b> <i class="arg">string</i></a></li>
<li><a href="#142"><b class="cmd">::crimp</b> <b class="method">read strimj</b> <i class="arg">string</i> <span class="opt">?<i class="arg">colormap</i>?</span></a></li>
<li><a href="#143"><b class="cmd">::crimp</b> <b class="method">gradient grey8</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#144"><b class="cmd">::crimp</b> <b class="method">gradient rgb</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#145"><b class="cmd">::crimp</b> <b class="method">gradient rgba</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#146"><b class="cmd">::crimp</b> <b class="method">gradient hsv</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#147"><b class="cmd">::crimp</b> <b class="method">register translation</b> <i class="arg">needle</i> <i class="arg">haystack</i></a></li>
<li><a href="#148"><b class="cmd">::crimp</b> <b class="method">kernel make</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#149"><b class="cmd">::crimp</b> <b class="method">kernel fpmake</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#150"><b class="cmd">::crimp</b> <b class="method">kernel transpose</b> <i class="arg">kernel</i></a></li>
<li><a href="#151"><b class="cmd">::crimp</b> <b class="method">kernel image</b> <i class="arg">kernel</i></a></li>
<li><a href="#152"><b class="cmd">::crimp</b> <b class="method">map</b> <i class="arg">arg</i>...</a></li>
<li><a href="#153"><b class="cmd">::crimp</b> <b class="method">mapof</b> <i class="arg">table</i></a></li>
<li><a href="#154"><b class="cmd">::crimp</b> <b class="method">table compose</b> <i class="arg">f</i> <i class="arg">g</i></a></li>
<li><a href="#155"><b class="cmd">::crimp</b> <b class="method">table eval wrap</b> <i class="arg">cmd</i></a></li>
<li><a href="#156"><b class="cmd">::crimp</b> <b class="method">table eval clamp</b> <i class="arg">cmd</i></a></li>
<li><a href="#157"><b class="cmd">&lt;cmd&gt;</b> <i class="arg">x</i></a></li>
<li><a href="#158"><b class="cmd">::crimp</b> <b class="method">table degamma</b> <i class="arg">y</i></a></li>
<li><a href="#159"><b class="cmd">::crimp</b> <b class="method">table gamma</b> <i class="arg">y</i></a></li>
<li><a href="#160"><b class="cmd">::crimp</b> <b class="method">table gauss</b> <i class="arg">sigma</i></a></li>
<li><a href="#161"><b class="cmd">::crimp</b> <b class="method">table identity</b></a></li>
<li><a href="#162"><b class="cmd">::crimp</b> <b class="method">table invers</b></a></li>
<li><a href="#163"><b class="cmd">::crimp</b> <b class="method">table linear wrap</b> <i class="arg">gain</i> <i class="arg">offset</i></a></li>
<li><a href="#164"><b class="cmd">::crimp</b> <b class="method">table linear clamp</b> <i class="arg">gain</i> <i class="arg">offset</i></a></li>
<li><a href="#165"><b class="cmd">::crimp</b> <b class="method">table log</b> <span class="opt">?<i class="arg">max</i>?</span></a></li>
<li><a href="#166"><b class="cmd">::crimp</b> <b class="method">table solarize</b> <i class="arg">threshold</i></a></li>
<li><a href="#167"><b class="cmd">::crimp</b> <b class="method">table sqrt</b> <span class="opt">?<i class="arg">max</i>?</span></a></li>
<li><a href="#168"><b class="cmd">::crimp</b> <b class="method">table stretch</b> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#169"><b class="cmd">::crimp</b> <b class="method">table threshold above</b> <i class="arg">threshold</i></a></li>
<li><a href="#170"><b class="cmd">::crimp</b> <b class="method">table threshold below</b> <i class="arg">threshold</i></a></li>
<li><a href="#171"><b class="cmd">::crimp</b> <b class="method">table threshold inside</b> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#172"><b class="cmd">::crimp</b> <b class="method">table threshold outside</b> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#173"><b class="cmd">::crimp</b> <b class="method">table fgauss discrete</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></li>
<li><a href="#174"><b class="cmd">::crimp</b> <b class="method">table fgauss sampled</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></li>
<li><a href="#175"><b class="cmd">::crimp</b> <b class="method">transform affine</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i></a></li>
<li><a href="#176"><b class="cmd">::crimp</b> <b class="method">transform chain</b> <i class="arg">transform</i>...</a></li>
<li><a href="#177"><b class="cmd">::crimp</b> <b class="method">transform invert</b> <i class="arg">transform</i></a></li>
<li><a href="#178"><b class="cmd">::crimp</b> <b class="method">transform projective</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i> <i class="arg">g</i> <i class="arg">h</i></a></li>
<li><a href="#179"><b class="cmd">::crimp</b> <b class="method">transform quadrilateral</b> <i class="arg">src</i> <i class="arg">dst</i></a></li>
<li><a href="#180"><b class="cmd">::crimp</b> <b class="method">transform rotate</b> <i class="arg">theta</i> <span class="opt">?<i class="arg">center</i>?</span></a></li>
<li><a href="#181"><b class="cmd">::crimp</b> <b class="method">transform scale</b> <i class="arg">sx</i> <i class="arg">sy</i></a></li>
<li><a href="#182"><b class="cmd">::crimp</b> <b class="method">transform translate</b> <i class="arg">dx</i> <i class="arg">dy</i></a></li>
<li><a href="#183"><b class="cmd">::crimp::black_white_vertical</b></a></li>
<li><a href="#184"><b class="cmd">::crimp::bilateral_*</b> <i class="arg">image</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></li>
<li><a href="#185"><b class="cmd">::crimp::joint_bilateral_*</b> <i class="arg">image</i> <i class="arg">wimage</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></li>
<li><a href="#186"><b class="cmd">::crimp::color_combine</b> <i class="arg">image</i> <i class="arg">vector</i></a></li>
<li><a href="#187"><b class="cmd">::crimp::color_mix</b> <i class="arg">image</i> <i class="arg">matrix</i></a></li>
<li><a href="#188"><b class="cmd">::crimp::connected_components</b> <i class="arg">image</i> <i class="arg">8connected</i></a></li>
<li><a href="#189"><b class="cmd">::crimp::connected_components_*</b> <i class="arg">image</i> <i class="arg">8connected</i> <i class="arg">bgValue</i></a></li>
<li><a href="#190"><b class="cmd">::crimp::euclidean_distance_map_float</b> <i class="arg">image</i></a></li>
<li><a href="#191"><b class="cmd">::crimp::indicator_grey8_float</b> <i class="arg">image</i></a></li>
<li><a href="#192"><b class="cmd">::crimp::hough_grey8</b> <i class="arg">image</i> <i class="arg">emptybucketcolor</i></a></li>
<li><a href="#193"><b class="cmd">::crimp::gaussian_01_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></li>
<li><a href="#194"><b class="cmd">::crimp::gaussian_10_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></li>
<li><a href="#195"><b class="cmd">::crimp::gaussian_blur_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></li>
<li><a href="#196"><b class="cmd">::crimp::gaussian_laplacian_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></li>
<li><a href="#197"><b class="cmd">::crimp::gaussian_gradient_mag_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></li>
<li><a href="#198"><b class="cmd">::crimp::map_2*_*</b> <i class="arg">image</i> <i class="arg">map</i></a></li>
<li><a href="#199"><b class="cmd">::crimp::map2_*</b> <i class="arg">image</i> <i class="arg">mapNimage</i>... <i class="arg">mapNcontrol</i>...</a></li>
<li><a href="#200"><b class="cmd">::crimp::region_sum</b> <i class="arg">image</i> <i class="arg">radius</i></a></li>
<li><a href="#201"><b class="cmd">::crimp::exp_float</b> <i class="arg">image</i></a></li>
<li><a href="#202"><b class="cmd">::crimp::log_float</b> <i class="arg">image</i></a></li>
<li><a href="#203"><b class="cmd">::crimp::log10_float</b> <i class="arg">image</i></a></li>
<li><a href="#204"><b class="cmd">::crimp::offset_float</b> <i class="arg">image</i> <i class="arg">offset</i></a></li>
<li><a href="#205"><b class="cmd">::crimp::pow_float_float</b> <i class="arg">imageBase</i> <i class="arg">imageExponent</i></a></li>
<li><a href="#206"><b class="cmd">::crimp::scale_float</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#207"><b class="cmd">::crimp::sqrt_float</b> <i class="arg">image</i></a></li>
<li><a href="#208"><b class="cmd">::crimp::non_max_suppression</b> <i class="arg">imageMagnitude</i> <i class="arg">imageAngle</i></a></li>
<li><a href="#209"><b class="cmd">::crimp::trace_hysteresis</b> <i class="arg">image</i> <i class="arg">low</i> <i class="arg">high</i></a></li>
<li><a href="#210"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></li>
<li><a href="#211"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></li>

</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package, built on top of the <b class="package">crimp::core</b> package
provides the majority of CRIMPs power, manipulating and transforming
images in a number of ways.</p>







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|

|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<

>







222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257

258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
357
358
<li><a href="#83"><b class="cmd">::crimp</b> <b class="method">psychedelia</b> <i class="arg">width</i> <i class="arg">height</i> <i class="arg">frames</i></a></li>
<li><a href="#84"><b class="cmd">::crimp</b> <b class="method">pyramid run</b> <i class="arg">image</i> <i class="arg">steps</i> <i class="arg">stepcmd</i></a></li>
<li><a href="#85"><b class="cmd">&lt;stepcmd&gt;</b> <i class="arg">image</i></a></li>
<li><a href="#86"><b class="cmd">::crimp</b> <b class="method">pyramid gauss</b> <i class="arg">image</i> <i class="arg">steps</i></a></li>
<li><a href="#87"><b class="cmd">::crimp</b> <b class="method">pyramid laplace</b> <i class="arg">image</i> <i class="arg">steps</i></a></li>
<li><a href="#88"><b class="cmd">::crimp</b> <b class="method">remap</b> <i class="arg">image</i> <i class="arg">map</i>...</a></li>
<li><a href="#89"><b class="cmd">::crimp</b> <b class="method">matchsize</b> <i class="arg">image1</i> <i class="arg">image2</i></a></li>
<li><a href="#90"><b class="cmd">::crimp</b> <b class="method">matchgeo</b> <i class="arg">image</i> <i class="arg">bbox</i></a></li>
<li><a href="#91"><b class="cmd">::crimp</b> <b class="method">scale</b> <i class="arg">image</i> <i class="arg">scale</i></a></li>
<li><a href="#92"><b class="cmd">::crimp</b> <b class="method">screen</b> <i class="arg">image1</i> <i class="arg">image2</i></a></li>
<li><a href="#93"><b class="cmd">::crimp</b> <b class="method">solarize</b> <i class="arg">image</i> <i class="arg">threshold</i></a></li>
<li><a href="#94"><b class="cmd">::crimp</b> <b class="method">square</b> <i class="arg">image</i></a></li>
<li><a href="#95"><b class="cmd">::crimp</b> <b class="method">subtract</b> <i class="arg">image1</i> <i class="arg">image2</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#96"><b class="cmd">::crimp</b> <b class="method">threshold global above</b> <i class="arg">image</i> <i class="arg">threshold</i></a></li>
<li><a href="#97"><b class="cmd">::crimp</b> <b class="method">threshold global below</b> <i class="arg">image</i> <i class="arg">threshold</i></a></li>
<li><a href="#98"><b class="cmd">::crimp</b> <b class="method">threshold global inside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#99"><b class="cmd">::crimp</b> <b class="method">threshold global outside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#100"><b class="cmd">::crimp</b> <b class="method">threshold global middle</b> <i class="arg">image</i></a></li>
<li><a href="#101"><b class="cmd">::crimp</b> <b class="method">threshold global mean</b> <i class="arg">image</i></a></li>
<li><a href="#102"><b class="cmd">::crimp</b> <b class="method">threshold global median</b> <i class="arg">image</i></a></li>
<li><a href="#103"><b class="cmd">::crimp</b> <b class="method">threshold global otsu</b> <i class="arg">image</i></a></li>
<li><a href="#104"><b class="cmd">::crimp</b> <b class="method">threshold local</b> <i class="arg">image</i> <i class="arg">threshold</i>...</a></li>
<li><a href="#105"><b class="cmd">::crimp</b> <b class="method">upsample xy</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#106"><b class="cmd">::crimp</b> <b class="method">upsample x</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#107"><b class="cmd">::crimp</b> <b class="method">upsample y</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#108"><b class="cmd">::crimp</b> <b class="method">wavy</b> <i class="arg">image</i> <i class="arg">offset</i> <i class="arg">adj1</i> <i class="arg">adjb</i></a></li>
<li><a href="#109"><b class="cmd">::crimp</b> <b class="method">flip horizontal</b> <i class="arg">image</i></a></li>
<li><a href="#110"><b class="cmd">::crimp</b> <b class="method">flip transpose</b> <i class="arg">image</i></a></li>
<li><a href="#111"><b class="cmd">::crimp</b> <b class="method">flip transverse</b> <i class="arg">image</i></a></li>
<li><a href="#112"><b class="cmd">::crimp</b> <b class="method">flip vertical</b> <i class="arg">image</i></a></li>
<li><a href="#113"><b class="cmd">::crimp</b> <b class="method">resize</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">w</i> <i class="arg">h</i></a></li>
<li><a href="#114"><b class="cmd">::crimp</b> <b class="method">rotate cw</b> <i class="arg">image</i></a></li>
<li><a href="#115"><b class="cmd">::crimp</b> <b class="method">rotate ccw</b> <i class="arg">image</i></a></li>
<li><a href="#116"><b class="cmd">::crimp</b> <b class="method">rotate half</b> <i class="arg">image</i></a></li>
<li><a href="#117"><b class="cmd">::crimp</b> <b class="method">warp field</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">xvec</i> <i class="arg">yvec</i></a></li>
<li><a href="#118"><b class="cmd">::crimp</b> <b class="method">warp projective</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">transform</i></a></li>

<li><a href="#119"><b class="cmd">::crimp</b> <b class="method">window</b> <i class="arg">image</i></a></li>
<li><a href="#120"><b class="cmd">::crimp</b> <b class="method">convert 2grey32</b> <i class="arg">image</i></a></li>
<li><a href="#121"><b class="cmd">::crimp</b> <b class="method">convert 2grey16</b> <i class="arg">image</i></a></li>
<li><a href="#122"><b class="cmd">::crimp</b> <b class="method">convert 2grey8</b> <i class="arg">image</i></a></li>
<li><a href="#123"><b class="cmd">::crimp</b> <b class="method">convert 2float</b> <i class="arg">image</i></a></li>
<li><a href="#124"><b class="cmd">::crimp</b> <b class="method">convert 2complex</b> <i class="arg">image</i></a></li>
<li><a href="#125"><b class="cmd">::crimp</b> <b class="method">convert 2hsv</b> <i class="arg">image</i></a></li>
<li><a href="#126"><b class="cmd">::crimp</b> <b class="method">convert 2rgba</b> <i class="arg">image</i></a></li>
<li><a href="#127"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></li>
<li><a href="#128"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></li>
<li><a href="#129"><b class="cmd">::crimp</b> <b class="method">complex magnitude</b> <i class="arg">image</i></a></li>
<li><a href="#130"><b class="cmd">::crimp</b> <b class="method">complex 2complex</b> <i class="arg">image</i></a></li>
<li><a href="#131"><b class="cmd">::crimp</b> <b class="method">complex imaginary</b> <i class="arg">image</i></a></li>
<li><a href="#132"><b class="cmd">::crimp</b> <b class="method">complex real</b> <i class="arg">image</i></a></li>
<li><a href="#133"><b class="cmd">::crimp</b> <b class="method">complex conjugate</b> <i class="arg">image</i></a></li>
<li><a href="#134"><b class="cmd">::crimp</b> <b class="method">join 2hsv</b> <i class="arg">hueImage</i> <i class="arg">satImage</i> <i class="arg">valImage</i></a></li>
<li><a href="#135"><b class="cmd">::crimp</b> <b class="method">join 2rgba</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i> <i class="arg">alphaImage</i></a></li>
<li><a href="#136"><b class="cmd">::crimp</b> <b class="method">join 2rgb</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i></a></li>
<li><a href="#137"><b class="cmd">::crimp</b> <b class="method">join 2complex</b> <i class="arg">realImage</i> <i class="arg">imaginaryImage</i></a></li>
<li><a href="#138"><b class="cmd">::crimp</b> <b class="method">join 2grey16</b> <i class="arg">msbImage</i> <i class="arg">lsbImage</i></a></li>
<li><a href="#139"><b class="cmd">::crimp</b> <b class="method">join 2grey32</b> <i class="arg">mmsbImage</i> <i class="arg">lmsbImage</i> <i class="arg">mlsbImage</i> <i class="arg">llsbImage</i></a></li>
<li><a href="#140"><b class="cmd">::crimp</b> <b class="method">split</b> <i class="arg">image</i></a></li>
<li><a href="#141"><b class="cmd">::crimp</b> <b class="method">read pgm</b> <i class="arg">string</i></a></li>
<li><a href="#142"><b class="cmd">::crimp</b> <b class="method">read ppm</b> <i class="arg">string</i></a></li>
<li><a href="#143"><b class="cmd">::crimp</b> <b class="method">read strimj</b> <i class="arg">string</i> <span class="opt">?<i class="arg">colormap</i>?</span></a></li>
<li><a href="#144"><b class="cmd">::crimp</b> <b class="method">gradient grey8</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#145"><b class="cmd">::crimp</b> <b class="method">gradient rgb</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#146"><b class="cmd">::crimp</b> <b class="method">gradient rgba</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#147"><b class="cmd">::crimp</b> <b class="method">gradient hsv</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></li>
<li><a href="#148"><b class="cmd">::crimp</b> <b class="method">register translation</b> <i class="arg">needle</i> <i class="arg">haystack</i></a></li>
<li><a href="#149"><b class="cmd">::crimp</b> <b class="method">kernel make</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#150"><b class="cmd">::crimp</b> <b class="method">kernel fpmake</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">offset</i>?</span></a></li>
<li><a href="#151"><b class="cmd">::crimp</b> <b class="method">kernel transpose</b> <i class="arg">kernel</i></a></li>
<li><a href="#152"><b class="cmd">::crimp</b> <b class="method">kernel image</b> <i class="arg">kernel</i></a></li>
<li><a href="#153"><b class="cmd">::crimp</b> <b class="method">map</b> <i class="arg">arg</i>...</a></li>
<li><a href="#154"><b class="cmd">::crimp</b> <b class="method">mapof</b> <i class="arg">table</i></a></li>
<li><a href="#155"><b class="cmd">::crimp</b> <b class="method">table compose</b> <i class="arg">f</i> <i class="arg">g</i></a></li>
<li><a href="#156"><b class="cmd">::crimp</b> <b class="method">table eval wrap</b> <i class="arg">cmd</i></a></li>
<li><a href="#157"><b class="cmd">::crimp</b> <b class="method">table eval clamp</b> <i class="arg">cmd</i></a></li>
<li><a href="#158"><b class="cmd">&lt;cmd&gt;</b> <i class="arg">x</i></a></li>
<li><a href="#159"><b class="cmd">::crimp</b> <b class="method">table degamma</b> <i class="arg">y</i></a></li>
<li><a href="#160"><b class="cmd">::crimp</b> <b class="method">table gamma</b> <i class="arg">y</i></a></li>
<li><a href="#161"><b class="cmd">::crimp</b> <b class="method">table gauss</b> <i class="arg">sigma</i></a></li>
<li><a href="#162"><b class="cmd">::crimp</b> <b class="method">table identity</b></a></li>
<li><a href="#163"><b class="cmd">::crimp</b> <b class="method">table invers</b></a></li>
<li><a href="#164"><b class="cmd">::crimp</b> <b class="method">table linear wrap</b> <i class="arg">gain</i> <i class="arg">offset</i></a></li>
<li><a href="#165"><b class="cmd">::crimp</b> <b class="method">table linear clamp</b> <i class="arg">gain</i> <i class="arg">offset</i></a></li>
<li><a href="#166"><b class="cmd">::crimp</b> <b class="method">table log</b> <span class="opt">?<i class="arg">max</i>?</span></a></li>
<li><a href="#167"><b class="cmd">::crimp</b> <b class="method">table solarize</b> <i class="arg">threshold</i></a></li>
<li><a href="#168"><b class="cmd">::crimp</b> <b class="method">table sqrt</b> <span class="opt">?<i class="arg">max</i>?</span></a></li>
<li><a href="#169"><b class="cmd">::crimp</b> <b class="method">table stretch</b> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#170"><b class="cmd">::crimp</b> <b class="method">table threshold above</b> <i class="arg">threshold</i></a></li>
<li><a href="#171"><b class="cmd">::crimp</b> <b class="method">table threshold below</b> <i class="arg">threshold</i></a></li>
<li><a href="#172"><b class="cmd">::crimp</b> <b class="method">table threshold inside</b> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#173"><b class="cmd">::crimp</b> <b class="method">table threshold outside</b> <i class="arg">min</i> <i class="arg">max</i></a></li>
<li><a href="#174"><b class="cmd">::crimp</b> <b class="method">table fgauss discrete</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></li>
<li><a href="#175"><b class="cmd">::crimp</b> <b class="method">table fgauss sampled</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></li>
<li><a href="#176"><b class="cmd">::crimp</b> <b class="method">transform affine</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i></a></li>
<li><a href="#177"><b class="cmd">::crimp</b> <b class="method">transform chain</b> <i class="arg">transform</i>...</a></li>
<li><a href="#178"><b class="cmd">::crimp</b> <b class="method">transform invert</b> <i class="arg">transform</i></a></li>
<li><a href="#179"><b class="cmd">::crimp</b> <b class="method">transform projective</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i> <i class="arg">g</i> <i class="arg">h</i></a></li>
<li><a href="#180"><b class="cmd">::crimp</b> <b class="method">transform quadrilateral</b> <i class="arg">src</i> <i class="arg">dst</i></a></li>
<li><a href="#181"><b class="cmd">::crimp</b> <b class="method">transform rotate</b> <i class="arg">theta</i> <span class="opt">?<i class="arg">center</i>?</span></a></li>
<li><a href="#182"><b class="cmd">::crimp</b> <b class="method">transform scale</b> <i class="arg">sx</i> <i class="arg">sy</i></a></li>
<li><a href="#183"><b class="cmd">::crimp</b> <b class="method">transform translate</b> <i class="arg">dx</i> <i class="arg">dy</i></a></li>
<li><a href="#184"><b class="cmd">::crimp::black_white_vertical</b></a></li>
<li><a href="#185"><b class="cmd">::crimp::bilateral_*</b> <i class="arg">image</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></li>
<li><a href="#186"><b class="cmd">::crimp::joint_bilateral_*</b> <i class="arg">image</i> <i class="arg">wimage</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></li>
<li><a href="#187"><b class="cmd">::crimp::color_combine</b> <i class="arg">image</i> <i class="arg">vector</i></a></li>
<li><a href="#188"><b class="cmd">::crimp::color_mix</b> <i class="arg">image</i> <i class="arg">matrix</i></a></li>
<li><a href="#189"><b class="cmd">::crimp::connected_components</b> <i class="arg">image</i> <i class="arg">8connected</i></a></li>
<li><a href="#190"><b class="cmd">::crimp::connected_components_*</b> <i class="arg">image</i> <i class="arg">8connected</i> <i class="arg">bgValue</i></a></li>
<li><a href="#191"><b class="cmd">::crimp::euclidean_distance_map_float</b> <i class="arg">image</i></a></li>
<li><a href="#192"><b class="cmd">::crimp::indicator_grey8_float</b> <i class="arg">image</i></a></li>
<li><a href="#193"><b class="cmd">::crimp::hough_grey8</b> <i class="arg">image</i> <i class="arg">emptybucketcolor</i></a></li>
<li><a href="#194"><b class="cmd">::crimp::gaussian_01_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></li>
<li><a href="#195"><b class="cmd">::crimp::gaussian_10_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></li>
<li><a href="#196"><b class="cmd">::crimp::gaussian_blur_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></li>
<li><a href="#197"><b class="cmd">::crimp::gaussian_laplacian_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></li>
<li><a href="#198"><b class="cmd">::crimp::gaussian_gradient_mag_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></li>
<li><a href="#199"><b class="cmd">::crimp::map_2*_*</b> <i class="arg">image</i> <i class="arg">map</i></a></li>
<li><a href="#200"><b class="cmd">::crimp::map2_*</b> <i class="arg">image</i> <i class="arg">mapNimage</i>... <i class="arg">mapNcontrol</i>...</a></li>
<li><a href="#201"><b class="cmd">::crimp::region_sum</b> <i class="arg">image</i> <i class="arg">radius</i></a></li>
<li><a href="#202"><b class="cmd">::crimp::exp_float</b> <i class="arg">image</i></a></li>
<li><a href="#203"><b class="cmd">::crimp::log_float</b> <i class="arg">image</i></a></li>
<li><a href="#204"><b class="cmd">::crimp::log10_float</b> <i class="arg">image</i></a></li>
<li><a href="#205"><b class="cmd">::crimp::offset_float</b> <i class="arg">image</i> <i class="arg">offset</i></a></li>
<li><a href="#206"><b class="cmd">::crimp::pow_float_float</b> <i class="arg">imageBase</i> <i class="arg">imageExponent</i></a></li>
<li><a href="#207"><b class="cmd">::crimp::scale_float</b> <i class="arg">image</i> <i class="arg">factor</i></a></li>
<li><a href="#208"><b class="cmd">::crimp::sqrt_float</b> <i class="arg">image</i></a></li>
<li><a href="#209"><b class="cmd">::crimp::non_max_suppression</b> <i class="arg">imageMagnitude</i> <i class="arg">imageAngle</i></a></li>
<li><a href="#210"><b class="cmd">::crimp::trace_hysteresis</b> <i class="arg">image</i> <i class="arg">low</i> <i class="arg">high</i></a></li>

<li><a href="#211"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></li>
<li><a href="#212"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package, built on top of the <b class="package">crimp::core</b> package
provides the majority of CRIMPs power, manipulating and transforming
images in a number of ways.</p>
1053
1054
1055
1056
1057
1058
1059






1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
single-byte channels, i.e. all but <b class="const">grey16</b>, <b class="const">grey32</b>,
<b class="const">float</b>, and <b class="const">bw</b>.</p></dd>
<dt><a name="89"><b class="cmd">::crimp</b> <b class="method">matchsize</b> <i class="arg">image1</i> <i class="arg">image2</i></a></dt>
<dd><p>This method takes two images, forces them to be of the same size by
expanding the smaller dimensions with black pixels, and then returns a
list of the expanded images. The images in the result are in the same
order as as arguments.</p></dd>






<dt><a name="90"><b class="cmd">::crimp</b> <b class="method">scale</b> <i class="arg">image</i> <i class="arg">scale</i></a></dt>
<dd><p>This method performs a pixel-wise multiplication of the image with a
constant factor. It is currently supported by all <b class="const">greyN</b> image
types, plus the types <b class="const">float</b> and <b class="const">fpcomplex</b>. The first
accept an integer scaling factor, whereas the last two accept any
floating point number.</p></dd>
<dt><a name="91"><b class="cmd">::crimp</b> <b class="method">screen</b> <i class="arg">image1</i> <i class="arg">image2</i></a></dt>
<dd><p>This method combines the two input images by inverting the
multiplication of the inverted input images. I.e.</p>
<p><img alt="screen" src="../../image/screen.png"></p></dd>
<dt><a name="92"><b class="cmd">::crimp</b> <b class="method">solarize</b> <i class="arg">image</i> <i class="arg">threshold</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">solarize</b>
function with parameter <i class="arg">threshold</i>, and returns the modified
image as it result. This is also known as the <i class="term"><a href="../../index.html#key131">sabattier effect</a></i>.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map solarize</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="93"><b class="cmd">::crimp</b> <b class="method">square</b> <i class="arg">image</i></a></dt>
<dd><p>This is a convenience method equivalent to
&quot;<b class="cmd">crimp multiply</b> <i class="arg">image</i> <i class="arg">image</i>&quot;.</p></dd>
<dt><a name="94"><b class="cmd">::crimp</b> <b class="method">subtract</b> <i class="arg">image1</i> <i class="arg">image2</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></dt>
<dd><p>This method combines the two input images into a result image by
performing a pixelwise subtraction (image1 - image2) followed by
division through <i class="arg">scale</i> and addition of the <i class="arg">offset</i>. They
default to <b class="const">1</b> and <b class="const">0</b> respectively, if they are not
specified.</p></dd>
<dt><a name="95"><b class="cmd">::crimp</b> <b class="method">threshold global above</b> <i class="arg">image</i> <i class="arg">threshold</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold above</b>
function with parameter <i class="arg">threshold</i>, and returns the modified
image as it result. As the result only contains black and white,
i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i> or
foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold above</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="96"><b class="cmd">::crimp</b> <b class="method">threshold global below</b> <i class="arg">image</i> <i class="arg">threshold</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold below</b>
function with parameter <i class="arg">threshold</i>, and returns the modified
image as it result. As the result only contains black and white,
i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i>, or
foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold below</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="97"><b class="cmd">::crimp</b> <b class="method">threshold global inside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold inside</b>
function with parameters <i class="arg">min</i> and <i class="arg">max</i>, and returns the
modified image as it result. As the result only contains black and
white, i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i>
or foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold above</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="98"><b class="cmd">::crimp</b> <b class="method">threshold global outside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold outside</b>
function with parameters <i class="arg">min</i> and <i class="arg">max</i>, and returns the
modified image as it result. As the result only contains black and
white, i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i>,
or foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold below</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="99"><b class="cmd">::crimp</b> <b class="method">threshold global middle</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="100"><b class="cmd">::crimp</b> <b class="method">threshold global mean</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="101"><b class="cmd">::crimp</b> <b class="method">threshold global median</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="102"><b class="cmd">::crimp</b> <b class="method">threshold global otsu</b> <i class="arg">image</i></a></dt>
<dd><p>These four methods are convenience methods layered on top of
<b class="cmd">crimp threshold global below</b>. They compute the value(s) to
perform the thresholding with from the global statistics of the input
image, with the element taken named by the method. For reference see
the documentation of method <b class="cmd">crimp statistics ...</b>. Note that
they treat each color channel in the image separately.</p></dd>
<dt><a name="103"><b class="cmd">::crimp</b> <b class="method">threshold local</b> <i class="arg">image</i> <i class="arg">threshold</i>...</a></dt>
<dd><p>This method takes an <i class="arg">image</i> and one or more <i class="arg">threshold</i> maps
and returns an image where all pixels of the input which were larger
or equal to the corresponding pixel in the map are set to black. All
other pixels are set to white. Each map is applied to one color
channel of the input image. If there are too many maps the remainder
is ignored. If there are not enough maps the last map is replicated.</p>
<p>This is the core for all methods of non-global
<i class="term"><a href="../../index.html#key148">binarization</a></i>, i.e. foreground/background segmentation. Their
differences are just in the calculation of the maps.</p>
<p>This method supports all image types with one or more
single-byte channels, i.e. all but <b class="const">grey16</b>, <b class="const">grey32</b>, and
<b class="const">bw</b>.</p></dd>
<dt><a name="104"><b class="cmd">::crimp</b> <b class="method">upsample xy</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd></dd>
<dt><a name="105"><b class="cmd">::crimp</b> <b class="method">upsample x</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd></dd>
<dt><a name="106"><b class="cmd">::crimp</b> <b class="method">upsample y</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd><p>This method returns an image inserting <i class="arg">factor</i> black pixels between
each pixel of the input <i class="arg">image</i> (in x, y, or both dimensions). The effect is
that the input is expanded by <i class="arg">factor</i>. It is the complement of
method <b class="method">downsample</b>.</p>
<p>Using the method as is is not recommended because this simple upsampling
will cause copies of the image to appear at the higher image frequencies in the
expanded spectrum. This is normally avoided by running a low-pass filter over
the image after the upsampling, removing the problematic copies.</p>
<p>The <b class="method">interpolate</b> method is a convenience method combining these
two steps into one.</p></dd>
<dt><a name="107"><b class="cmd">::crimp</b> <b class="method">wavy</b> <i class="arg">image</i> <i class="arg">offset</i> <i class="arg">adj1</i> <i class="arg">adjb</i></a></dt>
<dd><p>This method processes the input <i class="arg">image</i> according to an algorithm
devised by Andrew M. Goth, according to the three parameters
<i class="arg">offset</i>, <i class="arg">adj1</i>, and <i class="arg">adjb</i>, and returns the modified
image as its result.</p>
<p>The operation supports only images of type <b class="const">rgba</b>, and returns
images of the same type.</p></dd>
<dt><a name="108"><b class="cmd">::crimp</b> <b class="method">flip horizontal</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="109"><b class="cmd">::crimp</b> <b class="method">flip transpose</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="110"><b class="cmd">::crimp</b> <b class="method">flip transverse</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="111"><b class="cmd">::crimp</b> <b class="method">flip vertical</b> <i class="arg">image</i></a></dt>
<dd><p>This set of methods performs mirroring along the horizontal, vertical
and diagonal axes of the input <i class="arg">image</i>, returning the mirrored
image as their output.  Transpose mirrors along the main diagonal,
transverse along the secondary diagonal.  These two methods also
exchange width and height of the image in the output.</p>
<p>The methods currently support the image types <b class="const">rgb</b>,
<b class="const">rgba</b>, <b class="const">hsv</b>, and <b class="const">grey8</b>.</p></dd>
<dt><a name="112"><b class="cmd">::crimp</b> <b class="method">resize</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">w</i> <i class="arg">h</i></a></dt>
<dd><p>This method takes the input <i class="arg">image</i> and resizes it to the
specified width <i class="arg">w</i> and height <i class="arg">h</i>.
In constrast to <b class="method">cut</b> this is not done by taking part of the
image in the specified size, but by scaling it up or down as
needed. In other words, this method is a degenerate case of a
projective transform as created by the <b class="method">transform</b> methods and
used by method <b class="method">warp projective</b> (see below).</p>
<p>Like the aforementioned general method this method supports all
the possible interpolation types, i.e. nearest neighbour, bilinear,
and bicubic. By default <b class="const">bilinear</b> interpolation is used, as a
compromise between accuracy and speed.</p></dd>
<dt><a name="113"><b class="cmd">::crimp</b> <b class="method">rotate cw</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="114"><b class="cmd">::crimp</b> <b class="method">rotate ccw</b> <i class="arg">image</i></a></dt>
<dd><p>This set of methods rotates the image in steps of 90 degrees, either
clockwise and counter to it.</p></dd>
<dt><a name="115"><b class="cmd">::crimp</b> <b class="method">rotate half</b> <i class="arg">image</i></a></dt>
<dd><p>This methods rotates the image a half-turn, i.e. 180 degrees.</p></dd>
<dt><a name="116"><b class="cmd">::crimp</b> <b class="method">warp field</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">xvec</i> <i class="arg">yvec</i></a></dt>
<dd><p>This method takes an input image and two images the size of the
expected result which provide for each pixel in the result the
coordinates to sample in the input to determine the result's color.</p>
<p>This allows the specification of any possible geometric
transformation and warping, going beyond even projective
transformations.</p>
<p>The two images providing the coordinate information have to be
of the same size, which is also the size of the returned result. The
type of the result is however specified through the type of the input
image.</p>
<p>The method supports all the possible interpolation types,
i.e. nearest neighbour, bilinear, and bicubic.
By default <b class="const">bilinear</b> interpolation is used, as a compromise
between accuracy and speed.</p></dd>
<dt><a name="117"><b class="cmd">::crimp</b> <b class="method">warp projective</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">transform</i></a></dt>
<dd><p>This method accepts a general projective <i class="arg">transform</i> as created by
the <b class="method">transform</b> methods, applies it to the input <i class="arg">image</i>
and returns the projected result.</p>
<p>Like the <b class="method">resize</b> method above this method supports all
the possible interpolation types, i.e. nearest neighbour, bilinear,
and bicubic. By default <b class="const">bilinear</b> interpolation is used, as a
compromise between accuracy and speed.</p>
<p><em>Note</em> that the returned result image is made as large as
necessary to contain the whole of the projected input. Depending on
the transformation this means that parts of the result can be black,
coming from outside of the boundaries of the input. Further, the
origin point of the result may conceptually be inside or outside of
the result instead of at the top left corner, because of pixels in the
input getting projected to negative coordinates. To handle this
situation the result will contain the physical coordinates of the
conceptual origin point in its meta data, under the hierarchical key
<b class="const">crimp origin</b>.</p></dd>
<dt><a name="118"><b class="cmd">::crimp</b> <b class="method">window</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image, applies a windowing function to it that
fades the pixels to black towards the edges, and returns the windowed
result.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Converters</a></h3>
<dl class="definitions">
<dt><a name="119"><b class="cmd">::crimp</b> <b class="method">convert 2grey32</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="120"><b class="cmd">::crimp</b> <b class="method">convert 2grey16</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="121"><b class="cmd">::crimp</b> <b class="method">convert 2grey8</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="122"><b class="cmd">::crimp</b> <b class="method">convert 2float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="123"><b class="cmd">::crimp</b> <b class="method">convert 2complex</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="124"><b class="cmd">::crimp</b> <b class="method">convert 2hsv</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="125"><b class="cmd">::crimp</b> <b class="method">convert 2rgba</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="126"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="127"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></dt>
<dd><p>This set of methods all convert their input <i class="arg">image</i> to the
specified type and returns it as their result. All converters accept
an image of the destination type as input and will pass it through
unchanged.</p>
<p>The converters returning a <b class="const">grey8</b> image support <b class="const">float</b>,
<b class="const">rgb</b> and <b class="const">rgba</b> as their input. For multi-channel input
they use the ITU-R 601-2 luma transform to merge the color channels.</p>







>
>
>
>
>
>
|





|



|







|


|





|









|









|









|









|

|

|

|






|












|

|

|










|






|

|

|

|







|











|

|


|

|














|

















|







|

|

|

|

|

|

|

|

|







1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
single-byte channels, i.e. all but <b class="const">grey16</b>, <b class="const">grey32</b>,
<b class="const">float</b>, and <b class="const">bw</b>.</p></dd>
<dt><a name="89"><b class="cmd">::crimp</b> <b class="method">matchsize</b> <i class="arg">image1</i> <i class="arg">image2</i></a></dt>
<dd><p>This method takes two images, forces them to be of the same size by
expanding the smaller dimensions with black pixels, and then returns a
list of the expanded images. The images in the result are in the same
order as as arguments.</p></dd>
<dt><a name="90"><b class="cmd">::crimp</b> <b class="method">matchgeo</b> <i class="arg">image</i> <i class="arg">bbox</i></a></dt>
<dd><p>This method takes an image and a bounding box (list of x, y, w, and h), 
and expands the image with black pixels to match the box. The result of
the expansion is returned.</p>
<p>An error is thrown if the image is not fully contained within
the bounding box.</p></dd>
<dt><a name="91"><b class="cmd">::crimp</b> <b class="method">scale</b> <i class="arg">image</i> <i class="arg">scale</i></a></dt>
<dd><p>This method performs a pixel-wise multiplication of the image with a
constant factor. It is currently supported by all <b class="const">greyN</b> image
types, plus the types <b class="const">float</b> and <b class="const">fpcomplex</b>. The first
accept an integer scaling factor, whereas the last two accept any
floating point number.</p></dd>
<dt><a name="92"><b class="cmd">::crimp</b> <b class="method">screen</b> <i class="arg">image1</i> <i class="arg">image2</i></a></dt>
<dd><p>This method combines the two input images by inverting the
multiplication of the inverted input images. I.e.</p>
<p><img alt="screen" src="../../image/screen.png"></p></dd>
<dt><a name="93"><b class="cmd">::crimp</b> <b class="method">solarize</b> <i class="arg">image</i> <i class="arg">threshold</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">solarize</b>
function with parameter <i class="arg">threshold</i>, and returns the modified
image as it result. This is also known as the <i class="term"><a href="../../index.html#key131">sabattier effect</a></i>.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map solarize</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="94"><b class="cmd">::crimp</b> <b class="method">square</b> <i class="arg">image</i></a></dt>
<dd><p>This is a convenience method equivalent to
&quot;<b class="cmd">crimp multiply</b> <i class="arg">image</i> <i class="arg">image</i>&quot;.</p></dd>
<dt><a name="95"><b class="cmd">::crimp</b> <b class="method">subtract</b> <i class="arg">image1</i> <i class="arg">image2</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></dt>
<dd><p>This method combines the two input images into a result image by
performing a pixelwise subtraction (image1 - image2) followed by
division through <i class="arg">scale</i> and addition of the <i class="arg">offset</i>. They
default to <b class="const">1</b> and <b class="const">0</b> respectively, if they are not
specified.</p></dd>
<dt><a name="96"><b class="cmd">::crimp</b> <b class="method">threshold global above</b> <i class="arg">image</i> <i class="arg">threshold</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold above</b>
function with parameter <i class="arg">threshold</i>, and returns the modified
image as it result. As the result only contains black and white,
i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i> or
foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold above</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="97"><b class="cmd">::crimp</b> <b class="method">threshold global below</b> <i class="arg">image</i> <i class="arg">threshold</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold below</b>
function with parameter <i class="arg">threshold</i>, and returns the modified
image as it result. As the result only contains black and white,
i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i>, or
foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold below</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="98"><b class="cmd">::crimp</b> <b class="method">threshold global inside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold inside</b>
function with parameters <i class="arg">min</i> and <i class="arg">max</i>, and returns the
modified image as it result. As the result only contains black and
white, i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i>
or foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold above</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="99"><b class="cmd">::crimp</b> <b class="method">threshold global outside</b> <i class="arg">image</i> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method takes an image, runs it through the <b class="function">threshold outside</b>
function with parameters <i class="arg">min</i> and <i class="arg">max</i>, and returns the
modified image as it result. As the result only contains black and
white, i.e. 2 colors, this process is also called <i class="term"><a href="../../index.html#key148">binarization</a></i>,
or foreground/background segmentation.
This is an application of method <b class="method">remap</b>, using the mapping
returned by &quot;<b class="method">map threshold below</b> <i class="arg">threshold</i>&quot;.
This method supports all image types supported by the method
<b class="method">remap</b>.</p></dd>
<dt><a name="100"><b class="cmd">::crimp</b> <b class="method">threshold global middle</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="101"><b class="cmd">::crimp</b> <b class="method">threshold global mean</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="102"><b class="cmd">::crimp</b> <b class="method">threshold global median</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="103"><b class="cmd">::crimp</b> <b class="method">threshold global otsu</b> <i class="arg">image</i></a></dt>
<dd><p>These four methods are convenience methods layered on top of
<b class="cmd">crimp threshold global below</b>. They compute the value(s) to
perform the thresholding with from the global statistics of the input
image, with the element taken named by the method. For reference see
the documentation of method <b class="cmd">crimp statistics ...</b>. Note that
they treat each color channel in the image separately.</p></dd>
<dt><a name="104"><b class="cmd">::crimp</b> <b class="method">threshold local</b> <i class="arg">image</i> <i class="arg">threshold</i>...</a></dt>
<dd><p>This method takes an <i class="arg">image</i> and one or more <i class="arg">threshold</i> maps
and returns an image where all pixels of the input which were larger
or equal to the corresponding pixel in the map are set to black. All
other pixels are set to white. Each map is applied to one color
channel of the input image. If there are too many maps the remainder
is ignored. If there are not enough maps the last map is replicated.</p>
<p>This is the core for all methods of non-global
<i class="term"><a href="../../index.html#key148">binarization</a></i>, i.e. foreground/background segmentation. Their
differences are just in the calculation of the maps.</p>
<p>This method supports all image types with one or more
single-byte channels, i.e. all but <b class="const">grey16</b>, <b class="const">grey32</b>, and
<b class="const">bw</b>.</p></dd>
<dt><a name="105"><b class="cmd">::crimp</b> <b class="method">upsample xy</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd></dd>
<dt><a name="106"><b class="cmd">::crimp</b> <b class="method">upsample x</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd></dd>
<dt><a name="107"><b class="cmd">::crimp</b> <b class="method">upsample y</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd><p>This method returns an image inserting <i class="arg">factor</i> black pixels between
each pixel of the input <i class="arg">image</i> (in x, y, or both dimensions). The effect is
that the input is expanded by <i class="arg">factor</i>. It is the complement of
method <b class="method">downsample</b>.</p>
<p>Using the method as is is not recommended because this simple upsampling
will cause copies of the image to appear at the higher image frequencies in the
expanded spectrum. This is normally avoided by running a low-pass filter over
the image after the upsampling, removing the problematic copies.</p>
<p>The <b class="method">interpolate</b> method is a convenience method combining these
two steps into one.</p></dd>
<dt><a name="108"><b class="cmd">::crimp</b> <b class="method">wavy</b> <i class="arg">image</i> <i class="arg">offset</i> <i class="arg">adj1</i> <i class="arg">adjb</i></a></dt>
<dd><p>This method processes the input <i class="arg">image</i> according to an algorithm
devised by Andrew M. Goth, according to the three parameters
<i class="arg">offset</i>, <i class="arg">adj1</i>, and <i class="arg">adjb</i>, and returns the modified
image as its result.</p>
<p>The operation supports only images of type <b class="const">rgba</b>, and returns
images of the same type.</p></dd>
<dt><a name="109"><b class="cmd">::crimp</b> <b class="method">flip horizontal</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="110"><b class="cmd">::crimp</b> <b class="method">flip transpose</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="111"><b class="cmd">::crimp</b> <b class="method">flip transverse</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="112"><b class="cmd">::crimp</b> <b class="method">flip vertical</b> <i class="arg">image</i></a></dt>
<dd><p>This set of methods performs mirroring along the horizontal, vertical
and diagonal axes of the input <i class="arg">image</i>, returning the mirrored
image as their output.  Transpose mirrors along the main diagonal,
transverse along the secondary diagonal.  These two methods also
exchange width and height of the image in the output.</p>
<p>The methods currently support the image types <b class="const">rgb</b>,
<b class="const">rgba</b>, <b class="const">hsv</b>, and <b class="const">grey8</b>.</p></dd>
<dt><a name="113"><b class="cmd">::crimp</b> <b class="method">resize</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">w</i> <i class="arg">h</i></a></dt>
<dd><p>This method takes the input <i class="arg">image</i> and resizes it to the
specified width <i class="arg">w</i> and height <i class="arg">h</i>.
In constrast to <b class="method">cut</b> this is not done by taking part of the
image in the specified size, but by scaling it up or down as
needed. In other words, this method is a degenerate case of a
projective transform as created by the <b class="method">transform</b> methods and
used by method <b class="method">warp projective</b> (see below).</p>
<p>Like the aforementioned general method this method supports all
the possible interpolation types, i.e. nearest neighbour, bilinear,
and bicubic. By default <b class="const">bilinear</b> interpolation is used, as a
compromise between accuracy and speed.</p></dd>
<dt><a name="114"><b class="cmd">::crimp</b> <b class="method">rotate cw</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="115"><b class="cmd">::crimp</b> <b class="method">rotate ccw</b> <i class="arg">image</i></a></dt>
<dd><p>This set of methods rotates the image in steps of 90 degrees, either
clockwise and counter to it.</p></dd>
<dt><a name="116"><b class="cmd">::crimp</b> <b class="method">rotate half</b> <i class="arg">image</i></a></dt>
<dd><p>This methods rotates the image a half-turn, i.e. 180 degrees.</p></dd>
<dt><a name="117"><b class="cmd">::crimp</b> <b class="method">warp field</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">xvec</i> <i class="arg">yvec</i></a></dt>
<dd><p>This method takes an input image and two images the size of the
expected result which provide for each pixel in the result the
coordinates to sample in the input to determine the result's color.</p>
<p>This allows the specification of any possible geometric
transformation and warping, going beyond even projective
transformations.</p>
<p>The two images providing the coordinate information have to be
of the same size, which is also the size of the returned result. The
type of the result is however specified through the type of the input
image.</p>
<p>The method supports all the possible interpolation types,
i.e. nearest neighbour, bilinear, and bicubic.
By default <b class="const">bilinear</b> interpolation is used, as a compromise
between accuracy and speed.</p></dd>
<dt><a name="118"><b class="cmd">::crimp</b> <b class="method">warp projective</b> <span class="opt">?<b class="option">-interpolate</b> <b class="const">nneighbour</b>|<b class="const">bilinear</b>|<b class="const">bicubic</b>?</span> <i class="arg">image</i> <i class="arg">transform</i></a></dt>
<dd><p>This method accepts a general projective <i class="arg">transform</i> as created by
the <b class="method">transform</b> methods, applies it to the input <i class="arg">image</i>
and returns the projected result.</p>
<p>Like the <b class="method">resize</b> method above this method supports all
the possible interpolation types, i.e. nearest neighbour, bilinear,
and bicubic. By default <b class="const">bilinear</b> interpolation is used, as a
compromise between accuracy and speed.</p>
<p><em>Note</em> that the returned result image is made as large as
necessary to contain the whole of the projected input. Depending on
the transformation this means that parts of the result can be black,
coming from outside of the boundaries of the input. Further, the
origin point of the result may conceptually be inside or outside of
the result instead of at the top left corner, because of pixels in the
input getting projected to negative coordinates. To handle this
situation the result will contain the physical coordinates of the
conceptual origin point in its meta data, under the hierarchical key
<b class="const">crimp origin</b>.</p></dd>
<dt><a name="119"><b class="cmd">::crimp</b> <b class="method">window</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image, applies a windowing function to it that
fades the pixels to black towards the edges, and returns the windowed
result.</p></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Converters</a></h3>
<dl class="definitions">
<dt><a name="120"><b class="cmd">::crimp</b> <b class="method">convert 2grey32</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="121"><b class="cmd">::crimp</b> <b class="method">convert 2grey16</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="122"><b class="cmd">::crimp</b> <b class="method">convert 2grey8</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="123"><b class="cmd">::crimp</b> <b class="method">convert 2float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="124"><b class="cmd">::crimp</b> <b class="method">convert 2complex</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="125"><b class="cmd">::crimp</b> <b class="method">convert 2hsv</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="126"><b class="cmd">::crimp</b> <b class="method">convert 2rgba</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="127"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="128"><b class="cmd">::crimp</b> <b class="method">convert 2rgb</b> <i class="arg">image</i></a></dt>
<dd><p>This set of methods all convert their input <i class="arg">image</i> to the
specified type and returns it as their result. All converters accept
an image of the destination type as input and will pass it through
unchanged.</p>
<p>The converters returning a <b class="const">grey8</b> image support <b class="const">float</b>,
<b class="const">rgb</b> and <b class="const">rgba</b> as their input. For multi-channel input
they use the ITU-R 601-2 luma transform to merge the color channels.</p>
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
<p>The conversion to <b class="const">rgb</b> accepts both <b class="const">rgba</b> and
<b class="const">hsv</b> images as input.</p>
<p>The conversion to <b class="const">float</b> supports only <b class="const">fpcomplex</b> as
input. It simply strips the imaginary part of the input.</p>
<p>The conversion to <b class="const">fpcomplex</b> accepts <b class="const">float</b>,
<b class="const">grey8</b>, <b class="const">grey16</b>, and <b class="const">grey32</b> as input, and adds a
constant <b class="const">0</b> imaginary part.</p></dd>
<dt><a name="128"><b class="cmd">::crimp</b> <b class="method">complex magnitude</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of type <b class="const">float</b> containing the pixel-wise
magnitude of the input.</p></dd>
<dt><a name="129"><b class="cmd">::crimp</b> <b class="method">complex 2complex</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">float</b> as input and returns
an image of type <b class="const">fpcomplex</b> with each pixel's real part
containing the input, and the imaginary part set to <b class="const">0</b>.</p>
<p>This method is an alias for <b class="cmd">crimp convert 2complex</b>.</p></dd>
<dt><a name="130"><b class="cmd">::crimp</b> <b class="method">complex imaginary</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of type <b class="const">float</b> containing the pixel-wise
<b class="const">imaginary</b> part of the input.</p></dd>
<dt><a name="131"><b class="cmd">::crimp</b> <b class="method">complex real</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of type <b class="const">float</b> containing the pixel-wise
<b class="const">real</b> part of the input.</p>
<p>This method is an alias for <b class="cmd">crimp convert 2float</b> as
applied to images of type <b class="const">fpcomplex</b>.</p></dd>
<dt><a name="132"><b class="cmd">::crimp</b> <b class="method">complex conjugate</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of the same type containing the pixel-wise complex
conjugate of the input.</p></dd>
<dt><a name="133"><b class="cmd">::crimp</b> <b class="method">join 2hsv</b> <i class="arg">hueImage</i> <i class="arg">satImage</i> <i class="arg">valImage</i></a></dt>
<dd></dd>
<dt><a name="134"><b class="cmd">::crimp</b> <b class="method">join 2rgba</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i> <i class="arg">alphaImage</i></a></dt>
<dd></dd>
<dt><a name="135"><b class="cmd">::crimp</b> <b class="method">join 2rgb</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i></a></dt>
<dd></dd>
<dt><a name="136"><b class="cmd">::crimp</b> <b class="method">join 2complex</b> <i class="arg">realImage</i> <i class="arg">imaginaryImage</i></a></dt>
<dd></dd>
<dt><a name="137"><b class="cmd">::crimp</b> <b class="method">join 2grey16</b> <i class="arg">msbImage</i> <i class="arg">lsbImage</i></a></dt>
<dd></dd>
<dt><a name="138"><b class="cmd">::crimp</b> <b class="method">join 2grey32</b> <i class="arg">mmsbImage</i> <i class="arg">lmsbImage</i> <i class="arg">mlsbImage</i> <i class="arg">llsbImage</i></a></dt>
<dd><p>This set of methods is the complement of method <b class="method">split</b>. Each
takes a set of <b class="const">grey8</b> images and fuses them together into an
image of the given type, with each input image becoming one channel of
the fusing result, which is returned as the result of the command. All
input images have to have the same dimensions.</p>
<p>The command <b class="method">join 2complex</b> is an exception regarding
the input. It accepts images of type <b class="const">float</b>, not <b class="const">grey8</b>.</p>
<p>The commands <b class="method">join 2grey*</b> are slightly different
too. As the result has only one color channel, what is to join ? Their
pixels are multi-byte, 2 and 4 respectively. The input images are not
color channel, but become the msb and lsb of the respective pixel in
the result.</p></dd>
<dt><a name="139"><b class="cmd">::crimp</b> <b class="method">split</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of one of the multi-channel types, i.e.
<b class="const">rgb</b>, <b class="const">rgba</b>, <b class="const">hsv</b>, and <b class="const">fpcomplex</b> and
returns a list of <b class="const">grey8</b> images, each of which contains the
contents of one of the channels found in the input image.</p>
<p>The input image type <b class="const">fpcomplex</b> is an exception
regarding the output. It returns images of type <b class="const">float</b>, not
<b class="const">grey8</b>.</p>
<p>The method is also able to take an image of one of the
single-channel multi-byte types, i.e.  <b class="const">grey16</b>, and
<b class="const">grey32</b> and returns a list of 2 (4) <b class="const">grey8</b> images, each
of which contains one of the bytes a pixel is made out of, in msb to
lsb order.</p>
<p>The channel images in the result are provided in the same order
as they are accepted by the complementary <b class="method">join</b> method, see
above.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">I/O commands</a></h3>
<dl class="definitions">
<dt><a name="140"><b class="cmd">::crimp</b> <b class="method">read pgm</b> <i class="arg">string</i></a></dt>
<dd><p>This method returns an image of type <b class="const">grey8</b> containing the data
of the portable grey map (PGM) stored in the <i class="arg">string</i>. The method
recognizes images in both plain and raw sub-formats.</p></dd>
<dt><a name="141"><b class="cmd">::crimp</b> <b class="method">read ppm</b> <i class="arg">string</i></a></dt>
<dd><p>This method returns an image of type <b class="const">rgb</b> containing the data
of the portable pix map (PPM) stored in the <i class="arg">string</i>. The method
recognizes images in both plain and raw sub-formats.</p></dd>
<dt><a name="142"><b class="cmd">::crimp</b> <b class="method">read strimj</b> <i class="arg">string</i> <span class="opt">?<i class="arg">colormap</i>?</span></a></dt>
<dd><p>This method returns an image of type <b class="const">rgba</b> containing the data
of the <i class="term">strimj</i> (string image) (See <a href="http://wiki.tcl.tk/1846">http://wiki.tcl.tk/1846</a>)
stored in the <i class="arg">string</i>.</p>
<p>The caller can override the standard mapping from pixel characters
to colors by specifying a <i class="arg">colormap</i>. This argument is interpreted as
dictionary mapping characters to triples of integers in the range
[0...255], specifying the red, green, and blue intensities.</p>







|



|




|



|





|



|

|

|

|

|

|












|



















|



|



|







1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
<p>The conversion to <b class="const">rgb</b> accepts both <b class="const">rgba</b> and
<b class="const">hsv</b> images as input.</p>
<p>The conversion to <b class="const">float</b> supports only <b class="const">fpcomplex</b> as
input. It simply strips the imaginary part of the input.</p>
<p>The conversion to <b class="const">fpcomplex</b> accepts <b class="const">float</b>,
<b class="const">grey8</b>, <b class="const">grey16</b>, and <b class="const">grey32</b> as input, and adds a
constant <b class="const">0</b> imaginary part.</p></dd>
<dt><a name="129"><b class="cmd">::crimp</b> <b class="method">complex magnitude</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of type <b class="const">float</b> containing the pixel-wise
magnitude of the input.</p></dd>
<dt><a name="130"><b class="cmd">::crimp</b> <b class="method">complex 2complex</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">float</b> as input and returns
an image of type <b class="const">fpcomplex</b> with each pixel's real part
containing the input, and the imaginary part set to <b class="const">0</b>.</p>
<p>This method is an alias for <b class="cmd">crimp convert 2complex</b>.</p></dd>
<dt><a name="131"><b class="cmd">::crimp</b> <b class="method">complex imaginary</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of type <b class="const">float</b> containing the pixel-wise
<b class="const">imaginary</b> part of the input.</p></dd>
<dt><a name="132"><b class="cmd">::crimp</b> <b class="method">complex real</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of type <b class="const">float</b> containing the pixel-wise
<b class="const">real</b> part of the input.</p>
<p>This method is an alias for <b class="cmd">crimp convert 2float</b> as
applied to images of type <b class="const">fpcomplex</b>.</p></dd>
<dt><a name="133"><b class="cmd">::crimp</b> <b class="method">complex conjugate</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of type <b class="const">fpcomplex</b> as input and
returns an image of the same type containing the pixel-wise complex
conjugate of the input.</p></dd>
<dt><a name="134"><b class="cmd">::crimp</b> <b class="method">join 2hsv</b> <i class="arg">hueImage</i> <i class="arg">satImage</i> <i class="arg">valImage</i></a></dt>
<dd></dd>
<dt><a name="135"><b class="cmd">::crimp</b> <b class="method">join 2rgba</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i> <i class="arg">alphaImage</i></a></dt>
<dd></dd>
<dt><a name="136"><b class="cmd">::crimp</b> <b class="method">join 2rgb</b> <i class="arg">redImage</i> <i class="arg">greenImage</i> <i class="arg">blueImage</i></a></dt>
<dd></dd>
<dt><a name="137"><b class="cmd">::crimp</b> <b class="method">join 2complex</b> <i class="arg">realImage</i> <i class="arg">imaginaryImage</i></a></dt>
<dd></dd>
<dt><a name="138"><b class="cmd">::crimp</b> <b class="method">join 2grey16</b> <i class="arg">msbImage</i> <i class="arg">lsbImage</i></a></dt>
<dd></dd>
<dt><a name="139"><b class="cmd">::crimp</b> <b class="method">join 2grey32</b> <i class="arg">mmsbImage</i> <i class="arg">lmsbImage</i> <i class="arg">mlsbImage</i> <i class="arg">llsbImage</i></a></dt>
<dd><p>This set of methods is the complement of method <b class="method">split</b>. Each
takes a set of <b class="const">grey8</b> images and fuses them together into an
image of the given type, with each input image becoming one channel of
the fusing result, which is returned as the result of the command. All
input images have to have the same dimensions.</p>
<p>The command <b class="method">join 2complex</b> is an exception regarding
the input. It accepts images of type <b class="const">float</b>, not <b class="const">grey8</b>.</p>
<p>The commands <b class="method">join 2grey*</b> are slightly different
too. As the result has only one color channel, what is to join ? Their
pixels are multi-byte, 2 and 4 respectively. The input images are not
color channel, but become the msb and lsb of the respective pixel in
the result.</p></dd>
<dt><a name="140"><b class="cmd">::crimp</b> <b class="method">split</b> <i class="arg">image</i></a></dt>
<dd><p>This method takes an image of one of the multi-channel types, i.e.
<b class="const">rgb</b>, <b class="const">rgba</b>, <b class="const">hsv</b>, and <b class="const">fpcomplex</b> and
returns a list of <b class="const">grey8</b> images, each of which contains the
contents of one of the channels found in the input image.</p>
<p>The input image type <b class="const">fpcomplex</b> is an exception
regarding the output. It returns images of type <b class="const">float</b>, not
<b class="const">grey8</b>.</p>
<p>The method is also able to take an image of one of the
single-channel multi-byte types, i.e.  <b class="const">grey16</b>, and
<b class="const">grey32</b> and returns a list of 2 (4) <b class="const">grey8</b> images, each
of which contains one of the bytes a pixel is made out of, in msb to
lsb order.</p>
<p>The channel images in the result are provided in the same order
as they are accepted by the complementary <b class="method">join</b> method, see
above.</p></dd>
</dl>
</div>
<div id="subsection4" class="subsection"><h3><a name="subsection4">I/O commands</a></h3>
<dl class="definitions">
<dt><a name="141"><b class="cmd">::crimp</b> <b class="method">read pgm</b> <i class="arg">string</i></a></dt>
<dd><p>This method returns an image of type <b class="const">grey8</b> containing the data
of the portable grey map (PGM) stored in the <i class="arg">string</i>. The method
recognizes images in both plain and raw sub-formats.</p></dd>
<dt><a name="142"><b class="cmd">::crimp</b> <b class="method">read ppm</b> <i class="arg">string</i></a></dt>
<dd><p>This method returns an image of type <b class="const">rgb</b> containing the data
of the portable pix map (PPM) stored in the <i class="arg">string</i>. The method
recognizes images in both plain and raw sub-formats.</p></dd>
<dt><a name="143"><b class="cmd">::crimp</b> <b class="method">read strimj</b> <i class="arg">string</i> <span class="opt">?<i class="arg">colormap</i>?</span></a></dt>
<dd><p>This method returns an image of type <b class="const">rgba</b> containing the data
of the <i class="term">strimj</i> (string image) (See <a href="http://wiki.tcl.tk/1846">http://wiki.tcl.tk/1846</a>)
stored in the <i class="arg">string</i>.</p>
<p>The caller can override the standard mapping from pixel characters
to colors by specifying a <i class="arg">colormap</i>. This argument is interpreted as
dictionary mapping characters to triples of integers in the range
[0...255], specifying the red, green, and blue intensities.</p>
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
@...@..@@@..@.@..@@@.
</pre>
</dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Support</a></h3>
<dl class="definitions">
<dt><a name="143"><b class="cmd">::crimp</b> <b class="method">gradient grey8</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd></dd>
<dt><a name="144"><b class="cmd">::crimp</b> <b class="method">gradient rgb</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd></dd>
<dt><a name="145"><b class="cmd">::crimp</b> <b class="method">gradient rgba</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd></dd>
<dt><a name="146"><b class="cmd">::crimp</b> <b class="method">gradient hsv</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd><p>This set of methods takes two &quot;color&quot; (pixel value) arguments and
returns an image of height 1 and width <i class="arg">size</i> containing a
gradient interpolating between these two colors, with <i class="arg">from</i> in
the pixel at the left (x == 0) and <i class="arg">to</i> at the right
(x == <i class="arg">size</i>-1).</p>
<p><i class="arg">size</i> has to be greater than or equal to <b class="const">2</b>. An
error is thrown if that restriction is not met.</p>
<p>The resulting image has the type indicated in the method name.
This also specifies what is expected as the contents of the arguments
<i class="arg">from</i> and <i class="arg">to</i>. For <b class="method">grey8</b> these are simple pixel
values in the range 0...255 whereas for the types <b class="method">rgb</b> and
<b class="method">hsv</b> the arguments are triples (3-element lists) specifying
the R, G, and B (and H, S, and V respectively) values.</p></dd>
<dt><a name="147"><b class="cmd">::crimp</b> <b class="method">register translation</b> <i class="arg">needle</i> <i class="arg">haystack</i></a></dt>
<dd><p>This method takes two images which are translated copies of each other
and returns a dictonary containing the two keys <b class="const">Xshift</b> and
<b class="const">Yshift</b>, which together specify the translation to apply to the
<i class="arg">needle</i> to place it in the <i class="arg">haystack</i>.</p></dd>
<dt><a name="148"><b class="cmd">::crimp</b> <b class="method">kernel make</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></dt>
<dd><p>This method takes a <i class="arg">matrix</i> of weights and an optional
<i class="arg">scale</i> factor and returns a structure containing the associated
convolution kernel, ready for use by method <b class="method">filter convolve</b>.</p>
<p>If <i class="arg">scale</i> is left unspecified it defaults to the sum of
all weights in the matrix.</p>
<p>If <i class="arg">offset</i> is left unspecified it defaults to 128 if the
sum of weights is 0, and 0 else. In effect zero-sum kernels, like the
basic edge-detectors, are shifted so that results in the range
-128..127 correspond to 0..255.</p>
<p>The <i class="arg">matrix</i> has the same general format as the pixel
matrix for method <b class="method">read tcl grey8</b>, i.e. a list of lists
(rows) of values, and is treated in the same way, i.e. the number of
columns is the maxium length over the row lists, and shorter lists are
padded with <b class="const">128</b>. The values are expected to be integer numbers
in the range -128..127.</p></dd>
<dt><a name="149"><b class="cmd">::crimp</b> <b class="method">kernel fpmake</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">offset</i>?</span></a></dt>
<dd><p>This method is like <b class="method">kernel make</b> except that the generated
kernel is based on floating-point values. Because of this it is not
accpeting a scale argument either, it is expected that the kernel
weights already have the proper sum.</p>
<p>The <i class="arg">matrix</i> has the same general format as the pixel
matrix for method <b class="method">read tcl float</b>, i.e. a list of lists
(rows) of values, and is treated in the same way, i.e. the number of
columns is the maxium length over the row lists, and shorter lists are
padded with <b class="const">255</b>.  The values are expected to be floating-point
numbers.</p></dd>
<dt><a name="150"><b class="cmd">::crimp</b> <b class="method">kernel transpose</b> <i class="arg">kernel</i></a></dt>
<dd><p>This method takes a <i class="arg">kernel</i> as returned by the method
<b class="method">kernel make</b> and returns a transposed kernel, i.e. one where
the x- and y-axes are switched.
For example</p>
<pre class="example">
                    (1)
                    (2)
    {1 2 4 2 1} ==&gt; (4)
                    (2)
                    (1)
</pre>
<p>This method is its own inverse, i.e. application to its result returns
the original input, i.e.</p>
<pre class="example">
    [transpose [transpose $K]] == $K
</pre>
</dd>
<dt><a name="151"><b class="cmd">::crimp</b> <b class="method">kernel image</b> <i class="arg">kernel</i></a></dt>
<dd><p>This method extracts and returns the internal image used to store
the <i class="arg">kernel</i>'s coefficients.</p></dd>
<dt><a name="152"><b class="cmd">::crimp</b> <b class="method">map</b> <i class="arg">arg</i>...</a></dt>
<dd><p>This method accepts the same sub-methods and arguments as are accepted
by the <b class="method">table</b> method below. In contrast to <b class="method">table</b> the
result is not a list of values, but a map image directly suitable as
argument to the <b class="method">remap</b> method.</p></dd>
<dt><a name="153"><b class="cmd">::crimp</b> <b class="method">mapof</b> <i class="arg">table</i></a></dt>
<dd><p>This method accepts a list of 256 values, constructs a map image
directly suitable as argument to the <b class="method">remap</b> method, and
returns this map image as its result.</p></dd>
<dt><a name="154"><b class="cmd">::crimp</b> <b class="method">table compose</b> <i class="arg">f</i> <i class="arg">g</i></a></dt>
<dd><p>This accepts two lookup tables (aka functions) specified as lists of
256 values, constructs the composite function f(g(x)), and then
returns this new function as its result.</p></dd>
<dt><a name="155"><b class="cmd">::crimp</b> <b class="method">table eval wrap</b> <i class="arg">cmd</i></a></dt>
<dd></dd>
<dt><a name="156"><b class="cmd">::crimp</b> <b class="method">table eval clamp</b> <i class="arg">cmd</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the function specified by the command prefix
<i class="arg">cmd</i>.
The results returned by the command prefix are rounded to the nearest
integer and then forced into the domain [0..255] by either
wrapping them around (modulo 256), or clamping them to the appropriate
border, i.e 0, and 255 respectively.</p>
<p>The signature of the command prefix is</p>
<dl class="definitions">
<dt><a name="157"><b class="cmd">&lt;cmd&gt;</b> <i class="arg">x</i></a></dt>
<dd><p>which is expected to return a number in the range
[0..255]. While the result should be an integer number it is
allowed to be a float, the caller takes care to round the result to
the nearest integer.</p></dd>
</dl></dd>
<dt><a name="158"><b class="cmd">::crimp</b> <b class="method">table degamma</b> <i class="arg">y</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">inverse gamma correction</b> with
parameter <i class="arg">y</i>.
This inverse correction, defined in the domain of [0..1] for
both argument and result, is defined as:</p>
<p><img alt="gamma_inv" src="../../image/gamma_inv.png"></p>
<p>Scaling of argument and result into the domain [0..255] of pixel
values, and rounding results to the nearest integer, causes the actual
definition used to be</p>
<p><img alt="scaled_gamma_inv" src="../../image/scaled_gamma_inv.png"></p></dd>
<dt><a name="159"><b class="cmd">::crimp</b> <b class="method">table gamma</b> <i class="arg">y</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">gamma correction</b> with parameter
<i class="arg">y</i>.
This correction, defined in the domain of [0..1] for both
argument and result, is defined as:</p>
<p><img alt="gamma" src="../../image/gamma.png"></p>
<p>Scaling of argument and result into the domain [0..255] of pixel
values, and rounding results to the nearest integer, causes the actual
definition used to be</p>
<p><img alt="scaled_gamma" src="../../image/scaled_gamma.png"></p></dd>
<dt><a name="160"><b class="cmd">::crimp</b> <b class="method">table gauss</b> <i class="arg">sigma</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">sampled gauss</b> function with
parameter <i class="arg">sigma</i>.
This function is defined as:</p>
<p><img alt="gauss" src="../../image/gauss.png"></p></dd>
<dt><a name="161"><b class="cmd">::crimp</b> <b class="method">table identity</b></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">identity</b> function, which is defined
as</p>
<p><img alt="identity" src="../../image/identity.png"></p></dd>
<dt><a name="162"><b class="cmd">::crimp</b> <b class="method">table invers</b></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">inverse</b> function, which is defined
as</p>
<p><img alt="inverse" src="../../image/inverse.png"></p></dd>
<dt><a name="163"><b class="cmd">::crimp</b> <b class="method">table linear wrap</b> <i class="arg">gain</i> <i class="arg">offset</i></a></dt>
<dd></dd>
<dt><a name="164"><b class="cmd">::crimp</b> <b class="method">table linear clamp</b> <i class="arg">gain</i> <i class="arg">offset</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a simple linear function with parameters
<i class="arg">gain</i> (the slope) and <i class="arg">offset</i>. The results are rounded to
the nearest integer and then forced into the domain [0..255] by
either wrapping them around (modulo 256), or clamping them to the
appropriate border, i.e 0, and 255 respectively.
Thus the relevant definitions are</p>
<p><img alt="linear_wrap" src="../../image/linear_wrap.png">
for the wrapped case, and</p>
<p><img alt="linear_clamp" src="../../image/linear_clamp.png">
when clamping.</p></dd>
<dt><a name="165"><b class="cmd">::crimp</b> <b class="method">table log</b> <span class="opt">?<i class="arg">max</i>?</span></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">log-compression</b> function with
parameter <i class="arg">max</i>. This parameter is the maximum pixel value the
function is for, this value, and all larger will be mapped to 255.
This function is defined as:</p>
<p><img alt="log" src="../../image/log.png"></p></dd>
<dt><a name="166"><b class="cmd">::crimp</b> <b class="method">table solarize</b> <i class="arg">threshold</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">solarize</b> function, with parameter
<i class="arg">threshold</i>. This function is defined as:</p>
<p><img alt="solarize" src="../../image/solarize.png"></p>
<p>Note how the function is the <b class="function">identity</b> for values under the
threshold, and the <b class="function">inverse</b> for values at and above it. Its
application to an image produces what is known as either
<i class="term"><a href="../../index.html#key137">solarization</a></i> or <i class="term"><a href="../../index.html#key131">sabattier effect</a></i>.</p></dd>
<dt><a name="167"><b class="cmd">::crimp</b> <b class="method">table sqrt</b> <span class="opt">?<i class="arg">max</i>?</span></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">sqrt-compression</b> function with
parameter <i class="arg">max</i>. This parameter is the maximum pixel value the
function is for, this value, and all larger will be mapped to 255.
This function is defined as:</p>
<p><img alt="sqrt" src="../../image/sqrt.png"></p></dd>
<dt><a name="168"><b class="cmd">::crimp</b> <b class="method">table stretch</b> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This is a convenience method around <b class="method">table linear</b> which maps
<i class="arg">min</i> to 0, and <i class="arg">max</i> to 255, with linear interpolation in
between. Values below <i class="arg">min</i> and above <i class="arg">max</i> are clamped to 0
and 255 respectively.</p></dd>
<dt><a name="169"><b class="cmd">::crimp</b> <b class="method">table threshold above</b> <i class="arg">threshold</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameter <i class="arg">threshold</i>. This function is defined as:</p>
<p><img alt="threshold-ge" src="../../image/threshold-ge.png"></p></dd>
<dt><a name="170"><b class="cmd">::crimp</b> <b class="method">table threshold below</b> <i class="arg">threshold</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameter <i class="arg">threshold</i>. This function is defined as:</p>
<p><img alt="threshold-le" src="../../image/threshold-le.png"></p></dd>
<dt><a name="171"><b class="cmd">::crimp</b> <b class="method">table threshold inside</b> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameters <i class="arg">min</i> and <i class="arg">max</i>. This function is
defined as:</p>
<p><img alt="threshold-inside" src="../../image/threshold-inside.png"></p></dd>
<dt><a name="172"><b class="cmd">::crimp</b> <b class="method">table threshold outside</b> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameters <i class="arg">min</i> and <i class="arg">max</i>. This function is
defined as:</p>
<p><img alt="threshold-outside" src="../../image/threshold-outside.png"></p></dd>
<dt><a name="173"><b class="cmd">::crimp</b> <b class="method">table fgauss discrete</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></dt>
<dd></dd>
<dt><a name="174"><b class="cmd">::crimp</b> <b class="method">table fgauss sampled</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></dt>
<dd><p>This method computes the table for a discrete or sampled gaussian with
parameters <i class="arg">sigma</i> and kernel <i class="arg">r</i>adius. If the radius is not
specified it defaults to the smallest integer greater than
&quot;3*<i class="arg">sigma</i>&quot;.</p></dd>
<dt><a name="175"><b class="cmd">::crimp</b> <b class="method">transform affine</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i></a></dt>
<dd><p>This method returns the affine transformation specified by the 2x3
matrix</p>
<pre class="example">
    |a b c|
    |d e f|
</pre>
<p>Note that it is in general easier to use the methods <b class="method">rotate</b>,
<b class="method">scale</b>, and <b class="method">translate</b> <b class="method">scale</b> to generate the
desired transformation piecemal and then use <b class="method">chain</b> to chain the
pieces together.</p></dd>
<dt><a name="176"><b class="cmd">::crimp</b> <b class="method">transform chain</b> <i class="arg">transform</i>...</a></dt>
<dd><p>This method computes and returns the projective transformation
generated by applying the specified transformations in reverse order,
i.e with the transformation at the end of the argument list applied
first, then the one before it, etc.</p></dd>
<dt><a name="177"><b class="cmd">::crimp</b> <b class="method">transform invert</b> <i class="arg">transform</i></a></dt>
<dd><p>This method computes and returns the inverse of the specified
projective <i class="arg">transform</i>ation.</p></dd>
<dt><a name="178"><b class="cmd">::crimp</b> <b class="method">transform projective</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i> <i class="arg">g</i> <i class="arg">h</i></a></dt>
<dd><p>This method returns the projective transformation specified by the 3x3
matrix</p>
<pre class="example">
    |a b c|
    |d e f|
    |g h 1|
</pre>
<p>Note that for the affine subset of projective transformation it is in
general easier to use the methods <b class="method">rotate</b>, <b class="method">scale</b>, and
<b class="method">translate</b> <b class="method">scale</b> to generate the desired
transformation piecemal and then use <b class="method">chain</b> to chain the pieces
together.</p>
<p>And for a true perspective transformation specification through
<b class="method">quadrilateral</b> should be simpler as well.</p></dd>
<dt><a name="179"><b class="cmd">::crimp</b> <b class="method">transform quadrilateral</b> <i class="arg">src</i> <i class="arg">dst</i></a></dt>
<dd><p>This method returns the projective transformation which maps the
quadrilateral <i class="arg">src</i> on to the quadrilateral <i class="arg">dst</i>.</p>
<p>Each quadrilateral is specified as a list of 4 points, each
point a pair of x- and y-coordinates.</p></dd>
<dt><a name="180"><b class="cmd">::crimp</b> <b class="method">transform rotate</b> <i class="arg">theta</i> <span class="opt">?<i class="arg">center</i>?</span></a></dt>
<dd><p>This methods returns the projective transformation which rotates the
image by the anglie <i class="arg">theta</i> around the point <i class="arg">center</i>. If the
latter is not specified {0 0} is assumed. The point, if present, is
specified as pair of x- and y-coordinates.</p>
<p>The angle is specified in degrees, with <b class="const">0</b> not rotating
the image at all. Positive values cause a counterclockwise rotation,
negative values a clockwise one.</p></dd>
<dt><a name="181"><b class="cmd">::crimp</b> <b class="method">transform scale</b> <i class="arg">sx</i> <i class="arg">sy</i></a></dt>
<dd><p>This methods returns the projective transformation which scales an
image by factor <i class="arg">sx</i> in width, and <i class="arg">sy</i> in height. Values
larger than <b class="const">1</b> expand the image along the specified dimension,
while values less than <b class="const">1</b> shrink it. Negative values flip the
respective axis.</p></dd>
<dt><a name="182"><b class="cmd">::crimp</b> <b class="method">transform translate</b> <i class="arg">dx</i> <i class="arg">dy</i></a></dt>
<dd><p>This methods returns the projective transformation which translates an
image by <i class="arg">dx</i> pixels along the x-axis, and <i class="arg">dx</i> pixels along
the y-axis. Values larger than <b class="const">0</b> move the image to the right,
or down, along the specified dimension, while values less than
<b class="const">0</b> move it to the left, or up.</p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Miscellanea</a></h3>
<p>The package contains a number of primitives which are either not
really useful to a regular user, or have not gotten a nice interface
yet, possibly because it is not clear how that interface should look
like.</p>
<p>These primitives are collected here, so that they are not
forgotten, i.e. as a reminder to either make them properly available,
document as internal/undocumented/etc, or remove them.</p>
<dl class="definitions">
<dt><a name="183"><b class="cmd">::crimp::black_white_vertical</b></a></dt>
<dd><p>Generates a fixed checker board image. The output is 256x256
<b class="const">grey8</b> image, with 16x16 blocks. Debug use only, so far.</p></dd>
<dt><a name="184"><b class="cmd">::crimp::bilateral_*</b> <i class="arg">image</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></dt>
<dd></dd>
<dt><a name="185"><b class="cmd">::crimp::joint_bilateral_*</b> <i class="arg">image</i> <i class="arg">wimage</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></dt>
<dd><p>Regular and cross bilateral filters. Still looking buggy, possibly bad
memory accesses.</p></dd>
<dt><a name="186"><b class="cmd">::crimp::color_combine</b> <i class="arg">image</i> <i class="arg">vector</i></a></dt>
<dd><p>This operation combines the channels of the input into a single
<b class="const">grey8</b> value, the result of performing a scalar product of each
pixel with the 3x1 <i class="arg">vector</i> (<b class="const">float</b> image).</p></dd>
<dt><a name="187"><b class="cmd">::crimp::color_mix</b> <i class="arg">image</i> <i class="arg">matrix</i></a></dt>
<dd><p>This operation mixes the color channels of the input, the result of
performing a matrix multiplication of each pixel with the 3x3
<i class="arg">matrix</i> (<b class="const">float</b> image).</p></dd>
<dt><a name="188"><b class="cmd">::crimp::connected_components</b> <i class="arg">image</i> <i class="arg">8connected</i></a></dt>
<dd></dd>
<dt><a name="189"><b class="cmd">::crimp::connected_components_*</b> <i class="arg">image</i> <i class="arg">8connected</i> <i class="arg">bgValue</i></a></dt>
<dd><p>Computing (labeling) the connected components of the input image,
using either 4- or 8-neighbourhood. The primitives accepting a
background value use it to distinguish foreground and background and
coalesce the latter into a single component, even if its area is
disconnected.</p>
<p>The result is always of type <b class="const">grey32</b>, to have enough
range for the label counters.</p></dd>
<dt><a name="190"><b class="cmd">::crimp::euclidean_distance_map_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="191"><b class="cmd">::crimp::indicator_grey8_float</b> <i class="arg">image</i></a></dt>
<dd><p>These two operations together allow the creation of distance maps from
images, i.e.  watershed diagrams. Currently only used in a
demonstration for this.</p></dd>
<dt><a name="192"><b class="cmd">::crimp::hough_grey8</b> <i class="arg">image</i> <i class="arg">emptybucketcolor</i></a></dt>
<dd><p>Hough transformation of an image. Currently only used in a
demonstration so far.</p></dd>
<dt><a name="193"><b class="cmd">::crimp::gaussian_01_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="194"><b class="cmd">::crimp::gaussian_10_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="195"><b class="cmd">::crimp::gaussian_blur_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="196"><b class="cmd">::crimp::gaussian_laplacian_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="197"><b class="cmd">::crimp::gaussian_gradient_mag_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></dt>
<dd><p>Fast gaussian filters and derivatives, applied in X and Y directions,
i.e. rows and coluimns of the input image. The <i class="arg">derivative</i> is either</p>
<dl class="definitions">
<dt><b class="const">0</b></dt>
<dd><p>Gaussian</p></dd>
<dt><b class="const">1</b></dt>
<dd><p>Gradient</p></dd>







|

|

|

|













|




|















|










|

















|


|




|



|



|

|









|





|










|










|





|




|




|

|











|






|








|






|




|




|




|





|





|

|




|










|




|


|














|




|







|





|
















|


|

|


|



|



|

|







|

|



|


|

|

|

|

|







1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
@...@..@@@..@.@..@@@.
</pre>
</dd>
</dl>
</div>
<div id="subsection5" class="subsection"><h3><a name="subsection5">Support</a></h3>
<dl class="definitions">
<dt><a name="144"><b class="cmd">::crimp</b> <b class="method">gradient grey8</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd></dd>
<dt><a name="145"><b class="cmd">::crimp</b> <b class="method">gradient rgb</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd></dd>
<dt><a name="146"><b class="cmd">::crimp</b> <b class="method">gradient rgba</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd></dd>
<dt><a name="147"><b class="cmd">::crimp</b> <b class="method">gradient hsv</b> <i class="arg">from</i> <i class="arg">to</i> <i class="arg">size</i></a></dt>
<dd><p>This set of methods takes two &quot;color&quot; (pixel value) arguments and
returns an image of height 1 and width <i class="arg">size</i> containing a
gradient interpolating between these two colors, with <i class="arg">from</i> in
the pixel at the left (x == 0) and <i class="arg">to</i> at the right
(x == <i class="arg">size</i>-1).</p>
<p><i class="arg">size</i> has to be greater than or equal to <b class="const">2</b>. An
error is thrown if that restriction is not met.</p>
<p>The resulting image has the type indicated in the method name.
This also specifies what is expected as the contents of the arguments
<i class="arg">from</i> and <i class="arg">to</i>. For <b class="method">grey8</b> these are simple pixel
values in the range 0...255 whereas for the types <b class="method">rgb</b> and
<b class="method">hsv</b> the arguments are triples (3-element lists) specifying
the R, G, and B (and H, S, and V respectively) values.</p></dd>
<dt><a name="148"><b class="cmd">::crimp</b> <b class="method">register translation</b> <i class="arg">needle</i> <i class="arg">haystack</i></a></dt>
<dd><p>This method takes two images which are translated copies of each other
and returns a dictonary containing the two keys <b class="const">Xshift</b> and
<b class="const">Yshift</b>, which together specify the translation to apply to the
<i class="arg">needle</i> to place it in the <i class="arg">haystack</i>.</p></dd>
<dt><a name="149"><b class="cmd">::crimp</b> <b class="method">kernel make</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">scale</i>?</span> <span class="opt">?<i class="arg">offset</i>?</span></a></dt>
<dd><p>This method takes a <i class="arg">matrix</i> of weights and an optional
<i class="arg">scale</i> factor and returns a structure containing the associated
convolution kernel, ready for use by method <b class="method">filter convolve</b>.</p>
<p>If <i class="arg">scale</i> is left unspecified it defaults to the sum of
all weights in the matrix.</p>
<p>If <i class="arg">offset</i> is left unspecified it defaults to 128 if the
sum of weights is 0, and 0 else. In effect zero-sum kernels, like the
basic edge-detectors, are shifted so that results in the range
-128..127 correspond to 0..255.</p>
<p>The <i class="arg">matrix</i> has the same general format as the pixel
matrix for method <b class="method">read tcl grey8</b>, i.e. a list of lists
(rows) of values, and is treated in the same way, i.e. the number of
columns is the maxium length over the row lists, and shorter lists are
padded with <b class="const">128</b>. The values are expected to be integer numbers
in the range -128..127.</p></dd>
<dt><a name="150"><b class="cmd">::crimp</b> <b class="method">kernel fpmake</b> <i class="arg">matrix</i> <span class="opt">?<i class="arg">offset</i>?</span></a></dt>
<dd><p>This method is like <b class="method">kernel make</b> except that the generated
kernel is based on floating-point values. Because of this it is not
accpeting a scale argument either, it is expected that the kernel
weights already have the proper sum.</p>
<p>The <i class="arg">matrix</i> has the same general format as the pixel
matrix for method <b class="method">read tcl float</b>, i.e. a list of lists
(rows) of values, and is treated in the same way, i.e. the number of
columns is the maxium length over the row lists, and shorter lists are
padded with <b class="const">255</b>.  The values are expected to be floating-point
numbers.</p></dd>
<dt><a name="151"><b class="cmd">::crimp</b> <b class="method">kernel transpose</b> <i class="arg">kernel</i></a></dt>
<dd><p>This method takes a <i class="arg">kernel</i> as returned by the method
<b class="method">kernel make</b> and returns a transposed kernel, i.e. one where
the x- and y-axes are switched.
For example</p>
<pre class="example">
                    (1)
                    (2)
    {1 2 4 2 1} ==&gt; (4)
                    (2)
                    (1)
</pre>
<p>This method is its own inverse, i.e. application to its result returns
the original input, i.e.</p>
<pre class="example">
    [transpose [transpose $K]] == $K
</pre>
</dd>
<dt><a name="152"><b class="cmd">::crimp</b> <b class="method">kernel image</b> <i class="arg">kernel</i></a></dt>
<dd><p>This method extracts and returns the internal image used to store
the <i class="arg">kernel</i>'s coefficients.</p></dd>
<dt><a name="153"><b class="cmd">::crimp</b> <b class="method">map</b> <i class="arg">arg</i>...</a></dt>
<dd><p>This method accepts the same sub-methods and arguments as are accepted
by the <b class="method">table</b> method below. In contrast to <b class="method">table</b> the
result is not a list of values, but a map image directly suitable as
argument to the <b class="method">remap</b> method.</p></dd>
<dt><a name="154"><b class="cmd">::crimp</b> <b class="method">mapof</b> <i class="arg">table</i></a></dt>
<dd><p>This method accepts a list of 256 values, constructs a map image
directly suitable as argument to the <b class="method">remap</b> method, and
returns this map image as its result.</p></dd>
<dt><a name="155"><b class="cmd">::crimp</b> <b class="method">table compose</b> <i class="arg">f</i> <i class="arg">g</i></a></dt>
<dd><p>This accepts two lookup tables (aka functions) specified as lists of
256 values, constructs the composite function f(g(x)), and then
returns this new function as its result.</p></dd>
<dt><a name="156"><b class="cmd">::crimp</b> <b class="method">table eval wrap</b> <i class="arg">cmd</i></a></dt>
<dd></dd>
<dt><a name="157"><b class="cmd">::crimp</b> <b class="method">table eval clamp</b> <i class="arg">cmd</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the function specified by the command prefix
<i class="arg">cmd</i>.
The results returned by the command prefix are rounded to the nearest
integer and then forced into the domain [0..255] by either
wrapping them around (modulo 256), or clamping them to the appropriate
border, i.e 0, and 255 respectively.</p>
<p>The signature of the command prefix is</p>
<dl class="definitions">
<dt><a name="158"><b class="cmd">&lt;cmd&gt;</b> <i class="arg">x</i></a></dt>
<dd><p>which is expected to return a number in the range
[0..255]. While the result should be an integer number it is
allowed to be a float, the caller takes care to round the result to
the nearest integer.</p></dd>
</dl></dd>
<dt><a name="159"><b class="cmd">::crimp</b> <b class="method">table degamma</b> <i class="arg">y</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">inverse gamma correction</b> with
parameter <i class="arg">y</i>.
This inverse correction, defined in the domain of [0..1] for
both argument and result, is defined as:</p>
<p><img alt="gamma_inv" src="../../image/gamma_inv.png"></p>
<p>Scaling of argument and result into the domain [0..255] of pixel
values, and rounding results to the nearest integer, causes the actual
definition used to be</p>
<p><img alt="scaled_gamma_inv" src="../../image/scaled_gamma_inv.png"></p></dd>
<dt><a name="160"><b class="cmd">::crimp</b> <b class="method">table gamma</b> <i class="arg">y</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">gamma correction</b> with parameter
<i class="arg">y</i>.
This correction, defined in the domain of [0..1] for both
argument and result, is defined as:</p>
<p><img alt="gamma" src="../../image/gamma.png"></p>
<p>Scaling of argument and result into the domain [0..255] of pixel
values, and rounding results to the nearest integer, causes the actual
definition used to be</p>
<p><img alt="scaled_gamma" src="../../image/scaled_gamma.png"></p></dd>
<dt><a name="161"><b class="cmd">::crimp</b> <b class="method">table gauss</b> <i class="arg">sigma</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">sampled gauss</b> function with
parameter <i class="arg">sigma</i>.
This function is defined as:</p>
<p><img alt="gauss" src="../../image/gauss.png"></p></dd>
<dt><a name="162"><b class="cmd">::crimp</b> <b class="method">table identity</b></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">identity</b> function, which is defined
as</p>
<p><img alt="identity" src="../../image/identity.png"></p></dd>
<dt><a name="163"><b class="cmd">::crimp</b> <b class="method">table invers</b></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">inverse</b> function, which is defined
as</p>
<p><img alt="inverse" src="../../image/inverse.png"></p></dd>
<dt><a name="164"><b class="cmd">::crimp</b> <b class="method">table linear wrap</b> <i class="arg">gain</i> <i class="arg">offset</i></a></dt>
<dd></dd>
<dt><a name="165"><b class="cmd">::crimp</b> <b class="method">table linear clamp</b> <i class="arg">gain</i> <i class="arg">offset</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a simple linear function with parameters
<i class="arg">gain</i> (the slope) and <i class="arg">offset</i>. The results are rounded to
the nearest integer and then forced into the domain [0..255] by
either wrapping them around (modulo 256), or clamping them to the
appropriate border, i.e 0, and 255 respectively.
Thus the relevant definitions are</p>
<p><img alt="linear_wrap" src="../../image/linear_wrap.png">
for the wrapped case, and</p>
<p><img alt="linear_clamp" src="../../image/linear_clamp.png">
when clamping.</p></dd>
<dt><a name="166"><b class="cmd">::crimp</b> <b class="method">table log</b> <span class="opt">?<i class="arg">max</i>?</span></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">log-compression</b> function with
parameter <i class="arg">max</i>. This parameter is the maximum pixel value the
function is for, this value, and all larger will be mapped to 255.
This function is defined as:</p>
<p><img alt="log" src="../../image/log.png"></p></dd>
<dt><a name="167"><b class="cmd">::crimp</b> <b class="method">table solarize</b> <i class="arg">threshold</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">solarize</b> function, with parameter
<i class="arg">threshold</i>. This function is defined as:</p>
<p><img alt="solarize" src="../../image/solarize.png"></p>
<p>Note how the function is the <b class="function">identity</b> for values under the
threshold, and the <b class="function">inverse</b> for values at and above it. Its
application to an image produces what is known as either
<i class="term"><a href="../../index.html#key137">solarization</a></i> or <i class="term"><a href="../../index.html#key131">sabattier effect</a></i>.</p></dd>
<dt><a name="168"><b class="cmd">::crimp</b> <b class="method">table sqrt</b> <span class="opt">?<i class="arg">max</i>?</span></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through the <b class="function">sqrt-compression</b> function with
parameter <i class="arg">max</i>. This parameter is the maximum pixel value the
function is for, this value, and all larger will be mapped to 255.
This function is defined as:</p>
<p><img alt="sqrt" src="../../image/sqrt.png"></p></dd>
<dt><a name="169"><b class="cmd">::crimp</b> <b class="method">table stretch</b> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This is a convenience method around <b class="method">table linear</b> which maps
<i class="arg">min</i> to 0, and <i class="arg">max</i> to 255, with linear interpolation in
between. Values below <i class="arg">min</i> and above <i class="arg">max</i> are clamped to 0
and 255 respectively.</p></dd>
<dt><a name="170"><b class="cmd">::crimp</b> <b class="method">table threshold above</b> <i class="arg">threshold</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameter <i class="arg">threshold</i>. This function is defined as:</p>
<p><img alt="threshold-ge" src="../../image/threshold-ge.png"></p></dd>
<dt><a name="171"><b class="cmd">::crimp</b> <b class="method">table threshold below</b> <i class="arg">threshold</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameter <i class="arg">threshold</i>. This function is defined as:</p>
<p><img alt="threshold-le" src="../../image/threshold-le.png"></p></dd>
<dt><a name="172"><b class="cmd">::crimp</b> <b class="method">table threshold inside</b> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameters <i class="arg">min</i> and <i class="arg">max</i>. This function is
defined as:</p>
<p><img alt="threshold-inside" src="../../image/threshold-inside.png"></p></dd>
<dt><a name="173"><b class="cmd">::crimp</b> <b class="method">table threshold outside</b> <i class="arg">min</i> <i class="arg">max</i></a></dt>
<dd><p>This method returns a list of 256 values, the result of running the
values 0 to 255 through a <b class="function">thresholding</b> (or <i class="term"><a href="../../index.html#key148">binarization</a></i>)
function, with parameters <i class="arg">min</i> and <i class="arg">max</i>. This function is
defined as:</p>
<p><img alt="threshold-outside" src="../../image/threshold-outside.png"></p></dd>
<dt><a name="174"><b class="cmd">::crimp</b> <b class="method">table fgauss discrete</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></dt>
<dd></dd>
<dt><a name="175"><b class="cmd">::crimp</b> <b class="method">table fgauss sampled</b> <i class="arg">sigma</i> <span class="opt">?<i class="arg">r</i>?</span></a></dt>
<dd><p>This method computes the table for a discrete or sampled gaussian with
parameters <i class="arg">sigma</i> and kernel <i class="arg">r</i>adius. If the radius is not
specified it defaults to the smallest integer greater than
&quot;3*<i class="arg">sigma</i>&quot;.</p></dd>
<dt><a name="176"><b class="cmd">::crimp</b> <b class="method">transform affine</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i></a></dt>
<dd><p>This method returns the affine transformation specified by the 2x3
matrix</p>
<pre class="example">
    |a b c|
    |d e f|
</pre>
<p>Note that it is in general easier to use the methods <b class="method">rotate</b>,
<b class="method">scale</b>, and <b class="method">translate</b> <b class="method">scale</b> to generate the
desired transformation piecemal and then use <b class="method">chain</b> to chain the
pieces together.</p></dd>
<dt><a name="177"><b class="cmd">::crimp</b> <b class="method">transform chain</b> <i class="arg">transform</i>...</a></dt>
<dd><p>This method computes and returns the projective transformation
generated by applying the specified transformations in reverse order,
i.e with the transformation at the end of the argument list applied
first, then the one before it, etc.</p></dd>
<dt><a name="178"><b class="cmd">::crimp</b> <b class="method">transform invert</b> <i class="arg">transform</i></a></dt>
<dd><p>This method computes and returns the inverse of the specified
projective <i class="arg">transform</i>ation.</p></dd>
<dt><a name="179"><b class="cmd">::crimp</b> <b class="method">transform projective</b> <i class="arg">a</i> <i class="arg">b</i> <i class="arg">c</i> <i class="arg">d</i> <i class="arg">e</i> <i class="arg">f</i> <i class="arg">g</i> <i class="arg">h</i></a></dt>
<dd><p>This method returns the projective transformation specified by the 3x3
matrix</p>
<pre class="example">
    |a b c|
    |d e f|
    |g h 1|
</pre>
<p>Note that for the affine subset of projective transformation it is in
general easier to use the methods <b class="method">rotate</b>, <b class="method">scale</b>, and
<b class="method">translate</b> <b class="method">scale</b> to generate the desired
transformation piecemal and then use <b class="method">chain</b> to chain the pieces
together.</p>
<p>And for a true perspective transformation specification through
<b class="method">quadrilateral</b> should be simpler as well.</p></dd>
<dt><a name="180"><b class="cmd">::crimp</b> <b class="method">transform quadrilateral</b> <i class="arg">src</i> <i class="arg">dst</i></a></dt>
<dd><p>This method returns the projective transformation which maps the
quadrilateral <i class="arg">src</i> on to the quadrilateral <i class="arg">dst</i>.</p>
<p>Each quadrilateral is specified as a list of 4 points, each
point a pair of x- and y-coordinates.</p></dd>
<dt><a name="181"><b class="cmd">::crimp</b> <b class="method">transform rotate</b> <i class="arg">theta</i> <span class="opt">?<i class="arg">center</i>?</span></a></dt>
<dd><p>This methods returns the projective transformation which rotates the
image by the anglie <i class="arg">theta</i> around the point <i class="arg">center</i>. If the
latter is not specified {0 0} is assumed. The point, if present, is
specified as pair of x- and y-coordinates.</p>
<p>The angle is specified in degrees, with <b class="const">0</b> not rotating
the image at all. Positive values cause a counterclockwise rotation,
negative values a clockwise one.</p></dd>
<dt><a name="182"><b class="cmd">::crimp</b> <b class="method">transform scale</b> <i class="arg">sx</i> <i class="arg">sy</i></a></dt>
<dd><p>This methods returns the projective transformation which scales an
image by factor <i class="arg">sx</i> in width, and <i class="arg">sy</i> in height. Values
larger than <b class="const">1</b> expand the image along the specified dimension,
while values less than <b class="const">1</b> shrink it. Negative values flip the
respective axis.</p></dd>
<dt><a name="183"><b class="cmd">::crimp</b> <b class="method">transform translate</b> <i class="arg">dx</i> <i class="arg">dy</i></a></dt>
<dd><p>This methods returns the projective transformation which translates an
image by <i class="arg">dx</i> pixels along the x-axis, and <i class="arg">dx</i> pixels along
the y-axis. Values larger than <b class="const">0</b> move the image to the right,
or down, along the specified dimension, while values less than
<b class="const">0</b> move it to the left, or up.</p></dd>
</dl>
</div>
<div id="subsection6" class="subsection"><h3><a name="subsection6">Miscellanea</a></h3>
<p>The package contains a number of primitives which are either not
really useful to a regular user, or have not gotten a nice interface
yet, possibly because it is not clear how that interface should look
like.</p>
<p>These primitives are collected here, so that they are not
forgotten, i.e. as a reminder to either make them properly available,
document as internal/undocumented/etc, or remove them.</p>
<dl class="definitions">
<dt><a name="184"><b class="cmd">::crimp::black_white_vertical</b></a></dt>
<dd><p>Generates a fixed checker board image. The output is 256x256
<b class="const">grey8</b> image, with 16x16 blocks. Debug use only, so far.</p></dd>
<dt><a name="185"><b class="cmd">::crimp::bilateral_*</b> <i class="arg">image</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></dt>
<dd></dd>
<dt><a name="186"><b class="cmd">::crimp::joint_bilateral_*</b> <i class="arg">image</i> <i class="arg">wimage</i> <i class="arg">sigma-space</i> <i class="arg">sigma-range</i></a></dt>
<dd><p>Regular and cross bilateral filters. Still looking buggy, possibly bad
memory accesses.</p></dd>
<dt><a name="187"><b class="cmd">::crimp::color_combine</b> <i class="arg">image</i> <i class="arg">vector</i></a></dt>
<dd><p>This operation combines the channels of the input into a single
<b class="const">grey8</b> value, the result of performing a scalar product of each
pixel with the 3x1 <i class="arg">vector</i> (<b class="const">float</b> image).</p></dd>
<dt><a name="188"><b class="cmd">::crimp::color_mix</b> <i class="arg">image</i> <i class="arg">matrix</i></a></dt>
<dd><p>This operation mixes the color channels of the input, the result of
performing a matrix multiplication of each pixel with the 3x3
<i class="arg">matrix</i> (<b class="const">float</b> image).</p></dd>
<dt><a name="189"><b class="cmd">::crimp::connected_components</b> <i class="arg">image</i> <i class="arg">8connected</i></a></dt>
<dd></dd>
<dt><a name="190"><b class="cmd">::crimp::connected_components_*</b> <i class="arg">image</i> <i class="arg">8connected</i> <i class="arg">bgValue</i></a></dt>
<dd><p>Computing (labeling) the connected components of the input image,
using either 4- or 8-neighbourhood. The primitives accepting a
background value use it to distinguish foreground and background and
coalesce the latter into a single component, even if its area is
disconnected.</p>
<p>The result is always of type <b class="const">grey32</b>, to have enough
range for the label counters.</p></dd>
<dt><a name="191"><b class="cmd">::crimp::euclidean_distance_map_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="192"><b class="cmd">::crimp::indicator_grey8_float</b> <i class="arg">image</i></a></dt>
<dd><p>These two operations together allow the creation of distance maps from
images, i.e.  watershed diagrams. Currently only used in a
demonstration for this.</p></dd>
<dt><a name="193"><b class="cmd">::crimp::hough_grey8</b> <i class="arg">image</i> <i class="arg">emptybucketcolor</i></a></dt>
<dd><p>Hough transformation of an image. Currently only used in a
demonstration so far.</p></dd>
<dt><a name="194"><b class="cmd">::crimp::gaussian_01_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="195"><b class="cmd">::crimp::gaussian_10_float</b> <i class="arg">image</i> <i class="arg">derivative</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="196"><b class="cmd">::crimp::gaussian_blur_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="197"><b class="cmd">::crimp::gaussian_laplacian_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></dt>
<dd></dd>
<dt><a name="198"><b class="cmd">::crimp::gaussian_gradient_mag_float</b> <i class="arg">image</i> <i class="arg">sigma</i></a></dt>
<dd><p>Fast gaussian filters and derivatives, applied in X and Y directions,
i.e. rows and coluimns of the input image. The <i class="arg">derivative</i> is either</p>
<dl class="definitions">
<dt><b class="const">0</b></dt>
<dd><p>Gaussian</p></dd>
<dt><b class="const">1</b></dt>
<dd><p>Gradient</p></dd>
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
gradient. It is computed by applying a gradient of gaussian to X and Y
directions, and computing the length of the resulting 2-vector
(euclidean norm), i.e.</p>
<pre class="example">
    hypot (gauss10 (grad10 (image)), gauss10 (grad01 (image)))
</pre>
</dd>
<dt><a name="198"><b class="cmd">::crimp::map_2*_*</b> <i class="arg">image</i> <i class="arg">map</i></a></dt>
<dd><p>Operators applying a piecewise linear <i class="arg">map</i> to the input image.
The map is stored in a Tcl list containing 2 elements, each a
bytearray.  The first stores the abscissaes delineating the intervals,
the second the ordinates at these interval borders. The format of the
binary data depends on the types of input and output values (byte,
int, float, ...).</p>
<p>For conversion a pixel value is searched for in the intervals
of abscissae. With both the interval and the fraction inside of it
known the output is then linearly interpolated from the associated
ordinates. The search is a binary one, assuming that the abscissae are
sorted from smaller to larger. If the input value is outside of the
defined intervals the outputs associated with the min and max
abscissae are returned, respectively.</p>
<p>Not exposed yet, unclear how the higher level API should look
like.</p></dd>
<dt><a name="199"><b class="cmd">::crimp::map2_*</b> <i class="arg">image</i> <i class="arg">mapNimage</i>... <i class="arg">mapNcontrol</i>...</a></dt>
<dd><p>Primitives applying per-pixel transformations to multi-channel images
(HSV, RGB, RGBA). Each channel is transformed with one map image per
channel, and one integer index per channel selecting the control
channel.
Each map is a 256x256 <b class="const">grey8</b> image indexed by the pixel data of
the channel to be mapped in X, and the pixel data of the chosen
control channel in Y. This enables effects like hue-dependent changes
to saturation or value, value dependent color-shifts, etc.</p>
<p>Not exposed yet, unclear how the higher level API should
look like.</p></dd>
<dt><a name="200"><b class="cmd">::crimp::region_sum</b> <i class="arg">image</i> <i class="arg">radius</i></a></dt>
<dd><p>Takes a <i class="term"><a href="../../index.html#key116">summed area table</a></i> as input and computes the sums
for square windows of the <i class="arg">radius</i> around each pixel. Time
is constant per pixel, independent of the radius, because of the
nature of the input. Only used internally so far.</p></dd>
<dt><a name="201"><b class="cmd">::crimp::exp_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="202"><b class="cmd">::crimp::log_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="203"><b class="cmd">::crimp::log10_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="204"><b class="cmd">::crimp::offset_float</b> <i class="arg">image</i> <i class="arg">offset</i></a></dt>
<dd></dd>
<dt><a name="205"><b class="cmd">::crimp::pow_float_float</b> <i class="arg">imageBase</i> <i class="arg">imageExponent</i></a></dt>
<dd></dd>
<dt><a name="206"><b class="cmd">::crimp::scale_float</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd></dd>
<dt><a name="207"><b class="cmd">::crimp::sqrt_float</b> <i class="arg">image</i></a></dt>
<dd><p>Only used internally (or demos), in various calculations like arithmetic mean, standard
deviation, etc. Might be useful in general, as unary operator.</p></dd>
<dt><a name="208"><b class="cmd">::crimp::non_max_suppression</b> <i class="arg">imageMagnitude</i> <i class="arg">imageAngle</i></a></dt>
<dd></dd>
<dt><a name="209"><b class="cmd">::crimp::trace_hysteresis</b> <i class="arg">image</i> <i class="arg">low</i> <i class="arg">high</i></a></dt>
<dd><p>Abandoned, part of an older attempt at canny edge detection.</p></dd>
<dt><a name="210"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="211"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></dt>
<dd><p>Window the image by decreasing luma from center to the edges using an
inverse square law. Currently only used internally, as part of the
translational registration. Might be useful in general.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>







|















|










|




|

|

|

|

|

|

|


|

|

|

|







1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
gradient. It is computed by applying a gradient of gaussian to X and Y
directions, and computing the length of the resulting 2-vector
(euclidean norm), i.e.</p>
<pre class="example">
    hypot (gauss10 (grad10 (image)), gauss10 (grad01 (image)))
</pre>
</dd>
<dt><a name="199"><b class="cmd">::crimp::map_2*_*</b> <i class="arg">image</i> <i class="arg">map</i></a></dt>
<dd><p>Operators applying a piecewise linear <i class="arg">map</i> to the input image.
The map is stored in a Tcl list containing 2 elements, each a
bytearray.  The first stores the abscissaes delineating the intervals,
the second the ordinates at these interval borders. The format of the
binary data depends on the types of input and output values (byte,
int, float, ...).</p>
<p>For conversion a pixel value is searched for in the intervals
of abscissae. With both the interval and the fraction inside of it
known the output is then linearly interpolated from the associated
ordinates. The search is a binary one, assuming that the abscissae are
sorted from smaller to larger. If the input value is outside of the
defined intervals the outputs associated with the min and max
abscissae are returned, respectively.</p>
<p>Not exposed yet, unclear how the higher level API should look
like.</p></dd>
<dt><a name="200"><b class="cmd">::crimp::map2_*</b> <i class="arg">image</i> <i class="arg">mapNimage</i>... <i class="arg">mapNcontrol</i>...</a></dt>
<dd><p>Primitives applying per-pixel transformations to multi-channel images
(HSV, RGB, RGBA). Each channel is transformed with one map image per
channel, and one integer index per channel selecting the control
channel.
Each map is a 256x256 <b class="const">grey8</b> image indexed by the pixel data of
the channel to be mapped in X, and the pixel data of the chosen
control channel in Y. This enables effects like hue-dependent changes
to saturation or value, value dependent color-shifts, etc.</p>
<p>Not exposed yet, unclear how the higher level API should
look like.</p></dd>
<dt><a name="201"><b class="cmd">::crimp::region_sum</b> <i class="arg">image</i> <i class="arg">radius</i></a></dt>
<dd><p>Takes a <i class="term"><a href="../../index.html#key116">summed area table</a></i> as input and computes the sums
for square windows of the <i class="arg">radius</i> around each pixel. Time
is constant per pixel, independent of the radius, because of the
nature of the input. Only used internally so far.</p></dd>
<dt><a name="202"><b class="cmd">::crimp::exp_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="203"><b class="cmd">::crimp::log_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="204"><b class="cmd">::crimp::log10_float</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="205"><b class="cmd">::crimp::offset_float</b> <i class="arg">image</i> <i class="arg">offset</i></a></dt>
<dd></dd>
<dt><a name="206"><b class="cmd">::crimp::pow_float_float</b> <i class="arg">imageBase</i> <i class="arg">imageExponent</i></a></dt>
<dd></dd>
<dt><a name="207"><b class="cmd">::crimp::scale_float</b> <i class="arg">image</i> <i class="arg">factor</i></a></dt>
<dd></dd>
<dt><a name="208"><b class="cmd">::crimp::sqrt_float</b> <i class="arg">image</i></a></dt>
<dd><p>Only used internally (or demos), in various calculations like arithmetic mean, standard
deviation, etc. Might be useful in general, as unary operator.</p></dd>
<dt><a name="209"><b class="cmd">::crimp::non_max_suppression</b> <i class="arg">imageMagnitude</i> <i class="arg">imageAngle</i></a></dt>
<dd></dd>
<dt><a name="210"><b class="cmd">::crimp::trace_hysteresis</b> <i class="arg">image</i> <i class="arg">low</i> <i class="arg">high</i></a></dt>
<dd><p>Abandoned, part of an older attempt at canny edge detection.</p></dd>
<dt><a name="211"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="212"><b class="cmd">::crimp::window_*</b> <i class="arg">image</i></a></dt>
<dd><p>Window the image by decreasing luma from center to the edges using an
inverse square law. Currently only used internally, as part of the
translational registration. Might be useful in general.</p></dd>
</dl>
</div>
</div>
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
Changes to embedded/www/doc/files/crimp_bmp.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_bmp(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_bmp - CRIMP - BMP handling, Windows Bitmap</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::bmp <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read bmp</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_bmp(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_bmp - CRIMP - BMP handling, Windows Bitmap</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::bmp <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read bmp</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
Changes to embedded/www/doc/files/crimp_core.html.
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
130
131
132
133
134
135
136
137
138
139
140

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167


168
169
170
171
172
173
174
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_core(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_core - CRIMP - Foundation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Images</a></li>
<li class="section"><a href="#section3">Image Types</a></li>
<li class="section"><a href="#section4">General design</a></li>
<li class="section"><a href="#section5">Tcl API</a>
<ul>
<li class="subsection"><a href="#subsection1">Accessors</a></li>
<li class="subsection"><a href="#subsection2">I/O commands</a></li>

</ul>
</li>
<li class="section"><a href="#section6">C API</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::core <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <i class="arg">...</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">channels</b> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">dimensions</b> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">height</b> <i class="arg">image</i></a></li>

<li><a href="#5"><b class="cmd">::crimp</b> <b class="method">meta append</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">string</i>...?</span></a></li>
<li><a href="#6"><b class="cmd">::crimp</b> <b class="method">meta create</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#7"><b class="cmd">::crimp</b> <b class="method">meta exists</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#8"><b class="cmd">::crimp</b> <b class="method">meta filter</b> <i class="arg">image</i> <i class="arg">args</i>...</a></li>
<li><a href="#9"><b class="cmd">::crimp</b> <b class="method">meta for</b> <i class="arg">image</i> {<i class="arg">keyVar</i> <i class="arg">valueVar</i>} <i class="arg">body</i></a></li>
<li><a href="#10"><b class="cmd">::crimp</b> <b class="method">meta get</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#11"><b class="cmd">::crimp</b> <b class="method">meta incr</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">increment</i>?</span></a></li>
<li><a href="#12"><b class="cmd">::crimp</b> <b class="method">meta info</b> <i class="arg">image</i></a></li>
<li><a href="#13"><b class="cmd">::crimp</b> <b class="method">meta keys</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::crimp</b> <b class="method">meta lappend</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>...?</span></a></li>
<li><a href="#15"><b class="cmd">::crimp</b> <b class="method">meta merge</b> <i class="arg">image</i> <span class="opt">?<i class="arg">dictionaryValue</i>...?</span></a></li>
<li><a href="#16"><b class="cmd">::crimp</b> <b class="method">meta remove</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#17"><b class="cmd">::crimp</b> <b class="method">meta replace</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#18"><b class="cmd">::crimp</b> <b class="method">meta set</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span> <i class="arg">value</i></a></li>
<li><a href="#19"><b class="cmd">::crimp</b> <b class="method">meta size</b> <i class="arg">image</i></a></li>
<li><a href="#20"><b class="cmd">::crimp</b> <b class="method">meta unset</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#21"><b class="cmd">::crimp</b> <b class="method">meta values</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></li>
<li><a href="#22"><b class="cmd">::crimp</b> <b class="method">pixel</b> <i class="arg">image</i></a></li>
<li><a href="#23"><b class="cmd">::crimp</b> <b class="method">type</b> <i class="arg">image</i></a></li>
<li><a href="#24"><b class="cmd">::crimp</b> <b class="method">width</b> <i class="arg">image</i></a></li>
<li><a href="#25"><b class="cmd">::crimp</b> <b class="method">read</b> <i class="arg">...</i></a></li>
<li><a href="#26"><b class="cmd">::crimp</b> <b class="method">read tcl grey8</b> <i class="arg">pixelmatrix</i></a></li>
<li><a href="#27"><b class="cmd">::crimp</b> <b class="method">read tcl float</b> <i class="arg">pixelmatrix</i></a></li>
<li><a href="#28"><b class="cmd">::crimp</b> <b class="method">write</b> <i class="arg">...</i></a></li>
<li><a href="#29"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#30"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#31"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>


</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is the foundation for the whole of CRIMP, the C Raster
Image Manipulation Package.</p>
<p>For a basic introduction of the whole CRIMP eco-system please read







|















>











|





|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>







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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_core(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_core - CRIMP - Foundation</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Images</a></li>
<li class="section"><a href="#section3">Image Types</a></li>
<li class="section"><a href="#section4">General design</a></li>
<li class="section"><a href="#section5">Tcl API</a>
<ul>
<li class="subsection"><a href="#subsection1">Accessors</a></li>
<li class="subsection"><a href="#subsection2">I/O commands</a></li>
<li class="subsection"><a href="#subsection3">Support</a></li>
</ul>
</li>
<li class="section"><a href="#section6">C API</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::core <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <i class="arg">...</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">channels</b> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">dimensions</b> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">geometry</b> <i class="arg">image</i></a></li>
<li><a href="#5"><b class="cmd">::crimp</b> <b class="method">height</b> <i class="arg">image</i></a></li>
<li><a href="#6"><b class="cmd">::crimp</b> <b class="method">meta append</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">string</i>...?</span></a></li>
<li><a href="#7"><b class="cmd">::crimp</b> <b class="method">meta create</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#8"><b class="cmd">::crimp</b> <b class="method">meta exists</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#9"><b class="cmd">::crimp</b> <b class="method">meta filter</b> <i class="arg">image</i> <i class="arg">args</i>...</a></li>
<li><a href="#10"><b class="cmd">::crimp</b> <b class="method">meta for</b> <i class="arg">image</i> {<i class="arg">keyVar</i> <i class="arg">valueVar</i>} <i class="arg">body</i></a></li>
<li><a href="#11"><b class="cmd">::crimp</b> <b class="method">meta get</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#12"><b class="cmd">::crimp</b> <b class="method">meta incr</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">increment</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::crimp</b> <b class="method">meta info</b> <i class="arg">image</i></a></li>
<li><a href="#14"><b class="cmd">::crimp</b> <b class="method">meta keys</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></li>
<li><a href="#15"><b class="cmd">::crimp</b> <b class="method">meta lappend</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>...?</span></a></li>
<li><a href="#16"><b class="cmd">::crimp</b> <b class="method">meta merge</b> <i class="arg">image</i> <span class="opt">?<i class="arg">dictionaryValue</i>...?</span></a></li>
<li><a href="#17"><b class="cmd">::crimp</b> <b class="method">meta remove</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#18"><b class="cmd">::crimp</b> <b class="method">meta replace</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></li>
<li><a href="#19"><b class="cmd">::crimp</b> <b class="method">meta set</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span> <i class="arg">value</i></a></li>
<li><a href="#20"><b class="cmd">::crimp</b> <b class="method">meta size</b> <i class="arg">image</i></a></li>
<li><a href="#21"><b class="cmd">::crimp</b> <b class="method">meta unset</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></li>
<li><a href="#22"><b class="cmd">::crimp</b> <b class="method">meta values</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></li>
<li><a href="#23"><b class="cmd">::crimp</b> <b class="method">pixel</b> <i class="arg">image</i></a></li>
<li><a href="#24"><b class="cmd">::crimp</b> <b class="method">type</b> <i class="arg">image</i></a></li>
<li><a href="#25"><b class="cmd">::crimp</b> <b class="method">width</b> <i class="arg">image</i></a></li>
<li><a href="#26"><b class="cmd">::crimp</b> <b class="method">read</b> <i class="arg">...</i></a></li>
<li><a href="#27"><b class="cmd">::crimp</b> <b class="method">read tcl grey8</b> <i class="arg">pixelmatrix</i></a></li>
<li><a href="#28"><b class="cmd">::crimp</b> <b class="method">read tcl float</b> <i class="arg">pixelmatrix</i></a></li>
<li><a href="#29"><b class="cmd">::crimp</b> <b class="method">write</b> <i class="arg">...</i></a></li>
<li><a href="#30"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#31"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#32"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>
<li><a href="#33"><b class="cmd">::crimp</b> <b class="method">bbox</b> <i class="arg">image</i>...</a></li>
<li><a href="#34"><b class="cmd">::crimp</b> <b class="method">bbox2</b> <i class="arg">box1</i> <i class="arg">box2</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>This package is the foundation for the whole of CRIMP, the C Raster
Image Manipulation Package.</p>
<p>For a basic introduction of the whole CRIMP eco-system please read
393
394
395
396
397
398
399
400






401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
<b class="method">remap</b> method.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="3"><b class="cmd">::crimp</b> <b class="method">dimensions</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the width and height of the <i class="arg">image</i> (in
pixels).  The result is a 2-element list containing width and height,
in this order.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="4"><b class="cmd">::crimp</b> <b class="method">height</b> <i class="arg">image</i></a></dt>






<dd><p>This method returns the height of the <i class="arg">image</i> (in pixels).</p>
<p>The method supports all image types.</p></dd>
<dt><a name="5"><b class="cmd">::crimp</b> <b class="method">meta append</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">string</i>...?</span></a></dt>
<dd></dd>
<dt><a name="6"><b class="cmd">::crimp</b> <b class="method">meta create</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></dt>
<dd></dd>
<dt><a name="7"><b class="cmd">::crimp</b> <b class="method">meta exists</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::crimp</b> <b class="method">meta filter</b> <i class="arg">image</i> <i class="arg">args</i>...</a></dt>
<dd></dd>
<dt><a name="9"><b class="cmd">::crimp</b> <b class="method">meta for</b> <i class="arg">image</i> {<i class="arg">keyVar</i> <i class="arg">valueVar</i>} <i class="arg">body</i></a></dt>
<dd></dd>
<dt><a name="10"><b class="cmd">::crimp</b> <b class="method">meta get</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="11"><b class="cmd">::crimp</b> <b class="method">meta incr</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">increment</i>?</span></a></dt>
<dd></dd>
<dt><a name="12"><b class="cmd">::crimp</b> <b class="method">meta info</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="13"><b class="cmd">::crimp</b> <b class="method">meta keys</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></dt>
<dd></dd>
<dt><a name="14"><b class="cmd">::crimp</b> <b class="method">meta lappend</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>...?</span></a></dt>
<dd></dd>
<dt><a name="15"><b class="cmd">::crimp</b> <b class="method">meta merge</b> <i class="arg">image</i> <span class="opt">?<i class="arg">dictionaryValue</i>...?</span></a></dt>
<dd></dd>
<dt><a name="16"><b class="cmd">::crimp</b> <b class="method">meta remove</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="17"><b class="cmd">::crimp</b> <b class="method">meta replace</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></dt>
<dd></dd>
<dt><a name="18"><b class="cmd">::crimp</b> <b class="method">meta set</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span> <i class="arg">value</i></a></dt>
<dd></dd>
<dt><a name="19"><b class="cmd">::crimp</b> <b class="method">meta size</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="20"><b class="cmd">::crimp</b> <b class="method">meta unset</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="21"><b class="cmd">::crimp</b> <b class="method">meta values</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></dt>
<dd><p>These methods provide access to the meta data slot of images, treating
its contents as a dictionary. As such all the methods provided here
have an appropriate counterpart in the methods of Tcl's builtin
command <b class="cmd">dict</b>, with the image's metadata taking the place of the
dictionary value or vqariable.
The converse is not true, as <b class="cmd">dict</b>'s methods <b class="method">update</b> and
<b class="method">with</b> are not supported here.</p>
<p>Please read the documentation of Tcl's <b class="cmd">dict</b> command for reference.</p>
<p><em>NOTE</em> that the toplevel key <b class="const">crimp</b> is reserved for
use by CRIMP itself.</p></dd>
<dt><a name="22"><b class="cmd">::crimp</b> <b class="method">pixel</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the raw pixels of the <i class="arg">image</i> as a Tcl ByteArray.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="23"><b class="cmd">::crimp</b> <b class="method">type</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the type of the <i class="arg">image</i>.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="24"><b class="cmd">::crimp</b> <b class="method">width</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the width of the <i class="arg">image</i> (in pixels).</p>
<p>The method supports all image types.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">I/O commands</a></h3>
<dl class="definitions">
<dt><a name="25"><b class="cmd">::crimp</b> <b class="method">read</b> <i class="arg">...</i></a></dt>
<dd><p>This ensemble command is the umbrella underneath which any and all
functionality for reading images from external formats must be placed.</p>
<p>This command is an <i class="term">extension point</i>. I.e., other packages
are allowed to extend this ensemble by providing commands of the form
<b class="cmd">::crimp::read::<b class="variable">FOO</b></b>, where <i class="term">FOO</i> should be the name of
the format the command is able to read, or related to it.
Note that only commands beginning with a lower-case alphanumerical
character, i.e. [a-z0-9] will be exported by the ensemble. This
means that it is possible to put private helper commands into the
<b class="namespace">::crimp::read</b> namespace which will not be visible to the user,
by naming them appropriately. However, even so it is recommended to put
private commands into a sub-namespace instead, named after the package
in question, to reduce the probability of naming conflicts.</p>
<p>The commands used to extend the ensemble are not restricted in
their argument signature, although they are expected to return an image.</p>
<p>This package provides only rudimentary import facilities from
Tcl data structures, as described next.</p></dd>
<dt><a name="26"><b class="cmd">::crimp</b> <b class="method">read tcl grey8</b> <i class="arg">pixelmatrix</i></a></dt>
<dd><p>This method takes the <i class="arg">pixelmatrix</i>, a list of rows, with each row
a list of pixel values in the domain [0..255] and returns an
image of type <b class="const">grey8</b> whose height is the number of rows, i.e.
the length of the outer list, and whose width is the maximum length
found among the inner lists. Rows whose inner list is shorter than the
maximum length are padded with black pixels, i.e. a pixel value of
<b class="const">0</b>.</p></dd>
<dt><a name="27"><b class="cmd">::crimp</b> <b class="method">read tcl float</b> <i class="arg">pixelmatrix</i></a></dt>
<dd><p>This method takes the <i class="arg">pixelmatrix</i>, a list of rows, with each row
a list of floating point values for pixel values and returns an image
of type <b class="const">float</b> whose height is the number of rows, i.e.  the
length of the outer list, and whose width is the maximum length found
among the inner lists. Rows whose inner list is shorter than the
maximum length are padded with a pixel value of <b class="const">0</b>.</p></dd>
<dt><a name="28"><b class="cmd">::crimp</b> <b class="method">write</b> <i class="arg">...</i></a></dt>
<dd><p>This ensemble command is the umbrella underneath which any and all
functionality for writing images to external formats must be placed.</p>
<p>This command is an <i class="term">extension point</i>. I.e., other packages
are allowed to extend this ensemble by providing commands of the form
<b class="cmd">::crimp::write::<b class="variable">FOO</b></b>, where <i class="term">FOO</i> should be the name of
the format the command is able to write, or related to it.
Note that only commands beginning with a lower-case alphanumerical
character, i.e. [a-z0-9] will be exported by the ensemble. This
means that it is possible to put private helper commands into the
<b class="namespace">::crimp::write</b> namespace which will not be visible to the user,
by naming them appropriately. However, even so it is recommended to put
private commands into a sub-namespace instead, named after the package
in question, to reduce the probability of naming conflicts.</p>
<p>The commands used to extend the ensemble are not restricted in
their argument signature, although they are expected to take at least
an image as argument.</p></dd>
<dt><a name="29"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="30"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="31"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></dt>
<dd><p>This family of methods extends the basic <b class="cmd">::crimp write</b> ensemble.
The input <i class="arg">image</i> is returned as either a binary string in the
specified <i class="arg">format</i>, or written to the open channel <i class="arg">chan</i>, or
the named file at <i class="arg">path</i>.</p>
<p>By default the only supported format is <b class="const">tcl</b>, a representation
of an image as a nested Tcl list. This format supports, i.e. accepts, images
with the types <b class="const">grey8</b>, <b class="const">rga</b>, <b class="const">rgba</b>, and <b class="const">hsv</b> for







|
>
>
>
>
>
>


|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|










|


|


|






|

















|







|






|
















|

|

|







397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
<b class="method">remap</b> method.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="3"><b class="cmd">::crimp</b> <b class="method">dimensions</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the width and height of the <i class="arg">image</i> (in
pixels).  The result is a 2-element list containing width and height,
in this order.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="4"><b class="cmd">::crimp</b> <b class="method">geometry</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the <i class="term"><a href="../../index.html#key115">geometry</a></i> of the <i class="arg">image</i> (in
pixels). The result is a 4-element list containing x-, y-location,
width and height, in this order. This is also called the
<i class="term"><a href="../../index.html#key163">bounding box</a></i> of the image.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="5"><b class="cmd">::crimp</b> <b class="method">height</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the height of the <i class="arg">image</i> (in pixels).</p>
<p>The method supports all image types.</p></dd>
<dt><a name="6"><b class="cmd">::crimp</b> <b class="method">meta append</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">string</i>...?</span></a></dt>
<dd></dd>
<dt><a name="7"><b class="cmd">::crimp</b> <b class="method">meta create</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></dt>
<dd></dd>
<dt><a name="8"><b class="cmd">::crimp</b> <b class="method">meta exists</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="9"><b class="cmd">::crimp</b> <b class="method">meta filter</b> <i class="arg">image</i> <i class="arg">args</i>...</a></dt>
<dd></dd>
<dt><a name="10"><b class="cmd">::crimp</b> <b class="method">meta for</b> <i class="arg">image</i> {<i class="arg">keyVar</i> <i class="arg">valueVar</i>} <i class="arg">body</i></a></dt>
<dd></dd>
<dt><a name="11"><b class="cmd">::crimp</b> <b class="method">meta get</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="12"><b class="cmd">::crimp</b> <b class="method">meta incr</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">increment</i>?</span></a></dt>
<dd></dd>
<dt><a name="13"><b class="cmd">::crimp</b> <b class="method">meta info</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="14"><b class="cmd">::crimp</b> <b class="method">meta keys</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></dt>
<dd></dd>
<dt><a name="15"><b class="cmd">::crimp</b> <b class="method">meta lappend</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">value</i>...?</span></a></dt>
<dd></dd>
<dt><a name="16"><b class="cmd">::crimp</b> <b class="method">meta merge</b> <i class="arg">image</i> <span class="opt">?<i class="arg">dictionaryValue</i>...?</span></a></dt>
<dd></dd>
<dt><a name="17"><b class="cmd">::crimp</b> <b class="method">meta remove</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="18"><b class="cmd">::crimp</b> <b class="method">meta replace</b> <i class="arg">image</i> <span class="opt">?<i class="arg">key</i> <i class="arg">value</i>...?</span></a></dt>
<dd></dd>
<dt><a name="19"><b class="cmd">::crimp</b> <b class="method">meta set</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span> <i class="arg">value</i></a></dt>
<dd></dd>
<dt><a name="20"><b class="cmd">::crimp</b> <b class="method">meta size</b> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="21"><b class="cmd">::crimp</b> <b class="method">meta unset</b> <i class="arg">image</i> <i class="arg">key</i> <span class="opt">?<i class="arg">key</i>...?</span></a></dt>
<dd></dd>
<dt><a name="22"><b class="cmd">::crimp</b> <b class="method">meta values</b> <i class="arg">image</i> <span class="opt">?<i class="arg">globPattern</i>?</span></a></dt>
<dd><p>These methods provide access to the meta data slot of images, treating
its contents as a dictionary. As such all the methods provided here
have an appropriate counterpart in the methods of Tcl's builtin
command <b class="cmd">dict</b>, with the image's metadata taking the place of the
dictionary value or vqariable.
The converse is not true, as <b class="cmd">dict</b>'s methods <b class="method">update</b> and
<b class="method">with</b> are not supported here.</p>
<p>Please read the documentation of Tcl's <b class="cmd">dict</b> command for reference.</p>
<p><em>NOTE</em> that the toplevel key <b class="const">crimp</b> is reserved for
use by CRIMP itself.</p></dd>
<dt><a name="23"><b class="cmd">::crimp</b> <b class="method">pixel</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the raw pixels of the <i class="arg">image</i> as a Tcl ByteArray.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="24"><b class="cmd">::crimp</b> <b class="method">type</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the type of the <i class="arg">image</i>.</p>
<p>The method supports all image types.</p></dd>
<dt><a name="25"><b class="cmd">::crimp</b> <b class="method">width</b> <i class="arg">image</i></a></dt>
<dd><p>This method returns the width of the <i class="arg">image</i> (in pixels).</p>
<p>The method supports all image types.</p></dd>
</dl>
</div>
<div id="subsection2" class="subsection"><h3><a name="subsection2">I/O commands</a></h3>
<dl class="definitions">
<dt><a name="26"><b class="cmd">::crimp</b> <b class="method">read</b> <i class="arg">...</i></a></dt>
<dd><p>This ensemble command is the umbrella underneath which any and all
functionality for reading images from external formats must be placed.</p>
<p>This command is an <i class="term">extension point</i>. I.e., other packages
are allowed to extend this ensemble by providing commands of the form
<b class="cmd">::crimp::read::<b class="variable">FOO</b></b>, where <i class="term">FOO</i> should be the name of
the format the command is able to read, or related to it.
Note that only commands beginning with a lower-case alphanumerical
character, i.e. [a-z0-9] will be exported by the ensemble. This
means that it is possible to put private helper commands into the
<b class="namespace">::crimp::read</b> namespace which will not be visible to the user,
by naming them appropriately. However, even so it is recommended to put
private commands into a sub-namespace instead, named after the package
in question, to reduce the probability of naming conflicts.</p>
<p>The commands used to extend the ensemble are not restricted in
their argument signature, although they are expected to return an image.</p>
<p>This package provides only rudimentary import facilities from
Tcl data structures, as described next.</p></dd>
<dt><a name="27"><b class="cmd">::crimp</b> <b class="method">read tcl grey8</b> <i class="arg">pixelmatrix</i></a></dt>
<dd><p>This method takes the <i class="arg">pixelmatrix</i>, a list of rows, with each row
a list of pixel values in the domain [0..255] and returns an
image of type <b class="const">grey8</b> whose height is the number of rows, i.e.
the length of the outer list, and whose width is the maximum length
found among the inner lists. Rows whose inner list is shorter than the
maximum length are padded with black pixels, i.e. a pixel value of
<b class="const">0</b>.</p></dd>
<dt><a name="28"><b class="cmd">::crimp</b> <b class="method">read tcl float</b> <i class="arg">pixelmatrix</i></a></dt>
<dd><p>This method takes the <i class="arg">pixelmatrix</i>, a list of rows, with each row
a list of floating point values for pixel values and returns an image
of type <b class="const">float</b> whose height is the number of rows, i.e.  the
length of the outer list, and whose width is the maximum length found
among the inner lists. Rows whose inner list is shorter than the
maximum length are padded with a pixel value of <b class="const">0</b>.</p></dd>
<dt><a name="29"><b class="cmd">::crimp</b> <b class="method">write</b> <i class="arg">...</i></a></dt>
<dd><p>This ensemble command is the umbrella underneath which any and all
functionality for writing images to external formats must be placed.</p>
<p>This command is an <i class="term">extension point</i>. I.e., other packages
are allowed to extend this ensemble by providing commands of the form
<b class="cmd">::crimp::write::<b class="variable">FOO</b></b>, where <i class="term">FOO</i> should be the name of
the format the command is able to write, or related to it.
Note that only commands beginning with a lower-case alphanumerical
character, i.e. [a-z0-9] will be exported by the ensemble. This
means that it is possible to put private helper commands into the
<b class="namespace">::crimp::write</b> namespace which will not be visible to the user,
by naming them appropriately. However, even so it is recommended to put
private commands into a sub-namespace instead, named after the package
in question, to reduce the probability of naming conflicts.</p>
<p>The commands used to extend the ensemble are not restricted in
their argument signature, although they are expected to take at least
an image as argument.</p></dd>
<dt><a name="30"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="31"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></dt>
<dd></dd>
<dt><a name="32"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></dt>
<dd><p>This family of methods extends the basic <b class="cmd">::crimp write</b> ensemble.
The input <i class="arg">image</i> is returned as either a binary string in the
specified <i class="arg">format</i>, or written to the open channel <i class="arg">chan</i>, or
the named file at <i class="arg">path</i>.</p>
<p>By default the only supported format is <b class="const">tcl</b>, a representation
of an image as a nested Tcl list. This format supports, i.e. accepts, images
with the types <b class="const">grey8</b>, <b class="const">rga</b>, <b class="const">rgba</b>, and <b class="const">hsv</b> for
532
533
534
535
536
537
538











539
540
541
542
543
544
545
546
547
548
549
550
551
552
<dl class="definitions">
<dt><b class="cmd">Str_...</b> <i class="arg">image</i></dt>
<dd></dd>
<dt><b class="cmd">Chan_...</b> <i class="arg">channel</i> <i class="arg">image</i></dt>
<dd></dd>
</dl></dd>
</dl>











</div>
</div>
<div id="section6" class="section"><h2><a name="section6">C API</a></h2>
<p>The C API of the core is of no interest to users of CRIMP, the audience
towards which this manpage is geared to.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../index.html#key159">channels</a>, <a href="../../index.html#key3">computer vision</a>, <a href="../../index.html#key160">dimensions</a>, <a href="../../index.html#key0">document processing</a>, <a href="../../index.html#key5">image</a>, <a href="../../index.html#key161">image accessors</a>, <a href="../../index.html#key162">image type</a>, <a href="../../index.html#key1">matrix</a>, <a href="../../index.html#key2">photo</a>, <a href="../../index.html#key4">vector</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries<br>
Copyright &copy; 2011 Documentation, Andreas Kupries</p>
</div>
</div></body></html>







>
>
>
>
>
>
>
>
>
>
>







|






542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
<dl class="definitions">
<dt><b class="cmd">Str_...</b> <i class="arg">image</i></dt>
<dd></dd>
<dt><b class="cmd">Chan_...</b> <i class="arg">channel</i> <i class="arg">image</i></dt>
<dd></dd>
</dl></dd>
</dl>
</div>
<div id="subsection3" class="subsection"><h3><a name="subsection3">Support</a></h3>
<dl class="definitions">
<dt><a name="33"><b class="cmd">::crimp</b> <b class="method">bbox</b> <i class="arg">image</i>...</a></dt>
<dd><p>This method takes one or more images and computes the union of their
geometries. The result is returned as a bounding box, a list of 4
numbers (x, y, width, and height).</p></dd>
<dt><a name="34"><b class="cmd">::crimp</b> <b class="method">bbox2</b> <i class="arg">box1</i> <i class="arg">box2</i></a></dt>
<dd><p>This method takes two bounding boxes (lists of 4 numbers (x, y, width,
and height)) and returns their union bounding box.</p></dd>
</dl>
</div>
</div>
<div id="section6" class="section"><h2><a name="section6">C API</a></h2>
<p>The C API of the core is of no interest to users of CRIMP, the audience
towards which this manpage is geared to.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../index.html#key163">bounding box</a>, <a href="../../index.html#key161">channels</a>, <a href="../../index.html#key3">computer vision</a>, <a href="../../index.html#key160">dimensions</a>, <a href="../../index.html#key0">document processing</a>, <a href="../../index.html#key115">geometry</a>, <a href="../../index.html#key5">image</a>, <a href="../../index.html#key159">image accessors</a>, <a href="../../index.html#key162">image type</a>, <a href="../../index.html#key1">matrix</a>, <a href="../../index.html#key2">photo</a>, <a href="../../index.html#key4">vector</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries<br>
Copyright &copy; 2011 Documentation, Andreas Kupries</p>
</div>
</div></body></html>
Changes to embedded/www/doc/files/crimp_devguide.html.
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
[1]     width
[2]     Tcl_Obj* imageObj
[3]
[4]     crimp_image* image;
[5]
[6]     crimp_input_any (imageObj, image);
[7]
[8]     Tcl_SetObjResult (interp, Tcl_NewIntObj (image-&gt;w));
[9]     return TCL_OK;
</pre>
<p>Line 1 contains the name of the primitive, &quot;width&quot;.
Line 2 is the first line of the argument block.
Line 3 terminates this argument block.
Lines 4 to 9 are the implementation.</p>
<p>This specific primitive extracts the width from the image it was given as







|







515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
[1]     width
[2]     Tcl_Obj* imageObj
[3]
[4]     crimp_image* image;
[5]
[6]     crimp_input_any (imageObj, image);
[7]
[8]     Tcl_SetObjResult (interp, Tcl_NewIntObj (crimp_w (image)));
[9]     return TCL_OK;
</pre>
<p>Line 1 contains the name of the primitive, &quot;width&quot;.
Line 2 is the first line of the argument block.
Line 3 terminates this argument block.
Lines 4 to 9 are the implementation.</p>
<p>This specific primitive extracts the width from the image it was given as
Changes to embedded/www/doc/files/crimp_pcx.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_pcx(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_pcx - CRIMP - PCX handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::pcx <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read pcx</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_pcx(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_pcx - CRIMP - PCX handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::pcx <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read pcx</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
Changes to embedded/www/doc/files/crimp_pfm.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_pfm(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_pfm - CRIMP - PFM handling, NetPBM</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::pfm <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read pfm</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>
</ul>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_pfm(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_pfm - CRIMP - PFM handling, NetPBM</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::pfm <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read pfm</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>
</ul>
Changes to embedded/www/doc/files/crimp_pgm.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_pgm(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_pgm - CRIMP - PGM handling, NetPBM</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::pgm <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read pgm</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>
</ul>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_pgm(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_pgm - CRIMP - PGM handling, NetPBM</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::pgm <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read pgm</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>
</ul>
Changes to embedded/www/doc/files/crimp_ppm.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_ppm(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_ppm - CRIMP - PPM handling, NetPBM</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::ppm <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read ppm</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>
</ul>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_ppm(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_ppm - CRIMP - PPM handling, NetPBM</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::ppm <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read ppm</b> <i class="arg">string</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2string</b> <i class="arg">format</i> <i class="arg">image</i></a></li>
<li><a href="#3"><b class="cmd">::crimp</b> <b class="method">write 2chan</b> <i class="arg">format</i> <i class="arg">chan</i> <i class="arg">image</i></a></li>
<li><a href="#4"><b class="cmd">::crimp</b> <b class="method">write 2file</b> <i class="arg">format</i> <i class="arg">path</i> <i class="arg">image</i></a></li>
</ul>
Changes to embedded/www/doc/files/crimp_sgi.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_sgi(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_sgi - CRIMP - SGI RASTER handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::sgi <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read sgi</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_sgi(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_sgi - CRIMP - SGI RASTER handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::sgi <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read sgi</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="ftp://ftp.sgi.com/graphics/SGIIMAGESPEC">ftp://ftp.sgi.com/graphics/SGIIMAGESPEC</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Silicon_Graphics_Image">http://en.wikipedia.org/wiki/Silicon_Graphics_Image</a></p></li>
</ol>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../index.html#key163">Export SGI Raster image</a>, <a href="../../index.html#key169">Export image, SGI Raster</a>, <a href="../../index.html#key164">Import SGI Raster image</a>, <a href="../../index.html#key166">Import image, SGI Raster</a>, <a href="../../index.html#key168">SGI</a>, <a href="../../index.html#key167">SGI Raster image export</a>, <a href="../../index.html#key165">SGI Raster image import</a>, <a href="../../index.html#key3">computer vision</a>, <a href="../../index.html#key0">document processing</a>, <a href="../../index.html#key5">image</a>, <a href="../../index.html#key1">matrix</a>, <a href="../../index.html#key2">photo</a>, <a href="../../index.html#key4">vector</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries<br>
Copyright &copy; 2011 Documentation, Andreas Kupries</p>
</div>
</div></body></html>







|






158
159
160
161
162
163
164
165
166
167
168
169
170
171
<div id="section3" class="section"><h2><a name="section3">References</a></h2>
<ol class="enumerated">
<li><p><a href="ftp://ftp.sgi.com/graphics/SGIIMAGESPEC">ftp://ftp.sgi.com/graphics/SGIIMAGESPEC</a></p></li>
<li><p><a href="http://en.wikipedia.org/wiki/Silicon_Graphics_Image">http://en.wikipedia.org/wiki/Silicon_Graphics_Image</a></p></li>
</ol>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../index.html#key164">Export SGI Raster image</a>, <a href="../../index.html#key170">Export image, SGI Raster</a>, <a href="../../index.html#key165">Import SGI Raster image</a>, <a href="../../index.html#key167">Import image, SGI Raster</a>, <a href="../../index.html#key169">SGI</a>, <a href="../../index.html#key168">SGI Raster image export</a>, <a href="../../index.html#key166">SGI Raster image import</a>, <a href="../../index.html#key3">computer vision</a>, <a href="../../index.html#key0">document processing</a>, <a href="../../index.html#key5">image</a>, <a href="../../index.html#key1">matrix</a>, <a href="../../index.html#key2">photo</a>, <a href="../../index.html#key4">vector</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2011 Andreas Kupries<br>
Copyright &copy; 2011 Documentation, Andreas Kupries</p>
</div>
</div></body></html>
Changes to embedded/www/doc/files/crimp_sun.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_sun(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_sun - CRIMP - SUN RASTER handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::sun <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read sun</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_sun(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_sun - CRIMP - SUN RASTER handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#section3">References</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">crimp::sun <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read sun</b> <i class="arg">string</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
Changes to embedded/www/doc/files/crimp_tk.html.
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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_tk(n) 0.1 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_tk - CRIMP - Tk Photo Handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">Tk 8.5</b></li>
<li>package require <b class="pkgname">crimp::tk <span class="opt">?0.1?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read tk</b> <i class="arg">photo</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2tk</b> <i class="arg">photo</i> <i class="arg">image</i></a></li>
</ul>
</div>
</div>







|


















|







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
130
131
132
133
   -->
<body><div class="doctools">
<hr> [
  <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
] <hr>
<h1 class="title">crimp_tk(n) 0.2 doc &quot;C Raster Image Manipulation Package&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>crimp_tk - CRIMP - Tk Photo Handling</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">Tcl API</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">Tk 8.5</b></li>
<li>package require <b class="pkgname">crimp::tk <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::crimp</b> <b class="method">read tk</b> <i class="arg">photo</i></a></li>
<li><a href="#2"><b class="cmd">::crimp</b> <b class="method">write 2tk</b> <i class="arg">photo</i> <i class="arg">image</i></a></li>
</ul>
</div>
</div>
Changes to embedded/www/image/structures.png.

cannot compute difference between binary files

Changes to embedded/www/index.html.
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737





738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key51"> BMP image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>





<tr class="#idxheader"><th colspan="2">
<a name="c3">Keywords: C</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key112"> canny </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key159"> channels </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key73"> charcoal </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key98"> clockwise </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key63"> closing </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key153"> composite blending </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key132"> composition </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key3"> computer vision </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key60"> const expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key135"> convolution filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key144"> counter-clockwise </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key56"> cropping </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key65"> cut region </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key106"> cyclic wrap expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c4">Keywords: D</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key72"> dilation </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key160"> dimensions </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key0"> document processing </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c5">Keywords: E</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key83"> edge shrinking </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key82"> edge-detection </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key134"> effect </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key127"> emboss </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key138"> erosion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key74"> expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key45"> Export BMP image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key48"> Export image, BMP </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key16"> Export image, PCX </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key23"> Export image, PFM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key32"> Export image, PGM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key11"> Export image, PPM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key169"> Export image, SGI Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key36"> Export image, SUN Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key13"> Export PCX image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key20"> Export PFM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key29"> Export PGM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key8"> Export PPM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key163"> Export SGI Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key37"> Export SUN Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key43"> Export tk photo </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key102"> extend expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key53"> external gradient </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key80"> extract rectangle </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key139"> extract region </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c6">Keywords: F</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key104"> fast fourier transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key79"> fft </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key103"> filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key57"> flip </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key155"> fourier transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c7">Keywords: G</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key71"> gamma correction </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key115"> geometry </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key152"> gradient </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c8">Keywords: H</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key122"> histogram </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key59"> hypot </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c9">Keywords: I</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key5"> image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key161"> image accessors </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key162"> image type </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key50"> Import BMP image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key49"> Import image, BMP </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key17"> Import image, PCX </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key24"> Import image, PFM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key33"> Import image, PGM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key12"> Import image, PPM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key166"> Import image, SGI Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key34"> Import image, SUN Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key18"> Import PCX image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key25"> Import PFM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key28"> Import PGM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key6"> Import PPM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key164"> Import SGI Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key39"> Import SUN Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key41"> Import tk photo </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key111"> integral image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key70"> internal gradient </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key117"> inverse fourier transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key118"> inversion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c10">Keywords: L</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key81"> log-compression </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key151"> log-polar transformation </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c11">Keywords: M</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key1"> matrix </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key105"> max </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key126"> max-filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key146"> mean </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key123"> mean filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key76"> median </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key93"> median-filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key89"> middle </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key100"> min </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key154"> min-filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key125"> mirror expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key96"> montage </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key78"> morphology </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c12">Keywords: O</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key141"> opening </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key52"> otsu threshold </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c13">Keywords: P</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key15"> PCX </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key14"> PCX image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key19"> PCX image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key54"> perspective </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key22"> PFM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key21"> PFM image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key26"> PFM image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key31"> PGM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key27"> PGM image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key30"> PGM image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key2"> photo </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key61"> pixel mapping </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key10"> PPM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key9"> PPM image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key7"> PPM image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key88"> prewitt </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key129"> projective </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key87"> projective transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c14">Keywords: R</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key158"> rank-order filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key113"> rectangle cut </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key136"> rectangle extraction </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key124"> region cut </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key149"> remapping </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key114"> replicate edge expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key107"> rescale </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key128"> resize </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key145"> roberts </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key77"> rotate </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key91"> rotation </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c15">Keywords: S</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key131"> sabattier effect </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key108"> scale </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key157"> scharr </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>





<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key168"> SGI </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key167"> SGI Raster image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key165"> SGI Raster image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key156"> sharpen </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key101"> shrinking </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key119"> sobel </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key137"> solarization </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key66"> sqrt-compression </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key94"> standard deviation filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key130"> statistics </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key69"> stddev </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key116"> summed area table </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key40"> SUN </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key38"> SUN Raster image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key35"> SUN Raster image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c16">Keywords: T</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key121"> threshold </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key95"> thresholding </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key44"> Tk photo export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key42"> Tk photo import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key140"> toggle map </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key92"> tophat </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key120"> toroidal wrap expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key99"> transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key68"> transform, fast fourier </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key58"> transform, fourier </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key143"> transform, inverse fourier </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key142"> transformation, log-polar </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key75"> translate </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c17">Keywords: V</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key67"> variance </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key4"> vector </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key150"> vector-field </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c18">Keywords: W</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key55"> warp </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key110"> white tophat </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key86"> windowing </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key90"> wrap expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
</table>
</body></html>







>
>
>
>
>



|




|
|



|




|




|




|




|




|




|




|




|




|




|




|







|




|




|







|




|




|




|




|




|




|




|




|




|




|




|




|
|



|




|




|




|




|




|
|



|




|




|




|




|




|







|




|




|




|




|







|




|


|

|







|




|







|




|
|



|




|




|




|




|




|




|




|
|



|




|




|




|




|




|
|



|




|




|




|




|




|







|




|







|




|




|




|




|




|




|




|




|




|




|




|




|







|




|







|




|




|




|




|




|




|




|




|




|




|




|




|




|




|




|




|




|







|




|




|




|




|




|




|




|




|




|




|







|




|




|




>
>
>
>
>

|




|




<
<
<
<
<




|




|




|




|




|




|




|




|




|




|




|







|




|




|




|




|




|




|




|




|




|




|




|




|







|




|




|







|




|




|




|






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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758





759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key51"> BMP image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key163"> bounding box </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c3">Keywords: C</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key112"> canny </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key161"> channels </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key73"> charcoal </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key98"> clockwise </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key63"> closing </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key153"> composite blending </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key132"> composition </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key3"> computer vision </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key60"> const expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key135"> convolution filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key144"> counter-clockwise </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key56"> cropping </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key65"> cut region </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key106"> cyclic wrap expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c4">Keywords: D</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key72"> dilation </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key160"> dimensions </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key0"> document processing </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c5">Keywords: E</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key83"> edge shrinking </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key82"> edge-detection </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key134"> effect </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key127"> emboss </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key138"> erosion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key74"> expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key45"> Export BMP image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key48"> Export image, BMP </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key16"> Export image, PCX </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key23"> Export image, PFM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key32"> Export image, PGM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key11"> Export image, PPM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key170"> Export image, SGI Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key36"> Export image, SUN Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key13"> Export PCX image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key20"> Export PFM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key29"> Export PGM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key8"> Export PPM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key164"> Export SGI Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key37"> Export SUN Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key43"> Export tk photo </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key102"> extend expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key53"> external gradient </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key80"> extract rectangle </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key139"> extract region </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c6">Keywords: F</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key104"> fast fourier transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key79"> fft </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key103"> filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key57"> flip </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key155"> fourier transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c7">Keywords: G</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key71"> gamma correction </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key115"> geometry </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key152"> gradient </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c8">Keywords: H</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key122"> histogram </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key59"> hypot </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c9">Keywords: I</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key5"> image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key159"> image accessors </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key162"> image type </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_core.html"> crimp_core </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key50"> Import BMP image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key49"> Import image, BMP </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_bmp.html"> crimp_bmp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key17"> Import image, PCX </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key24"> Import image, PFM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key33"> Import image, PGM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key12"> Import image, PPM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key167"> Import image, SGI Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key34"> Import image, SUN Raster </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key18"> Import PCX image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key25"> Import PFM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key28"> Import PGM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key6"> Import PPM image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key165"> Import SGI Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key39"> Import SUN Raster image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key41"> Import tk photo </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key111"> integral image </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key70"> internal gradient </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key117"> inverse fourier transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key118"> inversion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c10">Keywords: L</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key81"> log-compression </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key151"> log-polar transformation </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c11">Keywords: M</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key1"> matrix </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key105"> max </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key126"> max-filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key146"> mean </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key123"> mean filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key76"> median </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key93"> median-filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key89"> middle </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key100"> min </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key154"> min-filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key125"> mirror expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key96"> montage </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key78"> morphology </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c12">Keywords: O</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key141"> opening </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key52"> otsu threshold </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c13">Keywords: P</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key15"> PCX </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key14"> PCX image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key19"> PCX image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pcx.html"> crimp_pcx </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key54"> perspective </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key22"> PFM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key21"> PFM image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key26"> PFM image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pfm.html"> crimp_pfm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key31"> PGM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key27"> PGM image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key30"> PGM image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_pgm.html"> crimp_pgm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key2"> photo </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key61"> pixel mapping </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key10"> PPM </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key9"> PPM image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key7"> PPM image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_ppm.html"> crimp_ppm </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key88"> prewitt </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key129"> projective </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key87"> projective transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c14">Keywords: R</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key158"> rank-order filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key113"> rectangle cut </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key136"> rectangle extraction </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key124"> region cut </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key149"> remapping </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key114"> replicate edge expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key107"> rescale </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key128"> resize </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key145"> roberts </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key77"> rotate </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key91"> rotation </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c15">Keywords: S</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key131"> sabattier effect </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key108"> scale </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key157"> scharr </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key169"> SGI </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key168"> SGI Raster image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key166"> SGI Raster image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sgi.html"> crimp_sgi </a>
</td></tr>
<tr class="#idxodd" valign=top>





<td class="#idxleft" width="35%"><a name="key156"> sharpen </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key101"> shrinking </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key119"> sobel </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key137"> solarization </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key66"> sqrt-compression </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key94"> standard deviation filter </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key130"> statistics </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key69"> stddev </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key116"> summed area table </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key40"> SUN </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key38"> SUN Raster image export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key35"> SUN Raster image import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_sun.html"> crimp_sun </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c16">Keywords: T</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key121"> threshold </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key95"> thresholding </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key44"> Tk photo export </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key42"> Tk photo import </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key140"> toggle map </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key92"> tophat </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key120"> toroidal wrap expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key99"> transform </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key68"> transform, fast fourier </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key58"> transform, fourier </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key143"> transform, inverse fourier </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key142"> transformation, log-polar </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key75"> translate </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c17">Keywords: V</a>
</th></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key67"> variance </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key4"> vector </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a> &#183; <a href="doc/files/crimp_bmp.html"> crimp_bmp </a> &#183; <a href="doc/files/crimp_core.html"> crimp_core </a> &#183; <a href="doc/files/crimp_devguide.html"> crimp_devguide </a> &#183; <a href="doc/files/crimp_installer.html"> crimp_install_guide </a> &#183; <a href="doc/files/crimp_intro.html"> crimp_introduction </a> &#183; <a href="doc/files/crimp_pcx.html"> crimp_pcx </a> &#183; <a href="doc/files/crimp_pfm.html"> crimp_pfm </a> &#183; <a href="doc/files/crimp_pgm.html"> crimp_pgm </a> &#183; <a href="doc/files/crimp_ppm.html"> crimp_ppm </a> &#183; <a href="doc/files/crimp_sgi.html"> crimp_sgi </a> &#183; <a href="doc/files/crimp_sources.html"> crimp_sources </a> &#183; <a href="doc/files/crimp_sun.html"> crimp_sun </a> &#183; <a href="doc/files/crimp_tk.html"> crimp_tk </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key150"> vector-field </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxheader"><th colspan="2">
<a name="c18">Keywords: W</a>
</th></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key55"> warp </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key110"> white tophat </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxodd" valign=top>
<td class="#idxleft" width="35%"><a name="key86"> windowing </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
<tr class="#idxeven" valign=top>
<td class="#idxleft" width="35%"><a name="key90"> wrap expansion </a></td>
<td class="#idxright" width="65%">
<a href="doc/files/crimp.html"> crimp </a>
</td></tr>
</table>
</body></html>
Changes to format/bmp.c.
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 */

int
bmp_read_header (Tcl_Interp*     interp,
		 crimp_buffer*   buf,
		 bmp_info*       info)
{
    unsigned int   fsize, pixOffset, c, w, nMap;
    unsigned int   nBits, compression, nPix, nColors;
    int            h;
    int            topdown = 0; /* bottom-up storage, default */
    unsigned char* colorMap = 0;

    /*
     * Reference
     *	http://en.wikipedia.org/wiki/BMP_file_format







|
|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 */

int
bmp_read_header (Tcl_Interp*     interp,
		 crimp_buffer*   buf,
		 bmp_info*       info)
{
    unsigned int   fsize, pixOffset, c, w, compression;
    unsigned int   nPix, nColors, nMap, nBits;
    int            h;
    int            topdown = 0; /* bottom-up storage, default */
    unsigned char* colorMap = 0;

    /*
     * Reference
     *	http://en.wikipedia.org/wiki/BMP_file_format
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
bmp_read_pixels (bmp_info*      info,
		 crimp_image*   destination)
{
    crimp_buffer* buf = info->input;
    bmp_maskinfo mi [3];

    CRIMP_ASSERT_IMGTYPE (destination, rgb);
    CRIMP_ASSERT ((info->w == destination->w) &&
		  (info->h == destination->h), "Dimension mismatch");

    /*
     * We assume that:
     * - The buffer is positioned at the start of the pixel data.
     * - nBits and compression mode match.
     *
     * 'bmp_read_header', see above, ensures these conditions.







|
|







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
bmp_read_pixels (bmp_info*      info,
		 crimp_image*   destination)
{
    crimp_buffer* buf = info->input;
    bmp_maskinfo mi [3];

    CRIMP_ASSERT_IMGTYPE (destination, rgb);
    CRIMP_ASSERT ((info->w == crimp_w (destination)) &&
		  (info->h == crimp_h (destination)), "Dimension mismatch");

    /*
     * We assume that:
     * - The buffer is positioned at the start of the pixel data.
     * - nBits and compression mode match.
     *
     * 'bmp_read_header', see above, ensures these conditions.
Changes to format/pcx.c.
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
     */

    switch CODE (info->numBits, info->numPlanes) {
    case CODE(8,1):
	if (info->paletteType == 1) {
	    TRACE (("PCX (8/1 RGB, 256 colors VGA palette)\n"));

	    dst    = crimp_new_rgb (info->w, info->h);
	    result = decode_rgb_vga (info, buf, dst);
	} else {
	    TRACE (("PCX (8/1 GREY8)\n"));

	    dst    = crimp_new_grey8 (info->w, info->h);
	    result = decode_grey8 (info, buf, dst);
	}
	break;

    case CODE(8,3):
	TRACE (("PCX (8/3 RGB direct, no palette)\n"));

	dst    = crimp_new_rgb (info->w, info->h);
	result = decode_rgb_raw (info, buf, dst);
	break;

    case CODE(4,1):
	TRACE (("PCX (4/1 16 color, EGA palette)\n"));

	dst    = crimp_new_rgb (info->w, info->h);
	result = decode_16c (info, buf, dst);
	break;

    case CODE(2,1):
	TRACE (("PCX (2/1 4 color, EGA palette)\n"));

	dst    = crimp_new_rgb (info->w, info->h);
	result = decode_4c (info, buf, dst);
	break;

    case CODE(1,1):
	TRACE (("PCX (1/1 BW direct, no palette)\n"));

	dst    = crimp_new_grey8 (info->w, info->h);
	result = decode_2c (info, buf, dst);
	break;

    case CODE(1,4):
	TRACE (("PCX (1/4 16 color striped, EGA palette)\n"));

	dst    = crimp_new_rgb (info->w, info->h);
	result = decode_striped16c (info, buf, dst);
	break;

    case CODE(1,3):
	TRACE (("PCX (1/3 8 color striped, EGA palette)\n"));

	dst    = crimp_new_rgb (info->w, info->h);
	result = decode_striped8c (info, buf, dst);
	break;

    case CODE(1,2):
	TRACE (("PCX (1/2 4 color striped, EGA palette)\n"));

	dst    = crimp_new_rgb (info->w, info->h);
	result = decode_striped4c (info, buf, dst);
	break;

    default:
	TRACE (("PCX (%d/%d unknown)\n", info->numBits, info->numPlanes));
	break;
    }







|




|







|






|






|






|






|






|






|







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
     */

    switch CODE (info->numBits, info->numPlanes) {
    case CODE(8,1):
	if (info->paletteType == 1) {
	    TRACE (("PCX (8/1 RGB, 256 colors VGA palette)\n"));

	    dst    = crimp_new_rgb_at (info->x, info->y, info->w, info->h);
	    result = decode_rgb_vga (info, buf, dst);
	} else {
	    TRACE (("PCX (8/1 GREY8)\n"));

	    dst    = crimp_new_grey8_at (info->x, info->y, info->w, info->h);
	    result = decode_grey8 (info, buf, dst);
	}
	break;

    case CODE(8,3):
	TRACE (("PCX (8/3 RGB direct, no palette)\n"));

	dst    = crimp_new_rgb_at (info->x, info->y, info->w, info->h);
	result = decode_rgb_raw (info, buf, dst);
	break;

    case CODE(4,1):
	TRACE (("PCX (4/1 16 color, EGA palette)\n"));

	dst    = crimp_new_rgb_at (info->x, info->y, info->w, info->h);
	result = decode_16c (info, buf, dst);
	break;

    case CODE(2,1):
	TRACE (("PCX (2/1 4 color, EGA palette)\n"));

	dst    = crimp_new_rgb_at (info->x, info->y, info->w, info->h);
	result = decode_4c (info, buf, dst);
	break;

    case CODE(1,1):
	TRACE (("PCX (1/1 BW direct, no palette)\n"));

	dst    = crimp_new_grey8_at (info->x, info->y, info->w, info->h);
	result = decode_2c (info, buf, dst);
	break;

    case CODE(1,4):
	TRACE (("PCX (1/4 16 color striped, EGA palette)\n"));

	dst    = crimp_new_rgb_at (info->x, info->y, info->w, info->h);
	result = decode_striped16c (info, buf, dst);
	break;

    case CODE(1,3):
	TRACE (("PCX (1/3 8 color striped, EGA palette)\n"));

	dst    = crimp_new_rgb_at (info->x, info->y, info->w, info->h);
	result = decode_striped8c (info, buf, dst);
	break;

    case CODE(1,2):
	TRACE (("PCX (1/2 4 color striped, EGA palette)\n"));

	dst    = crimp_new_rgb_at (info->x, info->y, info->w, info->h);
	result = decode_striped4c (info, buf, dst);
	break;

    default:
	TRACE (("PCX (%d/%d unknown)\n", info->numBits, info->numPlanes));
	break;
    }
Changes to format/read-pfm.crimp.
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    /*
     * Text pixel data.
     */

    for (dst = &(FLOATP (result,0,0)); (at < stop) && (npix > 0); ) {
	/*fprintf(stderr,"P [%4d] s%d '%c' /%d\n",at-bytes,state,*at, npix);fflush(stderr);*/

	*dst = atof (at);

	/*fprintf(stderr,"\tsaved %d (%d)\n", (int)*dst, npix);fflush(stderr);*/

	dst ++;
	npix --;

	/* Emulate 'index'. Not implemented on windows */







|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    /*
     * Text pixel data.
     */

    for (dst = &(FLOATP (result,0,0)); (at < stop) && (npix > 0); ) {
	/*fprintf(stderr,"P [%4d] s%d '%c' /%d\n",at-bytes,state,*at, npix);fflush(stderr);*/

	*dst = atof ((char*) at);

	/*fprintf(stderr,"\tsaved %d (%d)\n", (int)*dst, npix);fflush(stderr);*/

	dst ++;
	npix --;

	/* Emulate 'index'. Not implemented on windows */
Changes to format/sgi.c.
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
	if (!crimp_buf_has (buf, 2*4*n)) {
	    Tcl_SetResult (interp,
			   "Bad SGI raster image (no space for RLE offset data)",
			   TCL_STATIC);
	    return 0;
	}

	info->ostart  = CRIMP_ALLOC_ARRAY (n, unsigned long);
	info->olength = CRIMP_ALLOC_ARRAY (n, unsigned long);

	TRACE (("SGI RLE Offsets @ %d\n", crimp_buf_tell (buf)));

	for (i = 0; i < n; i++) {
	    crimp_buf_read_uint32be (buf, &info->ostart[i]);
	}








|
|







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
	if (!crimp_buf_has (buf, 2*4*n)) {
	    Tcl_SetResult (interp,
			   "Bad SGI raster image (no space for RLE offset data)",
			   TCL_STATIC);
	    return 0;
	}

	info->ostart  = CRIMP_ALLOC_ARRAY (n, unsigned int);
	info->olength = CRIMP_ALLOC_ARRAY (n, unsigned int);

	TRACE (("SGI RLE Offsets @ %d\n", crimp_buf_tell (buf)));

	for (i = 0; i < n; i++) {
	    crimp_buf_read_uint32be (buf, &info->ostart[i]);
	}

384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399

		R (dst, x, y) = r;
		G (dst, x, y) = g;
		B (dst, x, y) = b;
	    }
	}
    } else {
	unsigned long* os = info->ostart;
	unsigned long* ol = info->olength;
	int i;

	for (y = h-1, i = 0;
	     y >= 0;
	     y--, i++) {

	    /* Decompress into destination, avoiding a temp buffer */







|
|







384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399

		R (dst, x, y) = r;
		G (dst, x, y) = g;
		B (dst, x, y) = b;
	    }
	}
    } else {
	unsigned int* os = info->ostart;
	unsigned int* ol = info->olength;
	int i;

	for (y = h-1, i = 0;
	     y >= 0;
	     y--, i++) {

	    /* Decompress into destination, avoiding a temp buffer */
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462

	for (y = h-1; y >= 0; y--) {
	    for (x=0; x < w; x++) {
		GREY8 (dst, x, y) = *pixel ++;
	    }
	}
    } else {
	unsigned long* os = info->ostart;
	unsigned long* ol = info->olength;
	int i;

	for (y = h-1, i = 0;
	     y >= 0;
	     y--, i++) {

	    TRACE (("SGI PIX DATA %8d", y));







|
|







447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462

	for (y = h-1; y >= 0; y--) {
	    for (x=0; x < w; x++) {
		GREY8 (dst, x, y) = *pixel ++;
	    }
	}
    } else {
	unsigned int* os = info->ostart;
	unsigned int* ol = info->olength;
	int i;

	for (y = h-1, i = 0;
	     y >= 0;
	     y--, i++) {

	    TRACE (("SGI PIX DATA %8d", y));
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
	for (y = h-1; y >= 0; y--) {
	    for (x=0; x < w; x++) {
		GREY8 (dst, x, y) = *pixel; /* Read MSB */
		pixel += 2;                 /* Next short, LSB skipped */
	    }
	}
    } else {
	unsigned long* os = info->ostart;
	unsigned long* ol = info->olength;
	int i;

	for (y = h-1, i = 0;
	     y >= 0;
	     y--, i++) {

	    TRACE (("SGI PIX DATA %8d", y));







|
|







490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
	for (y = h-1; y >= 0; y--) {
	    for (x=0; x < w; x++) {
		GREY8 (dst, x, y) = *pixel; /* Read MSB */
		pixel += 2;                 /* Next short, LSB skipped */
	    }
	}
    } else {
	unsigned int* os = info->ostart;
	unsigned int* ol = info->olength;
	int i;

	for (y = h-1, i = 0;
	     y >= 0;
	     y--, i++) {

	    TRACE (("SGI PIX DATA %8d", y));
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
	    for (x=0; x < w; x++) {
		R (dst, x, y) = *r ++;
		G (dst, x, y) = *g ++;
		B (dst, x, y) = *b ++;
	    }
	}
    } else {
	unsigned long* os = info->ostart;
	unsigned long* ol = info->olength;
	int r, g, b;

	for (y = h-1, r = 0, g = h, b = h+h;
	     y >= 0;
	     y--, r++, g++, b++) {

	    TRACE (("SGI PIX DATA %8d R", y));







|
|







538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
	    for (x=0; x < w; x++) {
		R (dst, x, y) = *r ++;
		G (dst, x, y) = *g ++;
		B (dst, x, y) = *b ++;
	    }
	}
    } else {
	unsigned int* os = info->ostart;
	unsigned int* ol = info->olength;
	int r, g, b;

	for (y = h-1, r = 0, g = h, b = h+h;
	     y >= 0;
	     y--, r++, g++, b++) {

	    TRACE (("SGI PIX DATA %8d R", y));
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
		/* Read only MSB, skip LSB */
		R (dst, x, y) = *r; r += 2;
		G (dst, x, y) = *g; g += 2;
		B (dst, x, y) = *b; b += 2;
	    }
	}
    } else {
	unsigned long* os = info->ostart;
	unsigned long* ol = info->olength;
	int r, g, b;

	for (y = h-1, r = 0, g = h, b = h+h;
	     y >= 0;
	     y--, r++, g++, b++) {

	    TRACE (("SGI PIX DATA %8d R", y));







|
|







599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
		/* Read only MSB, skip LSB */
		R (dst, x, y) = *r; r += 2;
		G (dst, x, y) = *g; g += 2;
		B (dst, x, y) = *b; b += 2;
	    }
	}
    } else {
	unsigned int* os = info->ostart;
	unsigned int* ol = info->olength;
	int r, g, b;

	for (y = h-1, r = 0, g = h, b = h+h;
	     y >= 0;
	     y--, r++, g++, b++) {

	    TRACE (("SGI PIX DATA %8d R", y));
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
		R (dst, x, y) = *r ++;
		G (dst, x, y) = *g ++;
		B (dst, x, y) = *b ++;
		A (dst, x, y) = *a ++;
	    }
	}
    } else {
	unsigned long* os = info->ostart;
	unsigned long* ol = info->olength;
	int r, g, b, a;

	for (y = h-1, r = 0, g = h, b = g+h, a = b+h;
	     y >= 0;
	     y--, r++, g++, b++, a++) {

	    TRACE (("SGI PIX DATA %8d R", y));







|
|







661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
		R (dst, x, y) = *r ++;
		G (dst, x, y) = *g ++;
		B (dst, x, y) = *b ++;
		A (dst, x, y) = *a ++;
	    }
	}
    } else {
	unsigned int* os = info->ostart;
	unsigned int* ol = info->olength;
	int r, g, b, a;

	for (y = h-1, r = 0, g = h, b = g+h, a = b+h;
	     y >= 0;
	     y--, r++, g++, b++, a++) {

	    TRACE (("SGI PIX DATA %8d R", y));
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
		R (dst, x, y) = *r; r += 2;
		G (dst, x, y) = *g; g += 2;
		B (dst, x, y) = *b; b += 2;
		A (dst, x, y) = *a; a += 2;
	    }
	}
    } else {
	unsigned long* os = info->ostart;
	unsigned long* ol = info->olength;
	int r, g, b, a;

	for (y = h-1, r = 0, g = h, b = g+h, a = b+h;
	     y >= 0;
	     y--, r++, g++, b++, a++) {

	    TRACE (("SGI PIX DATA %8d R", y));







|
|







727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
		R (dst, x, y) = *r; r += 2;
		G (dst, x, y) = *g; g += 2;
		B (dst, x, y) = *b; b += 2;
		A (dst, x, y) = *a; a += 2;
	    }
	}
    } else {
	unsigned int* os = info->ostart;
	unsigned int* ol = info->olength;
	int r, g, b, a;

	for (y = h-1, r = 0, g = h, b = g+h, a = b+h;
	     y >= 0;
	     y--, r++, g++, b++, a++) {

	    TRACE (("SGI PIX DATA %8d R", y));
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
    }

    return 1;
}

#ifdef SGI_TRACE
static void
dump_offsets (unsigned long* start, unsigned long* length, int h, int d)
{
    int i,j;

    printf ("SGI RLE Offsets [%dx%d]\n", h, d);
    printf ("SGI ==============\n");

    for (i = 0; i < d; i++) {







|







897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
    }

    return 1;
}

#ifdef SGI_TRACE
static void
dump_offsets (unsigned int* start, unsigned int* length, int h, int d)
{
    int i,j;

    printf ("SGI RLE Offsets [%dx%d]\n", h, d);
    printf ("SGI ==============\n");

    for (i = 0; i < d; i++) {
Changes to format/sgi.h.
111
112
113
114
115
116
117
118
119
120
121
122









123
124
125
126
127
128
129
    unsigned int      h;             /* Image height */
    unsigned int      d;             /* Image depth */
    unsigned int      bpp;           /* #Bytes/Pixel/Channel [1..2] */
    unsigned int      min;           /* Min and max pixel values */
    unsigned int      max;           /* s.a. */
    sgi_storage_type  storage;       /* Type of raster storage */
    sgi_colormap_type mapType;       /* Colormap information */
    unsigned long*    ostart;        /* Pointer to scan line offsets (RLE only) */
    unsigned long*    olength;       /* Pointer to scan line lengths (ditto) */
    crimp_buffer*     input;         /* buffer holding the image */
} sgi_info;










/*
 * Main functions.
 */

extern int
sgi_read_header (Tcl_Interp*     interp,
		 crimp_buffer*   buf,







|
|



>
>
>
>
>
>
>
>
>







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    unsigned int      h;             /* Image height */
    unsigned int      d;             /* Image depth */
    unsigned int      bpp;           /* #Bytes/Pixel/Channel [1..2] */
    unsigned int      min;           /* Min and max pixel values */
    unsigned int      max;           /* s.a. */
    sgi_storage_type  storage;       /* Type of raster storage */
    sgi_colormap_type mapType;       /* Colormap information */
    unsigned int*     ostart;        /* Pointer to scan line offsets (RLE only) */
    unsigned int*     olength;       /* Pointer to scan line lengths (ditto) */
    crimp_buffer*     input;         /* buffer holding the image */
} sgi_info;

/*
 * BUILD ASSERTION: The structure above assumes that a variable of type 'int'
 * can hold (at least) 4 bytes (ostart, olength). Failure in the line below
 * tells us that this is not true for the chosen combination of OS, compiler,
 * and compiler flags.
 */

CRIMP_BUILD_ASSERT (sizeof(int) >= 4);

/*
 * Main functions.
 */

extern int
sgi_read_header (Tcl_Interp*     interp,
		 crimp_buffer*   buf,
Changes to format/write-grey8-tk.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (imageObj, image, grey8);

/*
 * Fill the Tk image block to match our structure.
 */

pib.pixelPtr  = image->pixel;
pib.width     = image->w;
pib.height    = image->h;
pib.pixelSize = 1;
pib.pitch     = pib.width;
pib.offset[0] = 0;
pib.offset[1] = 0;
pib.offset[2] = 0;
pib.offset[3] = 0;








|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (imageObj, image, grey8);

/*
 * Fill the Tk image block to match our structure.
 */

pib.pixelPtr  = image->pixel;
pib.width     = crimp_w (image);
pib.height    = crimp_h (image);
pib.pixelSize = 1;
pib.pitch     = pib.width;
pib.offset[0] = 0;
pib.offset[1] = 0;
pib.offset[2] = 0;
pib.offset[3] = 0;

Changes to format/write-rgb-tk.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (imageObj, image, rgb);

/*
 * Fill the Tk image block to match our structure.
 */

pib.pixelPtr  = image->pixel;
pib.width     = image->w;
pib.height    = image->h;
pib.pixelSize = 3;
pib.pitch     = 3 * pib.width;
pib.offset[0] = 0;
pib.offset[1] = 1;
pib.offset[2] = 2;
pib.offset[3] = 0;








|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (imageObj, image, rgb);

/*
 * Fill the Tk image block to match our structure.
 */

pib.pixelPtr  = image->pixel;
pib.width     = crimp_w (image);
pib.height    = crimp_h (image);
pib.pixelSize = 3;
pib.pitch     = 3 * pib.width;
pib.offset[0] = 0;
pib.offset[1] = 1;
pib.offset[2] = 2;
pib.offset[3] = 0;

Changes to format/write-rgba-tk.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (imageObj, image, rgba);

/*
 * Fill the Tk image block to match our structure.
 */

pib.pixelPtr  = image->pixel;
pib.width     = image->w;
pib.height    = image->h;
pib.pixelSize = 4;
pib.pitch     = 4 * pib.width;
pib.offset[0] = 0;
pib.offset[1] = 1;
pib.offset[2] = 2;
pib.offset[3] = 3;








|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (imageObj, image, rgba);

/*
 * Fill the Tk image block to match our structure.
 */

pib.pixelPtr  = image->pixel;
pib.width     = crimp_w (image);
pib.height    = crimp_h (image);
pib.pixelSize = 4;
pib.pitch     = 4 * pib.width;
pib.offset[0] = 0;
pib.offset[1] = 1;
pib.offset[2] = 2;
pib.offset[3] = 3;

Changes to operator/add-float-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-float-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-float-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-float-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions.
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_float_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-fpcomplex-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_fpcomplex_fpcomplex.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_fpcomplex_fpcomplex_fpcomplex.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-grey16-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_grey16_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_grey16_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_grey16_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_grey16_grey16_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-grey32-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_grey32_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_grey32_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_grey32_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_grey32_grey32_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/add-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased addition of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) + (b)) / scale) + offset)
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/ahe-grey8.crimp.
16
17
18
19
20
21
22
23




24
25
26
27
28
29
30
crimp_image*     image;
int              xo, yo, xi, yi, n;
int              rowhistogram [256];
int*             colhistogram;

crimp_input (imageObj, image, grey8);

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column







|
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
crimp_image*     image;
int              xo, yo, xi, yi, n;
int              rowhistogram [256];
int*             colhistogram;

crimp_input (imageObj, image, grey8);

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
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
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)

 * <other paper ref> - talking about the fast histogram via sliding window,
 * unclear if they talk abou this method.
 */

colhistogram = CRIMP_ALLOC_ARRAY (image->w * 256, int);
memset (colhistogram,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHIST(xi,value) colhistogram [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
 */
#define UP(xi,value)   COLHIST (xi, value)++







|
|

















|







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
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)

 * <other paper ref> - talking about the fast histogram via sliding window,
 * unclear if they talk abou this method.
 */

colhistogram = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int);
memset (colhistogram,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHIST(xi,value) colhistogram [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
 */
#define UP(xi,value)   COLHIST (xi, value)++
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UP (xi, GREY8 (image, xi, yi));
    }
}

/*
 * Initialization II.
 * Add the first 2*radius+1 column histogram into the initial row histogram.
 */

memset (rowhistogram,'\0', 256 * sizeof(int));
for (xi = 0 ; xi < 2*radius+1; xi++) { ADD (xi); }

/*
 * Now we can start the AHE. The initial histogram is already properly set
 * up for (xo,yo) = (0,0). For the remaining pixels of the first row in the
 * output we can sweep through without having to pull the column histograms
 * down.
 */

GREY8 (result, 0, 0) = crimp_ahe_transfer (rowhistogram, GREY8(image,radius,radius), n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    GREY8 (result, xo, 0) = crimp_ahe_transfer (rowhistogram, GREY8(image,xi,radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogram,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADD (xi);
    }

    GREY8 (result, 0, yo) = crimp_ahe_transfer (rowhistogram, GREY8(image,radius,yi), n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	GREY8 (result, xo, yo) = crimp_ahe_transfer (rowhistogram, GREY8(image,xi,yi), n);
    }
 }

Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|




















|








|









|







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UP (xi, GREY8 (image, xi, yi));
    }
}

/*
 * Initialization II.
 * Add the first 2*radius+1 column histogram into the initial row histogram.
 */

memset (rowhistogram,'\0', 256 * sizeof(int));
for (xi = 0 ; xi < 2*radius+1; xi++) { ADD (xi); }

/*
 * Now we can start the AHE. The initial histogram is already properly set
 * up for (xo,yo) = (0,0). For the remaining pixels of the first row in the
 * output we can sweep through without having to pull the column histograms
 * down.
 */

GREY8 (result, 0, 0) = crimp_ahe_transfer (rowhistogram, GREY8(image,radius,radius), n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    GREY8 (result, xo, 0) = crimp_ahe_transfer (rowhistogram, GREY8(image,xi,radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogram,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADD (xi);
    }

    GREY8 (result, 0, yo) = crimp_ahe_transfer (rowhistogram, GREY8(image,radius,yi), n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	GREY8 (result, xo, yo) = crimp_ahe_transfer (rowhistogram, GREY8(image,xi,yi), n);
    }
 }

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/ahe-hsv.crimp.
16
17
18
19
20
21
22
23




24
25
26
27
28
29
30
crimp_image*     image;
int              xo, yo, xi, yi, n;
int              rowhistogram [256];
int*             colhistogram;

crimp_input (imageObj, image, hsv);

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column







|
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
crimp_image*     image;
int              xo, yo, xi, yi, n;
int              rowhistogram [256];
int*             colhistogram;

crimp_input (imageObj, image, hsv);

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
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
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)

 * <other paper ref> - talking about the fast histogram via sliding window,
 * unclear if they talk abou this method.
 */

colhistogram = CRIMP_ALLOC_ARRAY (image->w * 256, int);
memset (colhistogram,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHIST(xi,value) colhistogram [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
 */
#define UP(xi,value)   COLHIST (xi, value)++







|
|

















|







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
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)

 * <other paper ref> - talking about the fast histogram via sliding window,
 * unclear if they talk abou this method.
 */

colhistogram = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int);
memset (colhistogram,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHIST(xi,value) colhistogram [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
 */
#define UP(xi,value)   COLHIST (xi, value)++
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UP (xi, V (image, xi, yi));
    }
}

/*
 * Initialization II.
 * Add the first 2*radius+1 column histogram into the initial row histogram.







|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UP (xi, V (image, xi, yi));
    }
}

/*
 * Initialization II.
 * Add the first 2*radius+1 column histogram into the initial row histogram.
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
 * output we can sweep through without having to pull the column histograms
 * down.
 */

H (result, 0, 0) = H (image, radius, radius);
S (result, 0, 0) = S (image, radius, radius);
V (result, 0, 0) = crimp_ahe_transfer (rowhistogram, V(image,radius,radius), n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    H (result, xo, 0) = H (image, xi, radius);
    S (result, xo, 0) = S (image, xi, radius);
    V (result, xo, 0) = crimp_ahe_transfer (rowhistogram, V(image,xi,radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogram,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADD (xi);
    }

    V (result, 0, yo) = crimp_ahe_transfer (rowhistogram, V(image,radius,yi), n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = crimp_ahe_transfer (rowhistogram, V(image,xi,yi), n);
    }
 }







|










|









|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
 * output we can sweep through without having to pull the column histograms
 * down.
 */

H (result, 0, 0) = H (image, radius, radius);
S (result, 0, 0) = S (image, radius, radius);
V (result, 0, 0) = crimp_ahe_transfer (rowhistogram, V(image,radius,radius), n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    H (result, xo, 0) = H (image, xi, radius);
    S (result, xo, 0) = S (image, xi, radius);
    V (result, xo, 0) = crimp_ahe_transfer (rowhistogram, V(image,xi,radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogram,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADD (xi);
    }

    V (result, 0, yo) = crimp_ahe_transfer (rowhistogram, V(image,radius,yi), n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = crimp_ahe_transfer (rowhistogram, V(image,xi,yi), n);
    }
 }
Changes to operator/ahe-rgb.crimp.
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
int              rowhistogramb [256];
int*             colhistogramr;
int*             colhistogramg;
int*             colhistogramb;

crimp_input (imageObj, image, rgb);

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramr,'\0', image->w * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramg,'\0', image->w * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramb,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.







|
>
>
>
>



















|
|
|

















|







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
int              rowhistogramb [256];
int*             colhistogramr;
int*             colhistogramg;
int*             colhistogramb;

crimp_input (imageObj, image, rgb);

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramr,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramg,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramb,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
    }
}

/*







|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
    }
}

/*
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
 * output we can sweep through without having to pull the column histograms
 * down.
 */

R (result, 0, 0) = crimp_ahe_transfer (rowhistogramr, R (image, radius, radius), n);
G (result, 0, 0) = crimp_ahe_transfer (rowhistogramg, G (image, radius, radius), n);
B (result, 0, 0) = crimp_ahe_transfer (rowhistogramb, B (image, radius, radius), n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_ahe_transfer (rowhistogramr, R (image, xi, radius), n);
    G (result, xo, 0) = crimp_ahe_transfer (rowhistogramg, G (image, xi, radius), n);
    B (result, xo, 0) = crimp_ahe_transfer (rowhistogramb, B (image, xi, radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
    }

    R (result, 0, yo) = crimp_ahe_transfer (rowhistogramr, R (image, radius, yi), n);
    G (result, 0, yo) = crimp_ahe_transfer (rowhistogramg, G (image, radius, yi), n);
    B (result, 0, yo) = crimp_ahe_transfer (rowhistogramb, B (image, radius, yi), n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_ahe_transfer (rowhistogramr, R (image, xi, yi), n);
	G (result, xo, yo) = crimp_ahe_transfer (rowhistogramg, R (image, xi, yi), n);
	B (result, xo, yo) = crimp_ahe_transfer (rowhistogramb, R (image, xi, yi), n);
    }
 }







|










|















|







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
 * output we can sweep through without having to pull the column histograms
 * down.
 */

R (result, 0, 0) = crimp_ahe_transfer (rowhistogramr, R (image, radius, radius), n);
G (result, 0, 0) = crimp_ahe_transfer (rowhistogramg, G (image, radius, radius), n);
B (result, 0, 0) = crimp_ahe_transfer (rowhistogramb, B (image, radius, radius), n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_ahe_transfer (rowhistogramr, R (image, xi, radius), n);
    G (result, xo, 0) = crimp_ahe_transfer (rowhistogramg, G (image, xi, radius), n);
    B (result, xo, 0) = crimp_ahe_transfer (rowhistogramb, B (image, xi, radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
    }

    R (result, 0, yo) = crimp_ahe_transfer (rowhistogramr, R (image, radius, yi), n);
    G (result, 0, yo) = crimp_ahe_transfer (rowhistogramg, G (image, radius, yi), n);
    B (result, 0, yo) = crimp_ahe_transfer (rowhistogramb, B (image, radius, yi), n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_ahe_transfer (rowhistogramr, R (image, xi, yi), n);
	G (result, xo, yo) = crimp_ahe_transfer (rowhistogramg, R (image, xi, yi), n);
	B (result, xo, yo) = crimp_ahe_transfer (rowhistogramb, R (image, xi, yi), n);
    }
 }
Changes to operator/ahe-rgba.crimp.
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
int*             colhistogramr;
int*             colhistogramg;
int*             colhistogramb;
int*             colhistograma;

crimp_input (imageObj, image, rgba);

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramr,'\0', image->w * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramg,'\0', image->w * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramb,'\0', image->w * 256 * sizeof(int));
colhistograma = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistograma,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]
#define COLHISTA(xi,value) colhistograma [CHINDEX (xi, value)]

/*







|
>
>
>
>



















|
|
|
|

















|







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
int*             colhistogramr;
int*             colhistogramg;
int*             colhistogramb;
int*             colhistograma;

crimp_input (imageObj, image, rgba);

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramr,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramg,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramb,'\0', crimp_w (image) * 256 * sizeof(int));
colhistograma = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistograma,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]
#define COLHISTA(xi,value) colhistograma [CHINDEX (xi, value)]

/*
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
	UPA (xi, A (image, xi, yi));
    }
}








|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
	UPA (xi, A (image, xi, yi));
    }
}

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
 * down.
 */

R (result, 0, 0) = crimp_ahe_transfer (rowhistogramr, R (image, radius, radius), n);
G (result, 0, 0) = crimp_ahe_transfer (rowhistogramg, G (image, radius, radius), n);
B (result, 0, 0) = crimp_ahe_transfer (rowhistogramb, B (image, radius, radius), n);
A (result, 0, 0) = crimp_ahe_transfer (rowhistograma, A (image, radius, radius), n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_ahe_transfer (rowhistogramr, R (image, xi, radius), n);
    G (result, xo, 0) = crimp_ahe_transfer (rowhistogramg, G (image, xi, radius), n);
    B (result, xo, 0) = crimp_ahe_transfer (rowhistogramb, B (image, xi, radius), n);
    A (result, xo, 0) = crimp_ahe_transfer (rowhistograma, A (image, xi, radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    memset (rowhistograma,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
	ADDA (xi);
    }

    R (result, 0, yo) = crimp_ahe_transfer (rowhistogramr, R (image, radius, yi), n);
    G (result, 0, yo) = crimp_ahe_transfer (rowhistogramg, G (image, radius, yi), n);
    B (result, 0, yo) = crimp_ahe_transfer (rowhistogramb, B (image, radius, yi), n);
    A (result, 0, yo) = crimp_ahe_transfer (rowhistograma, A (image, radius, yi), n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_ahe_transfer (rowhistogramr, R (image, xi, yi), n);
	G (result, xo, yo) = crimp_ahe_transfer (rowhistogramg, G (image, xi, yi), n);
	B (result, xo, yo) = crimp_ahe_transfer (rowhistogramb, B (image, xi, yi), n);
	A (result, xo, yo) = crimp_ahe_transfer (rowhistograma, A (image, xi, yi), n);
    }







|











|


















|







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
 * down.
 */

R (result, 0, 0) = crimp_ahe_transfer (rowhistogramr, R (image, radius, radius), n);
G (result, 0, 0) = crimp_ahe_transfer (rowhistogramg, G (image, radius, radius), n);
B (result, 0, 0) = crimp_ahe_transfer (rowhistogramb, B (image, radius, radius), n);
A (result, 0, 0) = crimp_ahe_transfer (rowhistograma, A (image, radius, radius), n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_ahe_transfer (rowhistogramr, R (image, xi, radius), n);
    G (result, xo, 0) = crimp_ahe_transfer (rowhistogramg, G (image, xi, radius), n);
    B (result, xo, 0) = crimp_ahe_transfer (rowhistogramb, B (image, xi, radius), n);
    A (result, xo, 0) = crimp_ahe_transfer (rowhistograma, A (image, xi, radius), n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    memset (rowhistograma,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
	ADDA (xi);
    }

    R (result, 0, yo) = crimp_ahe_transfer (rowhistogramr, R (image, radius, yi), n);
    G (result, 0, yo) = crimp_ahe_transfer (rowhistogramg, G (image, radius, yi), n);
    B (result, 0, yo) = crimp_ahe_transfer (rowhistogramb, B (image, radius, yi), n);
    A (result, 0, yo) = crimp_ahe_transfer (rowhistograma, A (image, radius, yi), n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_ahe_transfer (rowhistogramr, R (image, xi, yi), n);
	G (result, xo, yo) = crimp_ahe_transfer (rowhistogramg, G (image, xi, yi), n);
	B (result, xo, yo) = crimp_ahe_transfer (rowhistogramb, B (image, xi, yi), n);
	A (result, xo, yo) = crimp_ahe_transfer (rowhistograma, A (image, xi, yi), n);
    }
Added operator/alpha-blend-float-float.crimp.




























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
alpha_blend_float_float
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
float alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, float);
crimp_input (imageBackObj, imageB, float);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_float_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	float fore = inf ? FLOATP (imageF, lx - oxf, ly - oyf) : BLACK;
	float back = inb ? FLOATP (imageB, lx - oxb, ly - oyb) : BLACK;

	FLOATP (result, px, py) = MIX (fore, back);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/alpha-blend-fpcomplex-fpcomplex.crimp.




































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
alpha_blend_fpcomplex_fpcomplex
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
float alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, fpcomplex);
crimp_input (imageBackObj, imageB, fpcomplex);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_fpcomplex_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	float forer = inf ? RE (imageF, lx - oxf, ly - oyf) : BLACK;
	float forei = inf ? IM (imageF, lx - oxf, ly - oyf) : BLACK;

	float backr = inb ? RE (imageB, lx - oxb, ly - oyb) : BLACK;
	float backi = inb ? IM (imageB, lx - oxb, ly - oyb) : BLACK;

	RE (result, px, py) = MIX (forer, backr);
	IM (result, px, py) = MIX (forei, backi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/alpha-blend-grey16-grey16.crimp.




























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
alpha_blend_grey16_grey16
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, grey16);
crimp_input (imageBackObj, imageB, grey16);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_grey16_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int fore = inf ? GREY16 (imageF, lx - oxf, ly - oyf) : BLACK;
	int back = inb ? GREY16 (imageB, lx - oxb, ly - oyb) : BLACK;

	GREY16 (result, px, py) = MIX (fore, back);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/alpha-blend-grey32-grey32.crimp.




























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
alpha_blend_grey32_grey32
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, grey32);
crimp_input (imageBackObj, imageB, grey32);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_grey32_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int fore = inf ? GREY32 (imageF, lx - oxf, ly - oyf) : BLACK;
	int back = inb ? GREY32 (imageB, lx - oxb, ly - oyb) : BLACK;

	GREY32 (result, px, py) = MIX (fore, back);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/alpha-blend-grey8-grey8.crimp.
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
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, grey8);
crimp_input (imageBackObj, imageB, grey8);


if (!crimp_eq_dim (imageF, imageB)) {


    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}




result = crimp_new_like (imageF);
ralpha = 255 - alpha;



















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	GREY8 (result, x, y) = MIX (GREY8 (imageF, x, y), GREY8 (imageB, x, y));











    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78







|
>




>
|
>
>
|
|


>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>





>







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
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, grey8);
crimp_input (imageBackObj, imageB, grey8);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_grey8_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int fore = inf ? GREY8 (imageF, lx - oxf, ly - oyf) : BLACK;
	int back = inb ? GREY8 (imageB, lx - oxb, ly - oyb) : BLACK;

	GREY8 (result, px, py) = MIX (fore, back);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-blend-hsv-hsv.crimp.
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
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, hsv);
crimp_input (imageBackObj, imageB, hsv);

if (!crimp_eq_dim (imageF, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;



result = crimp_new_like (imageF);















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	H (result, x, y) = MIX (H (imageF, x, y), H (imageB, x, y));






	S (result, x, y) = MIX (S (imageF, x, y), S (imageB, x, y));



	V (result, x, y) = MIX (V (imageF, x, y), V (imageB, x, y));








    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78







|
>




<
<
<
<
<













>
>
>
|
>
>
>
>

>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>





>







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
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, hsv);
crimp_input (imageBackObj, imageB, hsv);






if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_hsv_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int foreh = inf ? H (imageF, lx - oxf, ly - oyf) : BLACK;
	int fores = inf ? S (imageF, lx - oxf, ly - oyf) : BLACK;
	int forev = inf ? V (imageF, lx - oxf, ly - oyf) : BLACK;

	int backh = inb ? H (imageB, lx - oxb, ly - oyb) : BLACK;
	int backs = inb ? S (imageB, lx - oxb, ly - oyb) : BLACK;
	int backv = inb ? V (imageB, lx - oxb, ly - oyb) : BLACK;


	H (result, px, py) = MIX (foreh, backh);
	S (result, px, py) = MIX (fores, backs);
	V (result, px, py) = MIX (forev, backv);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-blend-rgb-grey8.crimp.
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
alpha_blend_rgb_grey8
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor.

 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, rgb);
crimp_input (imageBackObj, imageB, grey8);

if (!crimp_eq_dim (imageF, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}








result = crimp_new_like (imageF);
ralpha = 255 - alpha;



















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	R (result, x, y) = MIX (R (imageF, x, y), GREY8 (imageB, x, y));






	G (result, x, y) = MIX (G (imageF, x, y), GREY8 (imageB, x, y));



	B (result, x, y) = MIX (B (imageF, x, y), GREY8 (imageB, x, y));





    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78







|
>











|
>




|
|
|

>
>
>
>

>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>





>







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
alpha_blend_rgb_grey8
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor. The result's alpha is the alpha
 * factor attenuated by the background's alpha.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgb);
crimp_input (imageBackObj, imageB, grey8);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
}
/* alpha == 0: Should return background, but have to return RGB, not GREY8.
 * Easiest handled by falling through into the actual mixer. Better would be
 * to have a loop specialized to the operation (clone the GREY8).
 */

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgb_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int forer = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreg = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreb = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;

	int backv = inb ? GREY8 (imageB, lx - oxb, ly - oyb) : BLACK;

	R (result, px, py) = MIX (forer, backv);
	G (result, px, py) = MIX (foreg, backv);
	B (result, px, py) = MIX (foreb, backv);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-blend-rgb-rgb.crimp.
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
alpha_blend_rgb_rgb
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor.

 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, rgb);
crimp_input (imageBackObj, imageB, rgb);


if (!crimp_eq_dim (imageF, imageB)) {


    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}




result = crimp_new_like (imageF);
ralpha = 255 - alpha;



















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	R (result, x, y) = MIX (R (imageF, x, y), R (imageB, x, y));






	G (result, x, y) = MIX (G (imageF, x, y), G (imageB, x, y));



	B (result, x, y) = MIX (B (imageF, x, y), B (imageB, x, y));







    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78







|
>











|
>




>
|
>
>
|
|


>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>





>







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
alpha_blend_rgb_rgb
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor. The result's alpha is the alpha
 * factor attenuated by the background's alpha.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgb);
crimp_input (imageBackObj, imageB, rgb);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgb_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int forer = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreg = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreb = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;

	int backr = inb ? R (imageB, lx - oxb, ly - oyb) : BLACK;
	int backg = inb ? G (imageB, lx - oxb, ly - oyb) : BLACK;
	int backb = inb ? B (imageB, lx - oxb, ly - oyb) : BLACK;

	R (result, px, py) = MIX (forer, backr);
	G (result, px, py) = MIX (foreg, backg);
	B (result, px, py) = MIX (foreb, backb);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-blend-rgb-rgba.crimp.
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
alpha_blend_rgb_rgba
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor.

 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, rgb);
crimp_input (imageBackObj, imageB, rgba);






if (!crimp_eq_dim (imageF, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}




result = crimp_new_like (imageF);
ralpha = 255 - alpha;



















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	R (result, x, y) = MIX (R (imageF, x, y), R (imageB, x, y));






	G (result, x, y) = MIX (G (imageF, x, y), G (imageB, x, y));



	B (result, x, y) = MIX (B (imageF, x, y), B (imageB, x, y));







    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78







|
>











|
>




>
>
>
>
>
|
|
|


>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>





>







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
alpha_blend_rgb_rgba
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor. The result's alpha is the alpha
 * factor attenuated by the background's alpha.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgb);
crimp_input (imageBackObj, imageB, rgba);

/* alpha == 255: Should return foreground, but have to return RGBA, not RGB.
 * Easiest handled by falling through into the actual mixer. Better would be
 * to have a loop specialized to the operation (clone the RGB, and drop the
 * alpha).
 */
if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgb_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int forer = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreg = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreb = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;

	int backr = inb ? R (imageB, lx - oxb, ly - oyb) : BLACK;
	int backg = inb ? G (imageB, lx - oxb, ly - oyb) : BLACK;
	int backb = inb ? B (imageB, lx - oxb, ly - oyb) : BLACK;

	R (result, px, py) = MIX (forer, backr);
	G (result, px, py) = MIX (foreg, backg);
	B (result, px, py) = MIX (foreb, backb);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-blend-rgba-grey8.crimp.
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
alpha_blend_rgba_grey8
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor. The result's alpha is the alpha
 * factor. No attenuation by the background's alpha, as such doesn't
 * exist. Presumed to be TRANSPARENT = No attenuation.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, grey8);

if (!crimp_eq_dim (imageF, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}









result = crimp_new_like (imageF);
ralpha = 255 - alpha;



















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	R (result, x, y) = MIX (R (imageF, x, y), GREY8 (imageB, x, y));






	G (result, x, y) = MIX (G (imageF, x, y), GREY8 (imageB, x, y));




	B (result, x, y) = MIX (B (imageF, x, y), GREY8 (imageB, x, y));






	A (result, x, y) = alpha;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78








|
<











|
>




|
|
|

>
>
>
>
>

>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
|





>







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
alpha_blend_rgba_grey8
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor. The result's alpha is the alpha
 * factor attenuated by the background's alpha.

 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, grey8);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
}
/* alpha == 0: Should return background, but have to return RGBA, not GREY8.
 * Easiest handled by falling through into the actual mixer. Better would be
 * to have a loop specialized to the operation (clone the GREY8, and add
 * constant opaque alpha).
 */

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int forer = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreg = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreb = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;
	int forea = inf ? A (imageF, lx - oxf, ly - oyf) : BLACK;

	int backv = inb ? GREY8 (imageB, lx - oxb, ly - oyb) : BLACK;
	int backa = inb ? OPAQUE : TRANSPARENT;

	R (result, px, py) = MIX (forer, backv);
	G (result, px, py) = MIX (foreg, backv);
	B (result, px, py) = MIX (foreb, backv);
	A (result, px, py) = MIX (forea, backa);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-blend-rgba-rgb.crimp.
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
alpha_blend_rgba_rgb
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor. The result's alpha is the alpha
 * factor. No attenuation by the background's alpha, as such doesn't
 * exist. Presumed to be TRANSPARENT = No attenuation.
 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgb);

if (!crimp_eq_dim (imageF, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}









result = crimp_new_like (imageF);
ralpha = 255 - alpha;



















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	R (result, x, y) = MIX (R (imageF, x, y), R (imageB, x, y));






	G (result, x, y) = MIX (G (imageF, x, y), G (imageB, x, y));




	B (result, x, y) = MIX (B (imageF, x, y), B (imageB, x, y));








	A (result, x, y) = alpha;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78








|
<











|
>




|
|
|

>
>
>
>
>

>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
|





>







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
alpha_blend_rgba_rgb
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj
int alpha

/*
 * Alpha-based blending of two images, foreground, and background, controlled
 * by a scalar (and extern) alpha factor. The result's alpha is the alpha
 * factor attenuated by the background's alpha.

 *
 * alpha is Opacity
 * 255 <=> Fully opaque      <=> imageF
 * 0   <=> Fully transparent <=> imageB
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgb);

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
}
/* alpha == 0: Should return background, but have to return RGBA, not RGB.
 * Easiest handled by falling through into the actual mixer. Better would be
 * to have a loop specialized to the operation (clone the RGB, and add
 * constant opaque alpha).
 */

/*
 * True alpha mixture.
 */

ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int forer = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreg = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreb = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;
	int forea = inf ? A (imageF, lx - oxf, ly - oyf) : BLACK;

	int backr = inb ? R (imageB, lx - oxb, ly - oyb) : BLACK;
	int backg = inb ? G (imageB, lx - oxb, ly - oyb) : BLACK;
	int backb = inb ? B (imageB, lx - oxb, ly - oyb) : BLACK;
	int backa = inb ? OPAQUE : TRANSPARENT;

	R (result, px, py) = MIX (forer, backr);
	G (result, px, py) = MIX (foreg, backg);
	B (result, px, py) = MIX (foreb, backb);
	A (result, px, py) = MIX (forea, backa);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-blend-rgba-rgba.crimp.
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
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y, ralpha;


crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgba);

if (!crimp_eq_dim (imageF, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */

result = crimp_new_like (imageF);
ralpha = 255 - alpha;



















#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)



for (y = 0; y < result->h; y++) {


    for (x = 0; x < result->w; x++) {


	R (result, x, y) = MIX (R (imageF, x, y), R (imageB, x, y));






	G (result, x, y) = MIX (G (imageF, x, y), G (imageB, x, y));




	B (result, x, y) = MIX (B (imageF, x, y), B (imageB, x, y));




	A (result, x, y) = MIX (alpha, A (imageB, x, y));




    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78







|
>




<
<
<
<
<












<


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>





>







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
 *
 * => OUT = F*alpha + B*(1-alpha)
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int ralpha, px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgba);






if (alpha == 255) {
    Tcl_SetObjResult(interp, imageForeObj);
    return TCL_OK;
} else if (alpha == 0) {
    Tcl_SetObjResult(interp, imageBackObj);
    return TCL_OK;
}

/*
 * True alpha mixture.
 */


ralpha = 255 - alpha;

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

#define MIX(fore,back) ((((fore)*alpha) + ((back)*ralpha))/255)

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int forer = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreg = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int foreb = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;
	int forea = inf ? A (imageF, lx - oxf, ly - oyf) : BLACK;

	int backr = inb ? R (imageB, lx - oxb, ly - oyb) : BLACK;
	int backg = inb ? G (imageB, lx - oxb, ly - oyb) : BLACK;
	int backb = inb ? B (imageB, lx - oxb, ly - oyb) : BLACK;
	int backa = inb ? A (imageB, lx - oxb, ly - oyb) : BLACK;

	R (result, px, py) = MIX (forer, backr);
	G (result, px, py) = MIX (foreg, backg);
	B (result, px, py) = MIX (foreb, backb);
	A (result, px, py) = MIX (forea, backa);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
#undef MIX

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/alpha-over-rgba-rgb.crimp.
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
alpha_over_rgba_rgb
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj

/*
 * Alpha-based blending of two images, foreground, and background.  The
 * foreground's alpha channel is used to determine how much of the background
 * is seen. The result's alpha channel is a copy of the input's alpha.
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y;


crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgb);





if (!crimp_eq_dim (imageF, imageB)) {

    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);





    return TCL_ERROR;









}





result = crimp_new_like (imageF);




for (y = 0; y < result->h; y++) {




    for (x = 0; x < result->w; x++) {





	int alpha = A (imageF, x, y);



	/*
	 * alpha is Opacity
	 * 255 <=> Fully opaque      <=> imageF
	 * 0   <=> Fully transparent <=> imageB
	 *
	 * => OUT = F*alpha + B*(1-alpha)
	 */

	R (result, x, y) = (R (imageF, x, y) * alpha + (255 - alpha) * R (imageB, x, y)) / 255;
	G (result, x, y) = (G (imageF, x, y) * alpha + (255 - alpha) * G (imageB, x, y)) / 255;
	B (result, x, y) = (B (imageF, x, y) * alpha + (255 - alpha) * B (imageB, x, y)) / 255;
	A (result, x, y) = alpha;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */













|
>




>
>
>
>
|
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>

>
>
|
>
>

>
|
>
>
>
>
|
>
>
>
>

|
>
>









|
|
|
|







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
alpha_over_rgba_rgb
Tcl_Obj* imageForeObj
Tcl_Obj* imageBackObj

/*
 * Alpha-based blending of two images, foreground, and background.  The
 * foreground's alpha channel is used to determine how much of the background
 * is seen. The result's alpha channel is a copy of the input's alpha.
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgb);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int falpha = inf ? A (imageF, lx - oxf, ly - oyf) : TRANSPARENT;
	int fred   = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int fgreen = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int fblue  = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;

	int bred   = inb ? R (imageB, lx - oxb, ly - oyb) : BLACK;
	int bgreen = inb ? G (imageB, lx - oxb, ly - oyb) : BLACK;
	int bblue  = inb ? B (imageB, lx - oxb, ly - oyb) : BLACK;

	/*
	 * alpha is Opacity
	 * 255 <=> Fully opaque      <=> imageF
	 * 0   <=> Fully transparent <=> imageB
	 *
	 * => OUT = F*alpha + B*(1-alpha)
	 */

	R (result, px, py) = (fred   * falpha + (255 - falpha) * bred  ) / 255;
	G (result, px, py) = (fgreen * falpha + (255 - falpha) * bgreen) / 255;
	B (result, px, py) = (fblue  * falpha + (255 - falpha) * bblue ) / 255;
	A (result, px, py) = falpha;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/alpha-over-rgba-rgba.crimp.
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
 * is seen. The result's alpha is the input's alpha attenuated by the
 * background's alpha.
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int x, y;


crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgba);





if (!crimp_eq_dim (imageF, imageB)) {

    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);





    return TCL_ERROR;









}





result = crimp_new_like (imageF);




for (y = 0; y < result->h; y++) {




    for (x = 0; x < result->w; x++) {





	int alpha = A (imageF, x, y);




	/*
	 * alpha is Opacity
	 * 255 <=> Fully opaque      <=> imageF
	 * 0   <=> Fully transparent <=> imageB
	 *
	 * => OUT = F*alpha + B*(1-alpha)
	 */

	R (result, x, y) = (R (imageF, x, y) * alpha + (255 - alpha) * R (imageB, x, y)) / 255;
	G (result, x, y) = (G (imageF, x, y) * alpha + (255 - alpha) * G (imageB, x, y)) / 255;
	B (result, x, y) = (B (imageF, x, y) * alpha + (255 - alpha) * B (imageB, x, y)) / 255;
	A (result, x, y) = alpha - (alpha * A (imageB, x, y)) / 255;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>




>
>
>
>
|
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>

>
>
|
>
>

>
|
>
>
>
>
|
>
>
>
>

|
>
>
>









|
|
|
|







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
 * is seen. The result's alpha is the input's alpha attenuated by the
 * background's alpha.
 */

crimp_image*     result;
crimp_image*     imageF;
crimp_image*     imageB;
int px, py, oxf, oyf, oxb, oyb;
crimp_geometry bb;

crimp_input (imageForeObj, imageF, rgba);
crimp_input (imageBackObj, imageB, rgba);

/*
 * Compute union area of the two images to process.
 * Note how the images do not have to match in size.
 */

crimp_rect_union (&imageF->geo, &imageB->geo, &bb);

result = crimp_new_rgba_at (bb.x, bb.y, bb.w, bb.h);
oxf = crimp_x (imageF);
oyf = crimp_y (imageF);
oxb = crimp_x (imageB);
oyb = crimp_y (imageB);

/*
 * px, py are physical coordinates in the result, starting from 0.
 * The associated logical coordinates in the 2D plane are
 *  lx = px + x(result)
 *  lx = py + y(result)
 * And when we are inside an input its physical coordinates, from the logical are
 *  px = lx - x(input)
 *  py = ly - y(input)
 */

for (py = 0; py < bb.h; py++) {
    for (px = 0; px < bb.w; px++) {

        int lx = px + bb.x;
        int ly = py + bb.y;

	int inf = crimp_inside (imageF, lx, ly);
	int inb = crimp_inside (imageB, lx, ly);

	/*
	 * The result depends on where we are relative to both input.
	 * Inside of each input we take the respective value of the
	 * pixel. Outside of an input we take BLACK as the value
	 * instead, and TRANSPARENT for the ALPHA.
	 */

	int falpha = inf ? A (imageF, lx - oxf, ly - oyf) : TRANSPARENT;
	int fred   = inf ? R (imageF, lx - oxf, ly - oyf) : BLACK;
	int fgreen = inf ? G (imageF, lx - oxf, ly - oyf) : BLACK;
	int fblue  = inf ? B (imageF, lx - oxf, ly - oyf) : BLACK;

	int balpha = inb ? A (imageB, lx - oxb, ly - oyb) : TRANSPARENT;
	int bred   = inb ? R (imageB, lx - oxb, ly - oyb) : BLACK;
	int bgreen = inb ? G (imageB, lx - oxb, ly - oyb) : BLACK;
	int bblue  = inb ? B (imageB, lx - oxb, ly - oyb) : BLACK;

	/*
	 * alpha is Opacity
	 * 255 <=> Fully opaque      <=> imageF
	 * 0   <=> Fully transparent <=> imageB
	 *
	 * => OUT = F*alpha + B*(1-alpha)
	 */

	R (result, px, py) = (fred   * falpha + (255 - falpha) * bred  ) / 255;
	G (result, px, py) = (fgreen * falpha + (255 - falpha) * bgreen) / 255;
	B (result, px, py) = (fblue  * falpha + (255 - falpha) * bblue ) / 255;
	A (result, px, py) = falpha - (falpha * balpha) / 255;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/atan2-float-float.crimp.
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
atan2_float_float
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, float);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (FLOATP (imageX, x, y),
			  FLOATP (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_float_float_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-float-grey16.crimp.
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
atan2_float_grey16
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, grey16);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (FLOATP (imageX, x, y),
			  GREY16 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_float_grey16_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-float-grey32.crimp.
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
atan2_float_grey32
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, grey32);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (FLOATP (imageX, x, y),
			  GREY32 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_float_grey32_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-float-grey8.crimp.
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
atan2_float_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (FLOATP (imageX, x, y),
			  GREY8  (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_float_grey8_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey16-float.crimp.
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
atan2_grey16_float
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey16);
crimp_input (imageYObj, imageY, float);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageY);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY16 (imageX, x, y),
			  FLOATP (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey16_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey16_float_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey16-grey16.crimp.
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
atan2_grey16_grey16
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey16);
crimp_input (imageYObj, imageY, grey16);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY16 (imageX, x, y),
			  GREY16 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey16_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey16_grey16_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey16-grey32.crimp.
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
atan2_grey16_grey32
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey16);
crimp_input (imageYObj, imageY, grey32);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY16 (imageX, x, y),
			  GREY32 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey16_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey16_grey32_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey16-grey8.crimp.
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
atan2_grey16_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey16);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY16 (imageX, x, y),
			  GREY8  (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey16_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey16_grey8_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey32-float.crimp.
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
atan2_grey32_float
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey32);
crimp_input (imageYObj, imageY, float);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageY);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY32 (imageX, x, y),
			  FLOATP (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey32_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey32_float_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey32-grey16.crimp.
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
atan2_grey32_grey16
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey32);
crimp_input (imageYObj, imageY, grey16);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY32 (imageX, x, y),
			  GREY16 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey32_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey32_grey16_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey32-grey32.crimp.
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
atan2_grey32_grey32
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey32);
crimp_input (imageYObj, imageY, grey32);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY32 (imageX, x, y),
			  GREY32 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey32_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey32_grey32_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey32-grey8.crimp.
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
atan2_grey32_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey32);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY32 (imageX, x, y),
			  GREY8  (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey32_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey32_grey8_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey8-float.crimp.
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
atan2_grey8_float
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey8);
crimp_input (imageYObj, imageY, float);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageY);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY8  (imageX, x, y),
			  FLOATP (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey8_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey8_float_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey8-grey16.crimp.
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
atan2_grey8_grey16
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey8);
crimp_input (imageYObj, imageY, grey16);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY8  (imageX, x, y),
			  GREY16 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey8_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey8_grey16_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey8-grey32.crimp.
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
atan2_grey8_grey32
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey8);
crimp_input (imageYObj, imageY, grey32);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY8  (imageX, x, y),
			  GREY32 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey8_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey8_grey32_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/atan2-grey8-grey8.crimp.
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
atan2_grey8_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Atan2 of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey8);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double a = atan2 (GREY8 (imageX, x, y),
			  GREY8 (imageY, x, y)) * 57.29577951308232087679;
	/* a in -180..0..180 */

	if (a < 0) a = 360+a;
	/* a in 0..360 */

	FLOATP (result, x, y) = a;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<
<
|
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8


















9

10


11







12
13
14
15
16
17
18
atan2_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * atan2() of all pixels of the two input images.
 */



















#define BINOP(x,y)    (atan2((x),(y) * 57.29577951308232087679))

#define BINOP_POST(z) (((z) < 0) ? (360 + (z)) : (z))


#include "binop_grey8_grey8_float.c"








/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/bilateral-grey8.crimp.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 * +4 = Borders for the convolution of the grid.
 *
 * TODO NOTE: The SParis BF code obtains the min and max grey levels from the
 * TODO NOTE: image and uses that for the range, instead of a fixed 256 (Also
 * TODO NOTE: assumes that intensity is in [0,1]).
 */

bgrid_width  = 4 + 1 + (int) ceil (image->w/sigma_space);
bgrid_height = 4 + 1 + (int) ceil (image->w/sigma_space);
bgrid_range  = 4 + 1 + (int) ceil (256/sigma_range);
bgrid_maxdim = MAX (bgrid_width, MAX (bgrid_height, bgrid_range));

/*
 * Phase I. Allocate and initialize the bilateral grid (2 volumes).
 */








|
|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 * +4 = Borders for the convolution of the grid.
 *
 * TODO NOTE: The SParis BF code obtains the min and max grey levels from the
 * TODO NOTE: image and uses that for the range, instead of a fixed 256 (Also
 * TODO NOTE: assumes that intensity is in [0,1]).
 */

bgrid_width  = 4 + 1 + (int) ceil (crimp_w (image)/sigma_space);
bgrid_height = 4 + 1 + (int) ceil (crimp_w (image)/sigma_space);
bgrid_range  = 4 + 1 + (int) ceil (256/sigma_range);
bgrid_maxdim = MAX (bgrid_width, MAX (bgrid_height, bgrid_range));

/*
 * Phase I. Allocate and initialize the bilateral grid (2 volumes).
 */

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    }
}

/*
 * Phase II. Update the bilateral grid with the downsampled image data.
 */

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	double p = GREY8 (image, x, y);

	/* +2 is the offset to keep the borders empty. */

	int xr = 2 + lrint (((double) x) / sigma_space);
	int yr = 2 + lrint (((double) y) / sigma_space);







|
|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    }
}

/*
 * Phase II. Update the bilateral grid with the downsampled image data.
 */

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	double p = GREY8 (image, x, y);

	/* +2 is the offset to keep the borders empty. */

	int xr = 2 + lrint (((double) x) / sigma_space);
	int yr = 2 + lrint (((double) y) / sigma_space);
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
 * interpolation.
 *
 * #define I(a,b,s) ((b) + ((a)-(b))*(s))
 */

#define BETWEEN(a,b,s) ((a)*(s) + (b)*(1-(s)))

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	double winew, wnew, p = GREY8 (image, x, y);

	/* Continuous grid location */
	double xf = 2 + ((double) x) / sigma_space;
	double yf = 2 + ((double) y) / sigma_space;
	double pf = 2 + p / sigma_range;







|
|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
 * interpolation.
 *
 * #define I(a,b,s) ((b) + ((a)-(b))*(s))
 */

#define BETWEEN(a,b,s) ((a)*(s) + (b)*(1-(s)))

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	double winew, wnew, p = GREY8 (image, x, y);

	/* Continuous grid location */
	double xf = 2 + ((double) x) / sigma_space;
	double yf = 2 + ((double) y) / sigma_space;
	double pf = 2 + p / sigma_range;
Changes to operator/cannyinternal.crimp.
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
crimp_image* temp;
crimp_image* result;
int          x, y;
double a, max, sum = 0.0f;

crimp_input (imageMagObj,   imageMag,   float);
crimp_input (imageAngleObj, imageAngle, float);






temp   = crimp_new_like (imageMag);
result = crimp_new_like (imageMag);

/*
 * Initialization of the border pixels not written to by the later phases.
 */

for (y = 0; y < result->h; y++) {
    FLOATP (temp,   0, y)           = BLACK;
    FLOATP (result, 0, y)           = BLACK;
    FLOATP (temp,   result->w-1, y) = BLACK;
    FLOATP (result, result->w-1, y) = BLACK;
}

for (x = 0; x < result->w; x++) {
    FLOATP (temp,   x, 0)           = BLACK;
    FLOATP (result, x, 0)           = BLACK;
    FLOATP (temp,   x, result->h-1) = BLACK;
    FLOATP (result, x, result->h-1) = BLACK;
}

/*
 * Non-maxima suppression, with a dash of thresholding.
 */

for (y = 1; y < result->h-1; y++) {
    for (x = 1; x < result->w-1; x++) {

	a = FLOATP (imageAngle, x, y);

	if      (((a > 67.5f)  && (a <= 112.5f)) ||
		 ((a > 247.5f) && (a <= 292.5f))) {

	    /* The gradient runs mostly vertical, up or down. Take maximum







>
>
>
>
>








|


|
|


|


|
|






|
|







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
crimp_image* temp;
crimp_image* result;
int          x, y;
double a, max, sum = 0.0f;

crimp_input (imageMagObj,   imageMag,   float);
crimp_input (imageAngleObj, imageAngle, float);

if (!crimp_eq_geo (imageMag, imageAngle)) {
    Tcl_SetResult(interp, "Unable to process, expected images of identical geometry", TCL_STATIC);
    return TCL_ERROR;
}

temp   = crimp_new_like (imageMag);
result = crimp_new_like (imageMag);

/*
 * Initialization of the border pixels not written to by the later phases.
 */

for (y = 0; y < crimp_h (result); y++) {
    FLOATP (temp,   0, y)           = BLACK;
    FLOATP (result, 0, y)           = BLACK;
    FLOATP (temp,   crimp_w (result)-1, y) = BLACK;
    FLOATP (result, crimp_w (result)-1, y) = BLACK;
}

for (x = 0; x < crimp_w (result); x++) {
    FLOATP (temp,   x, 0)           = BLACK;
    FLOATP (result, x, 0)           = BLACK;
    FLOATP (temp,   x, crimp_h (result)-1) = BLACK;
    FLOATP (result, x, crimp_h (result)-1) = BLACK;
}

/*
 * Non-maxima suppression, with a dash of thresholding.
 */

for (y = 1; y < crimp_h (result)-1; y++) {
    for (x = 1; x < crimp_w (result)-1; x++) {

	a = FLOATP (imageAngle, x, y);

	if      (((a > 67.5f)  && (a <= 112.5f)) ||
		 ((a > 247.5f) && (a <= 292.5f))) {

	    /* The gradient runs mostly vertical, up or down. Take maximum
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * Hysteresis thresholding. Post-processing through connectivity analysis.
 * Activates all WEAK pixels of temp if they can be connected to a STRONG
 * pixel of the result. Two runs over the images, forward and backward
 * analysis.
 */

for (y = 1; y < result->h - 1; y++) {
    for (x = 1; x < result->w - 1; x++) {
	if (FLOATP (temp, x, y) == WHITE) {
	    if((FLOATP (result, x-1, y-1) == WHITE) ||
	       (FLOATP (result, x-1, y  ) == WHITE) ||
	       (FLOATP (result, x,   y-1) == WHITE) ||
	       (FLOATP (result, x+1, y-1) == WHITE)) {

		FLOATP (result, x, y) = WHITE;
	    } else {
		FLOATP (result, x, y) = BLACK;
	    }
	}
    }
}

for (y = result->h - 2; y > 0; y--) {
    for (x = result->w - 2; x > 0; x--) {
	if (FLOATP (temp, x, y) == WHITE ) {
	    if((FLOATP (result, x-1, y+1) == WHITE) ||
	       (FLOATP (result, x,   y+1) == WHITE) ||
	       (FLOATP (result, x+1, y  ) == WHITE) ||
	       (FLOATP (result, x+1, y+1) == WHITE)) {

		FLOATP (result, x, y) = WHITE;







|
|














|
|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
 * Hysteresis thresholding. Post-processing through connectivity analysis.
 * Activates all WEAK pixels of temp if they can be connected to a STRONG
 * pixel of the result. Two runs over the images, forward and backward
 * analysis.
 */

for (y = 1; y < crimp_h (result) - 1; y++) {
    for (x = 1; x < crimp_w (result) - 1; x++) {
	if (FLOATP (temp, x, y) == WHITE) {
	    if((FLOATP (result, x-1, y-1) == WHITE) ||
	       (FLOATP (result, x-1, y  ) == WHITE) ||
	       (FLOATP (result, x,   y-1) == WHITE) ||
	       (FLOATP (result, x+1, y-1) == WHITE)) {

		FLOATP (result, x, y) = WHITE;
	    } else {
		FLOATP (result, x, y) = BLACK;
	    }
	}
    }
}

for (y = crimp_h (result) - 2; y > 0; y--) {
    for (x = crimp_w (result) - 2; x > 0; x--) {
	if (FLOATP (temp, x, y) == WHITE ) {
	    if((FLOATP (result, x-1, y+1) == WHITE) ||
	       (FLOATP (result, x,   y+1) == WHITE) ||
	       (FLOATP (result, x+1, y  ) == WHITE) ||
	       (FLOATP (result, x+1, y+1) == WHITE)) {

		FLOATP (result, x, y) = WHITE;
Changes to operator/color-combine.crimp.
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
    return TCL_ERROR;
}

wr = FLOATP (combine, 0, 0);
wg = FLOATP (combine, 1, 0);
wb = FLOATP (combine, 2, 0);

result = crimp_new_grey8 (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	double r = CH (image, 0, x, y);
	double g = CH (image, 1, x, y);
	double b = CH (image, 2, x, y);

	double c = r*wr + g*wg + b*wb;








|
>

|
|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    return TCL_ERROR;
}

wr = FLOATP (combine, 0, 0);
wg = FLOATP (combine, 1, 0);
wb = FLOATP (combine, 2, 0);

result = crimp_new_grey8_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	double r = CH (image, 0, x, y);
	double g = CH (image, 1, x, y);
	double b = CH (image, 2, x, y);

	double c = r*wr + g*wg + b*wb;

Changes to operator/color-mix.crimp.
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
    Tcl_SetResult(interp, "bad matrix dimensions, expected 3x3", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

if (image->itype->channels == 4) {
    for (y = 0; y < result->h; y++) {
	for (x = 0; x < result->w; x++) {

	    double r = CH (image, 0, x, y);
	    double g = CH (image, 1, x, y);
	    double b = CH (image, 2, x, y);

	    crimp_la_multiply_matrix_3v (mix, &r, &g, &b);

	    CH (result, 0, x, y)= CLAMP (0, (int) r, 255);
	    CH (result, 1, x, y)= CLAMP (0, (int) g, 255);
	    CH (result, 2, x, y)= CLAMP (0, (int) b, 255);

	    /* The alpha channel is simply copied over */
	    CH (result, 3, x, y)= CH (image, 3, x, y);
	}
    }
} else {
    for (y = 0; y < result->h; y++) {
	for (x = 0; x < result->w; x++) {

	    double r = CH (image, 0, x, y);
	    double g = CH (image, 1, x, y);
	    double b = CH (image, 2, x, y);

	    crimp_la_multiply_matrix_3v (mix, &r, &g, &b);








|
|
















|
|







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
    Tcl_SetResult(interp, "bad matrix dimensions, expected 3x3", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

if (image->itype->channels == 4) {
    for (y = 0; y < crimp_h (result); y++) {
	for (x = 0; x < crimp_w (result); x++) {

	    double r = CH (image, 0, x, y);
	    double g = CH (image, 1, x, y);
	    double b = CH (image, 2, x, y);

	    crimp_la_multiply_matrix_3v (mix, &r, &g, &b);

	    CH (result, 0, x, y)= CLAMP (0, (int) r, 255);
	    CH (result, 1, x, y)= CLAMP (0, (int) g, 255);
	    CH (result, 2, x, y)= CLAMP (0, (int) b, 255);

	    /* The alpha channel is simply copied over */
	    CH (result, 3, x, y)= CH (image, 3, x, y);
	}
    }
} else {
    for (y = 0; y < crimp_h (result); y++) {
	for (x = 0; x < crimp_w (result); x++) {

	    double r = CH (image, 0, x, y);
	    double g = CH (image, 1, x, y);
	    double b = CH (image, 2, x, y);

	    crimp_la_multiply_matrix_3v (mix, &r, &g, &b);

Changes to operator/conjugate-fpcomplex.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

int x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	RE (result, x, y) =   RE (image, x, y);
	IM (result, x, y) = - IM (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

int x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	RE (result, x, y) =   RE (image, x, y);
	IM (result, x, y) = - IM (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/convert-float-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_fpcomplex (image->w, image->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	RE (result, x, y) = FLOATP (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_fpcomplex_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	RE (result, x, y) = FLOATP (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-float-grey16.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey16 (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {
	double f =  FLOATP(image, x, y);
	GREY16 (result, x, y) = CLAMPT (MINVAL, int, f, MAXVAL_GREY16);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey16_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {
	double f =  FLOATP(image, x, y);
	GREY16 (result, x, y) = CLAMPT (MINVAL, int, f, MAXVAL_GREY16);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-float-grey32.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey32 (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {
	double f =  FLOATP(image, x, y);
	GREY32 (result, x, y) = CLAMPT (MINVAL, int, f, MAXVAL_GREY32);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey32_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {
	double f =  FLOATP(image, x, y);
	GREY32 (result, x, y) = CLAMPT (MINVAL, int, f, MAXVAL_GREY32);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-float-grey8.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey8 (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {
	double f =  FLOATP(image, x, y);
	GREY8 (result, x, y) = CLAMPT (MINVAL, int, f, MAXVAL_GREY8);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey8_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {
	double f =  FLOATP(image, x, y);
	GREY8 (result, x, y) = CLAMPT (MINVAL, int, f, MAXVAL_GREY8);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-fpcomplex-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float (image->w, image->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	FLOATP (result, x, y) = RE (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;










|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	FLOATP (result, x, y) = RE (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/convert-grey16-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_float (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = GREY16 (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_float_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = GREY16 (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey16-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_fpcomplex (image->w, image->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	RE (result, x, y) = GREY16 (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_fpcomplex_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	RE (result, x, y) = GREY16 (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey16-grey8.crimp.
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
convert_2grey8_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_grey8 (image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {
	/* Conversion 16 down to 8 keeps the MSB */
	GREY8 (result, x, y) = GREY16 (image, x, y) >> 8;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|
>

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
convert_2grey8_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_grey8_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {
	/* Conversion 16 down to 8 keeps the MSB */
	GREY8 (result, x, y) = GREY16 (image, x, y) >> 8;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey32-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_float (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = GREY32 (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_float_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = GREY32 (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey32-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_fpcomplex (image->w, image->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	RE (result, x, y) = GREY32 (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_fpcomplex_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	RE (result, x, y) = GREY32 (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey32-grey16.crimp.
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
convert_2grey16_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_grey16 (image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {
	/* Conversion 32 down to 16 keeps the MSB */
	GREY16 (result, x, y) = GREY32 (image, x, y) >> 16;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|
>

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
convert_2grey16_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_grey16_at (crimp_x (image), crimp_y (image),
			      crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {
	/* Conversion 32 down to 16 keeps the MSB */
	GREY16 (result, x, y) = GREY32 (image, x, y) >> 16;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey32-grey8.crimp.
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
convert_2grey8_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_grey8 (image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {
	/* Conversion 32 down to 8 keeps the MSB */
	GREY8 (result, x, y) = GREY32 (image, x, y) >> 24;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|
>

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
convert_2grey8_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_grey8_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {
	/* Conversion 32 down to 8 keeps the MSB */
	GREY8 (result, x, y) = GREY32 (image, x, y) >> 24;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey8-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_float (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = GREY8 (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2float_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_float_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = GREY8 (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey8-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_fpcomplex (image->w, image->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	RE (result, x, y) = GREY8 (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2complex_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_fpcomplex_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	RE (result, x, y) = GREY8 (image, x, y);
	IM (result, x, y) = BLACK;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/convert-grey8-hsv.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
crimp_input (colorObj, color, hsv);

if (!crimp_require_dim (color, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for color map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	value = GREY8 (image, x, y);
	H (result, x, y) = H (color, value, 0);
	S (result, x, y) = S (color, value, 0);
	V (result, x, y) = V (color, value, 0);
    }
}







|

|
|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
crimp_input (colorObj, color, hsv);

if (!crimp_require_dim (color, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for color map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	value = GREY8 (image, x, y);
	H (result, x, y) = H (color, value, 0);
	S (result, x, y) = S (color, value, 0);
	V (result, x, y) = V (color, value, 0);
    }
}
Changes to operator/convert-grey8-rgb.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
crimp_input (colorObj, color, rgb);

if (!crimp_require_dim (color, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for color map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	value = GREY8 (image, x, y);
	R (result, x, y) = R (color, value, 0);
	G (result, x, y) = G (color, value, 0);
	B (result, x, y) = B (color, value, 0);
    }
}







|

|
|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
crimp_input (colorObj, color, rgb);

if (!crimp_require_dim (color, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for color map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	value = GREY8 (image, x, y);
	R (result, x, y) = R (color, value, 0);
	G (result, x, y) = G (color, value, 0);
	B (result, x, y) = B (color, value, 0);
    }
}
Changes to operator/convert-grey8-rgba.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
crimp_input (colorObj, color, rgba);

if (!crimp_require_dim (color, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for color map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	value = GREY8 (image, x, y);
	R (result, x, y) = R (color, value, 0);
	G (result, x, y) = G (color, value, 0);
	B (result, x, y) = B (color, value, 0);
	A (result, x, y) = A (color, value, 0);
    }







|

|
|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
crimp_input (colorObj, color, rgba);

if (!crimp_require_dim (color, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for color map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	value = GREY8 (image, x, y);
	R (result, x, y) = R (color, value, 0);
	G (result, x, y) = G (color, value, 0);
	B (result, x, y) = B (color, value, 0);
	A (result, x, y) = A (color, value, 0);
    }
Changes to operator/convert-hsv-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2rgb_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, r, g, b;

crimp_input (imageObj, image, hsv);

result = crimp_new_rgb (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	crimp_color_hsv_to_rgb (H (image, x, y),
				S (image, x, y),
				V (image, x, y),
				&r, &g, &b);

	R (result, x, y) = r;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2rgb_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, r, g, b;

crimp_input (imageObj, image, hsv);

result = crimp_new_rgb_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	crimp_color_hsv_to_rgb (H (image, x, y),
				S (image, x, y),
				V (image, x, y),
				&r, &g, &b);

	R (result, x, y) = r;
Changes to operator/convert-hsv-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2rgba_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, r, g, b;

crimp_input (imageObj, image, hsv);

result = crimp_new_rgba (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	crimp_color_hsv_to_rgb (H (image, x, y),
				S (image, x, y),
				V (image, x, y),
				&r, &g, &b);

	R (result, x, y) = r;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2rgba_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, r, g, b;

crimp_input (imageObj, image, hsv);

result = crimp_new_rgba_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	crimp_color_hsv_to_rgb (H (image, x, y),
				S (image, x, y),
				V (image, x, y),
				&r, &g, &b);

	R (result, x, y) = r;
Changes to operator/convert-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2grey8_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_grey8 (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * This conversion to a grey scale is based on the ITU-R 601-2 luma
	 * transform computing the "luminosity" of each pixel.
	 *
	 * Note: The factors for R, G, and B add up to 1000, which means that
	 * after the scaling division the result is in the range 0..255









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2grey8_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_grey8_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * This conversion to a grey scale is based on the ITU-R 601-2 luma
	 * transform computing the "luminosity" of each pixel.
	 *
	 * Note: The factors for R, G, and B add up to 1000, which means that
	 * after the scaling division the result is in the range 0..255
Changes to operator/convert-rgb-hsv.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2hsv_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, h, s, v;

crimp_input (imageObj, image, rgb);

result = crimp_new_hsv (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	crimp_color_rgb_to_hsv (R (image, x, y),
				G (image, x, y),
				B (image, x, y),
				&h, &s, &v);

	H (result, x, y) = h;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2hsv_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, h, s, v;

crimp_input (imageObj, image, rgb);

result = crimp_new_hsv_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	crimp_color_rgb_to_hsv (R (image, x, y),
				G (image, x, y),
				B (image, x, y),
				&h, &s, &v);

	H (result, x, y) = h;
Changes to operator/convert-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2grey8_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_grey8 (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * This conversion to a grey scale is based on the ITU-R 601-2 luma
	 * transform computing the "luminosity" of each pixel.
	 *
	 * Note: The factors for R, G, and B add up to 1000, which means that
	 * after the scaling division the result is in the range 0..255









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2grey8_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_grey8_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * This conversion to a grey scale is based on the ITU-R 601-2 luma
	 * transform computing the "luminosity" of each pixel.
	 *
	 * Note: The factors for R, G, and B add up to 1000, which means that
	 * after the scaling division the result is in the range 0..255
Changes to operator/convert-rgba-hsv.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2hsv_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, h, s, v;

crimp_input (imageObj, image, rgba);

result = crimp_new_hsv (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	crimp_color_rgb_to_hsv (R (image, x, y),
				G (image, x, y),
				B (image, x, y),
				&h, &s, &v);

	H (result, x, y) = h;









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
convert_2hsv_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y, h, s, v;

crimp_input (imageObj, image, rgba);

result = crimp_new_hsv_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	crimp_color_rgb_to_hsv (R (image, x, y),
				G (image, x, y),
				B (image, x, y),
				&h, &s, &v);

	H (result, x, y) = h;
Changes to operator/convert-rgba-rgb.crimp.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_rgb (image->w, image->h);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
    }
}








|

|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_rgb_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
    }
}

Changes to operator/convolve-float-float.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    float);
crimp_input (kernelImageObj,   kernel,   float);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * FLOATP (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; FLOATP (result, xo, yo) = sum;
    }







|
|




|
|

|

|
|








|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    float);
crimp_input (kernelImageObj,   kernel,   float);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * FLOATP (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; FLOATP (result, xo, yo) = sum;
    }
Changes to operator/convolve-float-grey16.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey16);
crimp_input (kernelImageObj,   kernel,   float);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;
	int    isum;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * GREY16 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; isum = sum;
	GREY16 (result, xo, yo) = CLAMP (0, isum, MAXVAL_GREY16);







|
|




|
|

|

|
|









|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey16);
crimp_input (kernelImageObj,   kernel,   float);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;
	int    isum;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * GREY16 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; isum = sum;
	GREY16 (result, xo, yo) = CLAMP (0, isum, MAXVAL_GREY16);
Changes to operator/convolve-float-grey32.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey32);
crimp_input (kernelImageObj,   kernel,   float);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * GREY32 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset;
	GREY32 (result, xo, yo) = (int) CLAMP (0.0, sum, ((double) MAXVAL_GREY32));







|
|




|
|

|

|
|








|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey32);
crimp_input (kernelImageObj,   kernel,   float);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * GREY32 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset;
	GREY32 (result, xo, yo) = (int) CLAMP (0.0, sum, ((double) MAXVAL_GREY32));
Changes to operator/convolve-float-grey8.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey8);
crimp_input (kernelImageObj,   kernel,   float);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;
	int    isum;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * GREY8 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; isum = sum;
	GREY8 (result, xo, yo) = CLAMP (0, isum, MAXVAL_GREY8);







|
|




|
|

|

|
|









|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey8);
crimp_input (kernelImageObj,   kernel,   float);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;
	int    isum;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += FLOATP (kernel, xk, yk) * GREY8 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; isum = sum;
	GREY8 (result, xo, yo) = CLAMP (0, isum, MAXVAL_GREY8);
Changes to operator/convolve-float-hsv.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    hsv);
crimp_input (kernelImageObj,   kernel,   float);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sumh = 0; int isumh;
	double sums = 0; int isums;
	double sumv = 0; int isumv;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sumh += FLOATP (kernel, xk, yk) * H (image, xi-dx, yi-dy);
		sums += FLOATP (kernel, xk, yk) * S (image, xi-dx, yi-dy);
		sumv += FLOATP (kernel, xk, yk) * V (image, xi-dx, yi-dy);
	    }
	}








|
|




|
|

|

|
|










|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    hsv);
crimp_input (kernelImageObj,   kernel,   float);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sumh = 0; int isumh;
	double sums = 0; int isums;
	double sumv = 0; int isumv;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sumh += FLOATP (kernel, xk, yk) * H (image, xi-dx, yi-dy);
		sums += FLOATP (kernel, xk, yk) * S (image, xi-dx, yi-dy);
		sumv += FLOATP (kernel, xk, yk) * V (image, xi-dx, yi-dy);
	    }
	}

Changes to operator/convolve-float-rgb.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgb);
crimp_input (kernelImageObj,   kernel,   float);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sumr = 0; int isumr;
	double sumg = 0; int isumg;
	double sumb = 0; int isumb;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sumr += FLOATP (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += FLOATP (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += FLOATP (kernel, xk, yk) * B (image, xi-dx, yi-dy);
	    }
	}








|
|




|
|

|

|
|










|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgb);
crimp_input (kernelImageObj,   kernel,   float);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sumr = 0; int isumr;
	double sumg = 0; int isumg;
	double sumb = 0; int isumb;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sumr += FLOATP (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += FLOATP (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += FLOATP (kernel, xk, yk) * B (image, xi-dx, yi-dy);
	    }
	}

Changes to operator/convolve-float-rgba.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgba);
crimp_input (kernelImageObj,   kernel,   float);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sumr = 0; int isumr;
	double sumg = 0; int isumg;
	double sumb = 0; int isumb;
	double suma = 0; int isuma;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sumr += FLOATP (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += FLOATP (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += FLOATP (kernel, xk, yk) * B (image, xi-dx, yi-dy);
		suma += FLOATP (kernel, xk, yk) * A (image, xi-dx, yi-dy);
	    }
	}







|
|




|
|

|

|
|











|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgba);
crimp_input (kernelImageObj,   kernel,   float);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sumr = 0; int isumr;
	double sumg = 0; int isumg;
	double sumb = 0; int isumb;
	double suma = 0; int isuma;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sumr += FLOATP (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += FLOATP (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += FLOATP (kernel, xk, yk) * B (image, xi-dx, yi-dy);
		suma += FLOATP (kernel, xk, yk) * A (image, xi-dx, yi-dy);
	    }
	}
Changes to operator/convolve-sgrey8-float.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    float);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * FLOATP (image, xi-dx, yi-dy);
	    }
	}

	FLOATP (result, xo, yo) = offset + sum/scale;
    }







|
|




|
|

|

|
|








|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    float);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	double sum = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * FLOATP (image, xi-dx, yi-dy);
	    }
	}

	FLOATP (result, xo, yo) = offset + sum/scale;
    }
Changes to operator/convolve-sgrey8-grey16.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey16);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sum = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * GREY16 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; GREY16 (result, xo, yo) = CLAMP (0, sum, 255);
    }







|
|




|
|

|

|
|








|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey16);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sum = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * GREY16 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; GREY16 (result, xo, yo) = CLAMP (0, sum, 255);
    }
Changes to operator/convolve-sgrey8-grey32.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey32);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sum = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * GREY32 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; GREY32 (result, xo, yo) = CLAMP (0, sum, 255);
    }







|
|




|
|

|

|
|








|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey32);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sum = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * GREY32 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; GREY32 (result, xo, yo) = CLAMP (0, sum, 255);
    }
Changes to operator/convolve-sgrey8-grey8.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey8);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sum = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * GREY8 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; GREY8 (result, xo, yo) = CLAMP (0, sum, 255);
    }







|
|




|
|

|

|
|








|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    grey8);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sum = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sum += SGREY8 (kernel, xk, yk) * GREY8 (image, xi-dx, yi-dy);
	    }
	}

	sum /= scale; sum += offset; GREY8 (result, xo, yo) = CLAMP (0, sum, 255);
    }
Changes to operator/convolve-sgrey8-hsv.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    hsv);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sumh = 0;
	int sums = 0;
	int sumv = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sumh += SGREY8 (kernel, xk, yk) * H (image, xi-dx, yi-dy);
		sums += SGREY8 (kernel, xk, yk) * S (image, xi-dx, yi-dy);
		sumv += SGREY8 (kernel, xk, yk) * V (image, xi-dx, yi-dy);
	    }
	}








|
|




|
|

|

|
|










|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    hsv);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sumh = 0;
	int sums = 0;
	int sumv = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sumh += SGREY8 (kernel, xk, yk) * H (image, xi-dx, yi-dy);
		sums += SGREY8 (kernel, xk, yk) * S (image, xi-dx, yi-dy);
		sumv += SGREY8 (kernel, xk, yk) * V (image, xi-dx, yi-dy);
	    }
	}

Changes to operator/convolve-sgrey8-rgb.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgb);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sumr = 0;
	int sumg = 0;
	int sumb = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sumr += SGREY8 (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += SGREY8 (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += SGREY8 (kernel, xk, yk) * B (image, xi-dx, yi-dy);
	    }
	}








|
|




|
|

|

|
|










|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgb);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sumr = 0;
	int sumg = 0;
	int sumb = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sumr += SGREY8 (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += SGREY8 (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += SGREY8 (kernel, xk, yk) * B (image, xi-dx, yi-dy);
	    }
	}

Changes to operator/convolve-sgrey8-rgba.crimp.
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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgba);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((kernel->w % 2) == 0) ||
    ((kernel->h % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = kernel->w/2;
kh = kernel->h/2;

result = crimp_new (image->itype, image->w - 2*kw, image->h - 2*kh);

for (yo = 0, yi = kh; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = kw; xo < result->w; xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sumr = 0;
	int sumg = 0;
	int sumb = 0;
	int suma = 0;

	for (yk = 0, dy = -kh; yk < kernel->h; yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < kernel->w; xk++, dx++) {

		sumr += SGREY8 (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += SGREY8 (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += SGREY8 (kernel, xk, yk) * B (image, xi-dx, yi-dy);
		suma += SGREY8 (kernel, xk, yk) * A (image, xi-dx, yi-dy);
	    }
	}







|
|




|
|

|

|
|











|
|







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
crimp_image*     image;
crimp_image*     kernel;
int              xo, yo, xi, yi, xk, yk, dx, dy, kw, kh;

crimp_input (imageObj,         image,    rgba);
crimp_input (kernelImageObj,   kernel,   grey8);

if (((crimp_w (kernel) % 2) == 0) ||
    ((crimp_h (kernel) % 2) == 0)) {
    Tcl_SetResult(interp, "bad kernel dimensions, expected odd size", TCL_STATIC);
    return TCL_ERROR;
}

kw = crimp_w (kernel)/2;
kh = crimp_h (kernel)/2;

result = crimp_new_at (image->itype, crimp_x (image) + kw, crimp_y (image) + kh, crimp_w (image) - 2*kw, crimp_h (image) - 2*kh);

for (yo = 0, yi = kh; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = kw; xo < crimp_w (result); xo++, xi++) {

	/*
	 * We convolve all channels with the same kernel, but otherwise
	 * identically
	 */

	int sumr = 0;
	int sumg = 0;
	int sumb = 0;
	int suma = 0;

	for (yk = 0, dy = -kh; yk < crimp_h (kernel); yk++, dy++) {
	    for (xk = 0, dx = -kw; xk < crimp_w (kernel); xk++, dx++) {

		sumr += SGREY8 (kernel, xk, yk) * R (image, xi-dx, yi-dy);
		sumg += SGREY8 (kernel, xk, yk) * G (image, xi-dx, yi-dy);
		sumb += SGREY8 (kernel, xk, yk) * B (image, xi-dx, yi-dy);
		suma += SGREY8 (kernel, xk, yk) * A (image, xi-dx, yi-dy);
	    }
	}
Changes to operator/crop-float.crimp.
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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, float);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > image->w) || ((hn + hs) > image->h)) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - ww - we, image->h - hn - hs);





/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = ww; xo < result->w; xo++, xi++) {
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;








|




|
>
>
>
>





|
|







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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, float);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > crimp_w (image)) || ((hn + hs) > crimp_h (image))) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + ww,
		       crimp_y (image) + hn,
		       crimp_w (image) - ww - we,
		       crimp_h (image) - hn - hs);

/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = ww; xo < crimp_w (result); xo++, xi++) {
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/crop-grey16.crimp.
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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, grey16);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > image->w) || ((hn + hs) > image->h)) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - ww - we, image->h - hn - hs);





/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = ww; xo < result->w; xo++, xi++) {
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;








|




|
>
>
>
>





|
|







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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, grey16);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > crimp_w (image)) || ((hn + hs) > crimp_h (image))) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + ww,
		       crimp_y (image) + hn,
		       crimp_w (image) - ww - we,
		       crimp_h (image) - hn - hs);

/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = ww; xo < crimp_w (result); xo++, xi++) {
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/crop-grey32.crimp.
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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, grey32);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > image->w) || ((hn + hs) > image->h)) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - ww - we, image->h - hn - hs);





/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = ww; xo < result->w; xo++, xi++) {
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;








|




|
>
>
>
>





|
|







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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, grey32);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > crimp_w (image)) || ((hn + hs) > crimp_h (image))) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + ww,
		       crimp_y (image) + hn,
		       crimp_w (image) - ww - we,
		       crimp_h (image) - hn - hs);

/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = ww; xo < crimp_w (result); xo++, xi++) {
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/crop-grey8.crimp.
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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, grey8);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > image->w) || ((hn + hs) > image->h)) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - ww - we, image->h - hn - hs);





/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = ww; xo < result->w; xo++, xi++) {
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;








|




|
>
>
>
>





|
|







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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, grey8);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > crimp_w (image)) || ((hn + hs) > crimp_h (image))) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + ww,
		       crimp_y (image) + hn,
		       crimp_w (image) - ww - we,
		       crimp_h (image) - hn - hs);

/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = ww; xo < crimp_w (result); xo++, xi++) {
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/crop-hsv.crimp.
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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, hsv);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > image->w) || ((hn + hs) > image->h)) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - ww - we, image->h - hn - hs);





/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = ww; xo < result->w; xo++, xi++) {
	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = V (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|




|
>
>
>
>





|
|







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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, hsv);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > crimp_w (image)) || ((hn + hs) > crimp_h (image))) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + ww,
		       crimp_y (image) + hn,
		       crimp_w (image) - ww - we,
		       crimp_h (image) - hn - hs);

/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = ww; xo < crimp_w (result); xo++, xi++) {
	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = V (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/crop-rgb.crimp.
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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, rgb);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > image->w) || ((hn + hs) > image->h)) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - ww - we, image->h - hn - hs);





/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = ww; xo < result->w; xo++, xi++) {
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|




|
>
>
>
>





|
|







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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, rgb);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > crimp_w (image)) || ((hn + hs) > crimp_h (image))) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + ww,
		       crimp_y (image) + hn,
		       crimp_w (image) - ww - we,
		       crimp_h (image) - hn - hs);

/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = ww; xo < crimp_w (result); xo++, xi++) {
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/crop-rgba.crimp.
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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, rgba);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > image->w) || ((hn + hs) > image->h)) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - ww - we, image->h - hn - hs);





/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = ww; xo < result->w; xo++, xi++) {
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
	A (result, xo, yo) = A (image, xi, yi);
    }
}








|




|
>
>
>
>





|
|







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
int          xo, yo, xi, yi;

crimp_input (imageObj, image, rgba);

if ((ww < 0) || (hn < 0) || (we < 0) || (hs < 0)) {
    Tcl_SetResult(interp, "bad image border size, expected non-negative values", TCL_STATIC);
    return TCL_ERROR;
} else if (((ww + we) > crimp_w (image)) || ((hn + hs) > crimp_h (image))) {
    Tcl_SetResult(interp, "bad image border size, larger than image dimensions", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + ww,
		       crimp_y (image) + hn,
		       crimp_w (image) - ww - we,
		       crimp_h (image) - hn - hs);

/*
 * Copy the un-cropped part of the input image.
 */

for (yo = 0, yi = hn; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = ww; xo < crimp_w (result); xo++, xi++) {
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
	A (result, xo, yo) = A (image, xi, yi);
    }
}

Added operator/cut-float.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_float
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_float.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/cut-fpcomplex.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_fpcomplex
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_fpcomplex.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/cut-grey16.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_grey16
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_grey16.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/cut-grey32.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_grey32
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_grey32.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/cut-grey8.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_grey8
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_grey8.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/cut-hsv.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_hsv
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_hsv.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/cut-rgb.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_rgb
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_rgb.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/cut-rgba.crimp.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cut_rgba
Tcl_Obj* imageObj
int x
int y
int w
int h

#define UNOP(a) (a)
#include "unop_rgba.c"
#undef UNOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/difference-float-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-float-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-float-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-float-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (fabs((a) - (b)))
#include "binop_float_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/difference-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
difference_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise absolute difference of two images. The images have
 * to have equal dimensions.
 */

#define BINOP(a,b) (abs((a) - (b)))
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-float-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-float-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-float-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-float-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_float_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-fpcomplex-fpcomplex.crimp.
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

div_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel wise multiplication of two images. The images have to
 * have equal dimensions.
 */

crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;
float temp;

crimp_input (imageAObj, imageA,fpcomplex);
crimp_input (imageBObj, imageB,fpcomplex);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	temp = pow(RE (imageB, x, y) , 2) + pow(IM (imageB, x, y) , 2) ;
	temp = fabs(temp) <= pow(2,-24) ? WHITE : temp ;

	RE (result, x, y) = (( RE (imageA, x, y) * RE (imageB, x, y) ) + ( IM (imageA, x, y)  * IM (imageB, x, y) ) ) / temp ;
	IM (result, x, y) = (( RE (imageB, x, y) * IM (imageA, x, y) ) - ( RE (imageA, x, y)  * IM (imageB, x, y) ) ) / temp ;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
 
 






|
<


<
<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
|
|
<
<
<
<
|
<
<
>









|
|
>
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
div_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel wise division of two images.

 */






#define BINOP_GLOBAL(ar,ai,br,bi)			\


    double temp;					\




    temp = pow ((br),2) + pow ((bi),2);			\





    temp = fabs(temp) <= pow(2,-24) ? WHITE : temp
#define BINOP_RE(ar,ai,br,bi) ((((ar) * (br)) + ((ai) * (bi))) / temp)




#define BINOP_IM(ar,ai,br,bi) ((((br) * (ai)) - ((ar) * (bi))) / temp)


#include "binop_fpcomplex_fpcomplex_fpcomplex2.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */



Changes to operator/div-grey16-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey16_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey16_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_grey16_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-grey32-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey32_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey32_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_grey32_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-grey8-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) (((fabs(b) <= pow(2,-24) ? WHITE : ((a) / (b))) / scale) + offset)
#include "binop_grey8_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-grey8-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_grey8_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-grey8-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_grey8_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_grey8_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-rgb-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgb_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgb_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgb_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/div-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
div_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((b) == 0 ? WHITE : (MAXVAL_GREY8 * (a) / (b))) / scale) + offset)
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/downsample-float.crimp.
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h/factor);



for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
>
>

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype,
		       crimp_x (image), crimp_y (image),
		       crimp_w (image)/factor, crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsample-grey16.crimp.
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h/factor);



for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
>
>

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype,
		       crimp_x (image), crimp_y (image),
		       crimp_w (image)/factor, crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsample-grey32.crimp.
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h/factor);



for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
>
>

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype,
		       crimp_x (image), crimp_y (image),
		       crimp_w (image)/factor, crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsample-grey8.crimp.
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h/factor);



for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
>
>

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype,
		       crimp_x (image), crimp_y (image),
		       crimp_w (image)/factor, crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsample-hsv.crimp.
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h/factor);



for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = V (image, xi, yi);
    }
}








|
>
>

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype,
		       crimp_x (image), crimp_y (image),
		       crimp_w (image)/factor, crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = V (image, xi, yi);
    }
}

Changes to operator/downsample-rgb.crimp.
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h/factor);



for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
    }
}








|
>
>

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype,
		       crimp_x (image), crimp_y (image),
		       crimp_w (image)/factor, crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
    }
}

Changes to operator/downsample-rgba.crimp.
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h/factor);



for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
	A (result, xo, yo) = A (image, xi, yi);
    }
}







|
>
>

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype,
		       crimp_x (image), crimp_y (image),
		       crimp_w (image)/factor, crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
	A (result, xo, yo) = A (image, xi, yi);
    }
}
Changes to operator/downsamplex-float.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h);

for (y = 0; y < result->h; y++) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	FLOATP (result, xo, y) = FLOATP (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)/factor, crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	FLOATP (result, xo, y) = FLOATP (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsamplex-grey16.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h);

for (y = 0; y < result->h; y++) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	GREY16 (result, xo, y) = GREY16 (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)/factor, crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	GREY16 (result, xo, y) = GREY16 (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsamplex-grey32.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h);

for (y = 0; y < result->h; y++) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	GREY32 (result, xo, y) = GREY32 (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)/factor, crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	GREY32 (result, xo, y) = GREY32 (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsamplex-grey8.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h);

for (y = 0; y < result->h; y++) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	GREY8 (result, xo, y) = GREY8 (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)/factor, crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	GREY8 (result, xo, y) = GREY8 (image, xi, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsamplex-hsv.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h);

for (y = 0; y < result->h; y++) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	H (result, xo, y) = H (image, xi, y);
	S (result, xo, y) = S (image, xi, y);
	V (result, xo, y) = V (image, xi, y);
    }
}








|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)/factor, crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	H (result, xo, y) = H (image, xi, y);
	S (result, xo, y) = S (image, xi, y);
	V (result, xo, y) = V (image, xi, y);
    }
}

Changes to operator/downsamplex-rgb.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h);

for (y = 0; y < result->h; y++) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);
    }
}








|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)/factor, crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);
    }
}

Changes to operator/downsamplex-rgba.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w/factor, image->h);

for (y = 0; y < result->h; y++) {
    for (xo = 0, xi = 0; xo < result->w; xo++, xi += factor) {

	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);
	A (result, xo, y) = A (image, xi, y);
    }
}







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)/factor, crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (xo = 0, xi = 0; xo < crimp_w (result); xo++, xi += factor) {

	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);
	A (result, xo, y) = A (image, xi, y);
    }
}
Changes to operator/downsampley-float.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h/factor);

for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, yo) = FLOATP (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, yo) = FLOATP (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsampley-grey16.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h/factor);

for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (x = 0; x < result->w; x++) {

	GREY16 (result, x, yo) = GREY16 (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY16 (result, x, yo) = GREY16 (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsampley-grey32.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h/factor);

for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (x = 0; x < result->w; x++) {

	GREY32 (result, x, yo) = GREY32 (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY32 (result, x, yo) = GREY32 (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsampley-grey8.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h/factor);

for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (x = 0; x < result->w; x++) {

	GREY8 (result, x, yo) = GREY8 (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY8 (result, x, yo) = GREY8 (image, x, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/downsampley-hsv.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h/factor);

for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (x = 0; x < result->w; x++) {

	H (result, x, yo) = H (image, x, yi);
	S (result, x, yo) = S (image, x, yi);
	V (result, x, yo) = V (image, x, yi);
    }
}








|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (x = 0; x < crimp_w (result); x++) {

	H (result, x, yo) = H (image, x, yi);
	S (result, x, yo) = S (image, x, yi);
	V (result, x, yo) = V (image, x, yi);
    }
}

Changes to operator/downsampley-rgb.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h/factor);

for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (x = 0; x < result->w; x++) {

	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
    }
}








|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (x = 0; x < crimp_w (result); x++) {

	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
    }
}

Changes to operator/downsampley-rgba.crimp.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h/factor);

for (yo = 0, yi = 0; yo < result->h; yo++, yi += factor) {
    for (x = 0; x < result->w; x++) {

	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
	A (result, x, yo) = A (image, x, yi);
    }
}







|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)/factor);

for (yo = 0, yi = 0; yo < crimp_h (result); yo++, yi += factor) {
    for (x = 0; x < crimp_w (result); x++) {

	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
	A (result, x, yo) = A (image, x, yi);
    }
}
Changes to operator/euclidean_distance_map_float.crimp.
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
32

/* Process input */

crimp_input(imageObj, image, float);

/* Make the distance map */

result = crimp_new_float(image->w, image->h);

EuclideanDistanceMap2D(image->h, image->w, (float*) image->pixel,
		       (float*)result->pixel);

/* Return segmented image to caller */

Tcl_SetObjResult(interp, crimp_new_image_obj(result));
return TCL_OK;








|
>
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

/* Process input */

crimp_input(imageObj, image, float);

/* Make the distance map */

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));
EuclideanDistanceMap2D(crimp_h (image), crimp_w (image), (float*) image->pixel,
		       (float*)result->pixel);

/* Return segmented image to caller */

Tcl_SetObjResult(interp, crimp_new_image_obj(result));
return TCL_OK;

Changes to operator/exp-float.crimp.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = exp (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, y) = exp (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/expand-float-extend.crimp.
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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= image->w) { xb = (image->w-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= image->h) { yb = (image->h-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = FLOATP (image, xi, yi) - FLOATP (image, xb, yb);	   \
								   \
	FLOATP (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }







|


|



|





|







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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= crimp_w (image)) { xb = (crimp_w (image)-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= crimp_h (image)) { yb = (crimp_h (image)-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = FLOATP (image, xi, yi) - FLOATP (image, xb, yb);	   \
								   \
	FLOATP (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }
Changes to operator/expand-float-mirror.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\







|





|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-float-replicate.crimp.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= image->w) { xi = (image->w-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= image->h) { yi = (image->h-1); } \
							\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi); \
    }







|


|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= crimp_w (image)) { xi = (crimp_w (image)-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= crimp_h (image)) { yi = (crimp_h (image)-1); } \
							\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi); \
    }
Changes to operator/expand-float-wrap.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += image->w; }	\
	while (yi < 0) { yi += image->h; }	\
	xi %= image->w;				\
	yi %= image->h;				\
						\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi); \
    }







|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += crimp_w (image); }	\
	while (yi < 0) { yi += crimp_h (image); }	\
	xi %= crimp_w (image);				\
	yi %= crimp_h (image);				\
						\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi); \
    }
Changes to operator/expand-grey16-extend.crimp.
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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= image->w) { xb = (image->w-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= image->h) { yb = (image->h-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = GREY16 (image, xi, yi) - GREY16 (image, xb, yb);	   \
								   \
	GREY16 (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }







|


|



|





|







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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= crimp_w (image)) { xb = (crimp_w (image)-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= crimp_h (image)) { yb = (crimp_h (image)-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = GREY16 (image, xi, yi) - GREY16 (image, xb, yb);	   \
								   \
	GREY16 (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }
Changes to operator/expand-grey16-mirror.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\







|





|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-grey16-replicate.crimp.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= image->w) { xi = (image->w-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= image->h) { yi = (image->h-1); } \
							\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi); \
    }







|


|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= crimp_w (image)) { xi = (crimp_w (image)-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= crimp_h (image)) { yi = (crimp_h (image)-1); } \
							\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi); \
    }
Changes to operator/expand-grey16-wrap.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += image->w; }	\
	while (yi < 0) { yi += image->h; }	\
	xi %= image->w;				\
	yi %= image->h;				\
						\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi); \
    }







|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += crimp_w (image); }	\
	while (yi < 0) { yi += crimp_h (image); }	\
	xi %= crimp_w (image);				\
	yi %= crimp_h (image);				\
						\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi); \
    }
Changes to operator/expand-grey32-extend.crimp.
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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= image->w) { xb = (image->w-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= image->h) { yb = (image->h-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = GREY32 (image, xi, yi) - GREY32 (image, xb, yb);	   \
								   \
	GREY32 (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }







|


|



|





|







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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= crimp_w (image)) { xb = (crimp_w (image)-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= crimp_h (image)) { yb = (crimp_h (image)-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = GREY32 (image, xi, yi) - GREY32 (image, xb, yb);	   \
								   \
	GREY32 (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }
Changes to operator/expand-grey32-mirror.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\







|





|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-grey32-replicate.crimp.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= image->w) { xi = (image->w-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= image->h) { yi = (image->h-1); } \
							\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi); \
    }







|


|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= crimp_w (image)) { xi = (crimp_w (image)-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= crimp_h (image)) { yi = (crimp_h (image)-1); } \
							\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi); \
    }
Changes to operator/expand-grey32-wrap.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += image->w; }	\
	while (yi < 0) { yi += image->h; }	\
	xi %= image->w;				\
	yi %= image->h;				\
						\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi); \
    }







|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += crimp_w (image); }	\
	while (yi < 0) { yi += crimp_h (image); }	\
	xi %= crimp_w (image);				\
	yi %= crimp_h (image);				\
						\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi); \
    }
Changes to operator/expand-grey8-extend.crimp.
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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= image->w) { xb = (image->w-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= image->h) { yb = (image->h-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = GREY8 (image, xi, yi) - GREY8 (image, xb, yb);	   \
								   \
	GREY8 (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }







|


|



|





|







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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tg;							   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= crimp_w (image)) { xb = (crimp_w (image)-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= crimp_h (image)) { yb = (crimp_h (image)-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tg = GREY8 (image, xi, yi) - GREY8 (image, xb, yb);	   \
								   \
	GREY8 (result, xo, yo) = CLAMP (0, tg, 255);		   \
    }
Changes to operator/expand-grey8-mirror.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\







|





|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);		   \
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-grey8-replicate.crimp.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= image->w) { xi = (image->w-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= image->h) { yi = (image->h-1); } \
							\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi); \
    }







|


|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= crimp_w (image)) { xi = (crimp_w (image)-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= crimp_h (image)) { yi = (crimp_h (image)-1); } \
							\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);	\
    }

#define COPY(xo,yo,xi,yi) {				\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi); \
    }
Changes to operator/expand-grey8-wrap.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += image->w; }	\
	while (yi < 0) { yi += image->h; }	\
	xi %= image->w;				\
	yi %= image->h;				\
						\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi); \
    }







|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += crimp_w (image); }	\
	while (yi < 0) { yi += crimp_h (image); }	\
	xi %= crimp_w (image);				\
	yi %= crimp_h (image);				\
						\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi); \
    }
Changes to operator/expand-hsv-extend.crimp.
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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int th, ts, tv;						   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= image->w) { xb = (image->w-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= image->h) { yb = (image->h-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	th = H (image, xi, yi) - H (image, xb, yb);		   \
	ts = S (image, xi, yi) - S (image, xb, yb);		   \
	tv = V (image, xi, yi) - V (image, xb, yb);		   \
								   \







|


|



|





|







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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int th, ts, tv;						   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= crimp_w (image)) { xb = (crimp_w (image)-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= crimp_h (image)) { yb = (crimp_h (image)-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	th = H (image, xi, yi) - H (image, xb, yb);		   \
	ts = S (image, xi, yi) - S (image, xb, yb);		   \
	tv = V (image, xi, yi) - V (image, xb, yb);		   \
								   \
Changes to operator/expand-hsv-mirror.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	H (result, xo, yo) = H (image, xi, yi);			   \
	S (result, xo, yo) = S (image, xi, yi);			   \
	V (result, xo, yo) = V (image, xi, yi);			   \
    }







|





|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	H (result, xo, yo) = H (image, xi, yi);			   \
	S (result, xo, yo) = S (image, xi, yi);			   \
	V (result, xo, yo) = V (image, xi, yi);			   \
    }
Changes to operator/expand-hsv-replicate.crimp.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= image->w) { xi = (image->w-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= image->h) { yi = (image->h-1); } \
							\
	H (result, xo, yo) = H (image, xi, yi);		\
	S (result, xo, yo) = S (image, xi, yi);		\
	V (result, xo, yo) = V (image, xi, yi);		\
    }

#define COPY(xo,yo,xi,yi) {			\







|


|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= crimp_w (image)) { xi = (crimp_w (image)-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= crimp_h (image)) { yi = (crimp_h (image)-1); } \
							\
	H (result, xo, yo) = H (image, xi, yi);		\
	S (result, xo, yo) = S (image, xi, yi);		\
	V (result, xo, yo) = V (image, xi, yi);		\
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-hsv-wrap.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += image->w; }	\
	while (yi < 0) { yi += image->h; }	\
	xi %= image->w;				\
	yi %= image->h;				\
						\
	H (result, xo, yo) = H (image, xi, yi); \
	S (result, xo, yo) = S (image, xi, yi); \
	V (result, xo, yo) = V (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\







|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += crimp_w (image); }	\
	while (yi < 0) { yi += crimp_h (image); }	\
	xi %= crimp_w (image);				\
	yi %= crimp_h (image);				\
						\
	H (result, xo, yo) = H (image, xi, yi); \
	S (result, xo, yo) = S (image, xi, yi); \
	V (result, xo, yo) = V (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-rgb-extend.crimp.
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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tr, tg, tb;						   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= image->w) { xb = (image->w-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= image->h) { yb = (image->h-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tr = R (image, xi, yi) - R (image, xb, yb);		   \
	tg = G (image, xi, yi) - G (image, xb, yb);		   \
	tb = B (image, xi, yi) - B (image, xb, yb);		   \
								   \







|


|



|





|







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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tr, tg, tb;						   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= crimp_w (image)) { xb = (crimp_w (image)-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= crimp_h (image)) { yb = (crimp_h (image)-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tr = R (image, xi, yi) - R (image, xb, yb);		   \
	tg = G (image, xi, yi) - G (image, xb, yb);		   \
	tb = B (image, xi, yi) - B (image, xb, yb);		   \
								   \
Changes to operator/expand-rgb-mirror.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	R (result, xo, yo) = R (image, xi, yi);			   \
	G (result, xo, yo) = G (image, xi, yi);			   \
	B (result, xo, yo) = B (image, xi, yi);			   \
    }







|





|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	R (result, xo, yo) = R (image, xi, yi);			   \
	G (result, xo, yo) = G (image, xi, yi);			   \
	B (result, xo, yo) = B (image, xi, yi);			   \
    }
Changes to operator/expand-rgb-replicate.crimp.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= image->w) { xi = (image->w-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= image->h) { yi = (image->h-1); } \
							\
	R (result, xo, yo) = R (image, xi, yi);		\
	G (result, xo, yo) = G (image, xi, yi);		\
	B (result, xo, yo) = B (image, xi, yi);		\
    }

#define COPY(xo,yo,xi,yi) {			\







|


|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= crimp_w (image)) { xi = (crimp_w (image)-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= crimp_h (image)) { yi = (crimp_h (image)-1); } \
							\
	R (result, xo, yo) = R (image, xi, yi);		\
	G (result, xo, yo) = G (image, xi, yi);		\
	B (result, xo, yo) = B (image, xi, yi);		\
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-rgb-wrap.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += image->w; }	\
	while (yi < 0) { yi += image->h; }	\
	xi %= image->w;				\
	yi %= image->h;				\
						\
	R (result, xo, yo) = R (image, xi, yi); \
	G (result, xo, yo) = G (image, xi, yi); \
	B (result, xo, yo) = B (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\







|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += crimp_w (image); }	\
	while (yi < 0) { yi += crimp_h (image); }	\
	xi %= crimp_w (image);				\
	yi %= crimp_h (image);				\
						\
	R (result, xo, yo) = R (image, xi, yi); \
	G (result, xo, yo) = G (image, xi, yi); \
	B (result, xo, yo) = B (image, xi, yi); \
    }

#define COPY(xo,yo,xi,yi) {			\
Changes to operator/expand-rgba-extend.crimp.
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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tr, tg, tb, ta;					   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= image->w) { xb = (image->w-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= image->h) { yb = (image->h-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tr = R (image, xi, yi) - R (image, xb, yb);		   \
	tg = G (image, xi, yi) - G (image, xb, yb);		   \
	tb = B (image, xi, yi) - B (image, xb, yb);		   \
	ta = A (image, xi, yi) - A (image, xb, yb);		   \







|


|



|





|







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
	int xb = xo - ww;					   \
	int yb = yo - hn;					   \
	int xi = xb;						   \
	int yi = yb;						   \
	int tr, tg, tb, ta;					   \
								   \
	if      (xb < 0)         { xb = 0;            }		   \
	else if (xb >= crimp_w (image)) { xb = (crimp_w (image)-1); }		   \
								   \
	if      (yb < 0)         { yb = 0;            }		   \
	else if (yb >= crimp_h (image)) { yb = (crimp_h (image)-1); }		   \
								   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	tr = R (image, xi, yi) - R (image, xb, yb);		   \
	tg = G (image, xi, yi) - G (image, xb, yb);		   \
	tb = B (image, xi, yi) - B (image, xb, yb);		   \
	ta = A (image, xi, yi) - A (image, xb, yb);		   \
Changes to operator/expand-rgba-mirror.crimp.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= image->w) { xi = 2*(image->w-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= image->h) { yi = 2*(image->h-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	R (result, xo, yo) = R (image, xi, yi);			   \
	G (result, xo, yo) = G (image, xi, yi);			   \
	B (result, xo, yo) = B (image, xi, yi);			   \
	A (result, xo, yo) = A (image, xi, yi);			   \







|





|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 */

#define FILL(xo,yo) {						   \
	int xi = xo - ww;					   \
	int yi = yo - hn;					   \
	while (1) {						   \
	    if      (xi < 0)         { xi = 0              - xi; } \
	    else if (xi >= crimp_w (image)) { xi = 2*(crimp_w (image)-1) - xi; } \
	    else break;						   \
	}							   \
								   \
	while (1) {						   \
	    if      (yi < 0)         { yi = 0              - yi; } \
	    else if (yi >= crimp_h (image)) { yi = 2*(crimp_h (image)-1) - yi; } \
	    else break;						   \
	}							   \
								   \
	R (result, xo, yo) = R (image, xi, yi);			   \
	G (result, xo, yo) = G (image, xi, yi);			   \
	B (result, xo, yo) = B (image, xi, yi);			   \
	A (result, xo, yo) = A (image, xi, yi);			   \
Changes to operator/expand-rgba-replicate.crimp.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= image->w) { xi = (image->w-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= image->h) { yi = (image->h-1); } \
							\
	R (result, xo, yo) = R (image, xi, yi);		\
	G (result, xo, yo) = G (image, xi, yi);		\
	B (result, xo, yo) = B (image, xi, yi);		\
	A (result, xo, yo) = A (image, xi, yi);		\
    }








|


|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {					\
	int xi = xo - ww;				\
	int yi = yo - hn;				\
	if      (xi < 0)         { xi = 0;            } \
	else if (xi >= crimp_w (image)) { xi = (crimp_w (image)-1); } \
							\
	if      (yi < 0)         { yi = 0;            } \
	else if (yi >= crimp_h (image)) { yi = (crimp_h (image)-1); } \
							\
	R (result, xo, yo) = R (image, xi, yi);		\
	G (result, xo, yo) = G (image, xi, yi);		\
	B (result, xo, yo) = B (image, xi, yi);		\
	A (result, xo, yo) = A (image, xi, yi);		\
    }

Changes to operator/expand-rgba-wrap.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += image->w; }	\
	while (yi < 0) { yi += image->h; }	\
	xi %= image->w;				\
	yi %= image->h;				\
						\
	R (result, xo, yo) = R (image, xi, yi); \
	G (result, xo, yo) = G (image, xi, yi); \
	B (result, xo, yo) = B (image, xi, yi); \
	A (result, xo, yo) = A (image, xi, yi); \
    }








|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * arithmetic, as the border may be larger than image's width or height,
 * causing muliple wrapping.
 */

#define FILL(xo,yo) {				\
	int xi = xo - ww;			\
	int yi = yo - hn;			\
	while (xi < 0) { xi += crimp_w (image); }	\
	while (yi < 0) { yi += crimp_h (image); }	\
	xi %= crimp_w (image);				\
	yi %= crimp_h (image);				\
						\
	R (result, xo, yo) = R (image, xi, yi); \
	G (result, xo, yo) = G (image, xi, yi); \
	B (result, xo, yo) = B (image, xi, yi); \
	A (result, xo, yo) = A (image, xi, yi); \
    }

Changes to operator/fftx-float.crimp.
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
fftx_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying makes use of the identity
     * between the float and real types to be quick.
     */
    memcpy (&FLOATP (result, 0, y),
	    &FLOATP (image,  0, y),
	    sizeof(float)*image->w);

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));













|
|


|







|







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
fftx_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying makes use of the identity
     * between the float and real types to be quick.
     */
    memcpy (&FLOATP (result, 0, y),
	    &FLOATP (image,  0, y),
	    sizeof(float)*crimp_w (image));

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/fftx-fpcomplex.crimp.
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
fftx_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

n = image->w;
workspace = CRIMP_ALLOC_ARRAY (4*image->w+15, real);
cffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying makes use of the identity
     * between the float and real types to be quick.
     */
    memcpy (&RE (result, 0, y),
	    &RE (image,  0, y),
	    2*sizeof(float)*image->w);

    cfftf_ (&n, &RE (result, 0, y), workspace);
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));













|
|


|







|







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
fftx_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (4*crimp_w (image)+15, real);
cffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying makes use of the identity
     * between the float and real types to be quick.
     */
    memcpy (&RE (result, 0, y),
	    &RE (image,  0, y),
	    2*sizeof(float)*crimp_w (image));

    cfftf_ (&n, &RE (result, 0, y), workspace);
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/fftx-grey16.crimp.
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
fftx_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey16);

result = crimp_new_float (image->w, image->h);


n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying is done with a loop, as we
     * have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) = GREY16 (image,  x, y);
    }

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);











|
>

|
|


|






|







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
fftx_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey16);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying is done with a loop, as we
     * have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) = GREY16 (image,  x, y);
    }

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);
Changes to operator/fftx-grey32.crimp.
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
fftx_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
real*        workspace;
integer      n;

crimp_input (imageObj, image, grey32);

result = crimp_new_float (image->w, image->h);


n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying is done with a loop, as we
     * have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) = GREY32 (image,  x, y);
    }

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);











|
>

|
|


|






|







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
fftx_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
real*        workspace;
integer      n;

crimp_input (imageObj, image, grey32);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying is done with a loop, as we
     * have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) = GREY32 (image,  x, y);
    }

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);
Changes to operator/fftx-grey8.crimp.
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
fftx_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey8);

result = crimp_new_float (image->w, image->h);


n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying is done with a loop, as we
     * have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) = GREY8 (image,  x, y);
    }

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);











|
>

|
|


|






|







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
fftx_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey8);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * FFT on horizontal scan lines.  We copy each line to the result and then
     * run the FFT on it in place.  The copying is done with a loop, as we
     * have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) = GREY8 (image,  x, y);
    }

    rfftf_ (&n, &FLOATP (result, 0, y), workspace);
}

ckfree ((char*) workspace);
Changes to operator/flip-horizontal-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_horizontal_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = FLOATP (image, image->w - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_horizontal_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = FLOATP (image, crimp_w (image) - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Added operator/flip-horizontal-grey16.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_horizontal_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	GREY16 (result, x, y) = GREY16 (image, crimp_w (image) - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/flip-horizontal-grey32.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_horizontal_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	GREY32 (result, x, y) = GREY32 (image, crimp_w (image) - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/flip-horizontal-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_horizontal_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY8 (result, x, y) = GREY8 (image, image->w - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_horizontal_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	GREY8 (result, x, y) = GREY8 (image, crimp_w (image) - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-horizontal-hsv.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_horizontal_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	H (result, x, y) = H (image, image->w - x - 1, y);
	S (result, x, y) = S (image, image->w - x - 1, y);
	V (result, x, y) = V (image, image->w - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_horizontal_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	H (result, x, y) = H (image, crimp_w (image) - x - 1, y);
	S (result, x, y) = S (image, crimp_w (image) - x - 1, y);
	V (result, x, y) = V (image, crimp_w (image) - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-horizontal-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_horizontal_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, image->w - x - 1, y);
	G (result, x, y) = G (image, image->w - x - 1, y);
	B (result, x, y) = B (image, image->w - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_horizontal_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	R (result, x, y) = R (image, crimp_w (image) - x - 1, y);
	G (result, x, y) = G (image, crimp_w (image) - x - 1, y);
	B (result, x, y) = B (image, crimp_w (image) - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-horizontal-rgba.crimp.
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
flip_horizontal_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, image->w - x - 1, y);
	G (result, x, y) = G (image, image->w - x - 1, y);
	B (result, x, y) = B (image, image->w - x - 1, y);
	A (result, x, y) = A (image, image->w - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|
|







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
flip_horizontal_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	R (result, x, y) = R (image, crimp_w (image) - x - 1, y);
	G (result, x, y) = G (image, crimp_w (image) - x - 1, y);
	B (result, x, y) = B (image, crimp_w (image) - x - 1, y);
	A (result, x, y) = A (image, crimp_w (image) - x - 1, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-transpose-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	FLOATP (result, x, y) = FLOATP (image, y, x);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	FLOATP (result, x, y) = FLOATP (image, y, x);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/flip-transpose-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	RE (result, x, y) = RE (image, y, x);
	IM (result, x, y) = IM (image, y, x);
	
    }
}












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	RE (result, x, y) = RE (image, y, x);
	IM (result, x, y) = IM (image, y, x);
	
    }
}

Added operator/flip-transpose-grey16.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_transpose_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	GREY16 (result, x, y) = GREY16 (image, y, x);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/flip-transpose-grey32.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_transpose_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	GREY32 (result, x, y) = GREY32 (image, y, x);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/flip-transpose-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	GREY8 (result, x, y) = GREY8 (image, y, x);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	GREY8 (result, x, y) = GREY8 (image, y, x);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/flip-transpose-hsv.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	H (result, x, y) = H (image, y, x);
	S (result, x, y) = S (image, y, x);
	V (result, x, y) = V (image, y, x);

    }
}











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	H (result, x, y) = H (image, y, x);
	S (result, x, y) = S (image, y, x);
	V (result, x, y) = V (image, y, x);

    }
}
Changes to operator/flip-transpose-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	R (result, x, y) = R (image, y, x);
	G (result, x, y) = G (image, y, x);
	B (result, x, y) = B (image, y, x);

    }
}











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	R (result, x, y) = R (image, y, x);
	G (result, x, y) = G (image, y, x);
	B (result, x, y) = B (image, y, x);

    }
}
Changes to operator/flip-transpose-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	R (result, x, y) = R (image, y, x);
	G (result, x, y) = G (image, y, x);
	B (result, x, y) = B (image, y, x);
	A (result, x, y) = A (image, y, x);

    }











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
flip_transpose_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	R (result, x, y) = R (image, y, x);
	G (result, x, y) = G (image, y, x);
	B (result, x, y) = B (image, y, x);
	A (result, x, y) = A (image, y, x);

    }
Changes to operator/flip-transverse-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_transverse_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	FLOATP (result, x, y) = FLOATP (image, image->w - y - 1, image->h - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_transverse_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	FLOATP (result, x, y) = FLOATP (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Added operator/flip-transverse-grey16.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_transverse_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	GREY16 (result, x, y) = GREY16 (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/flip-transverse-grey32.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_transverse_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	GREY32 (result, x, y) = GREY32 (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/flip-transverse-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_transverse_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	GREY8 (result, x, y) = GREY8 (image, image->w - y - 1, image->h - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_transverse_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	GREY8 (result, x, y) = GREY8 (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-transverse-hsv.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_transverse_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	H (result, x, y) = H (image, image->w - y - 1, image->h - x - 1);
	S (result, x, y) = S (image, image->w - y - 1, image->h - x - 1);
	V (result, x, y) = V (image, image->w - y - 1, image->h - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_transverse_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	H (result, x, y) = H (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);
	S (result, x, y) = S (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);
	V (result, x, y) = V (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-transverse-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_transverse_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	R (result, x, y) = R (image, image->w - y - 1, image->h - x - 1);
	G (result, x, y) = G (image, image->w - y - 1, image->h - x - 1);
	B (result, x, y) = B (image, image->w - y - 1, image->h - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_transverse_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	R (result, x, y) = R (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);
	G (result, x, y) = G (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);
	B (result, x, y) = B (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-transverse-rgba.crimp.
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
flip_transverse_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like_transpose (image);

for (y = 0; y < image->w; y++) {
    for (x = 0; x < image->h; x++) {

	R (result, x, y) = R (image, image->w - y - 1, image->h - x - 1);
	G (result, x, y) = G (image, image->w - y - 1, image->h - x - 1);
	B (result, x, y) = B (image, image->w - y - 1, image->h - x - 1);
	A (result, x, y) = A (image, image->w - y - 1, image->h - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|
|







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
flip_transverse_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like_transpose (image);

for (y = 0; y < crimp_w (image); y++) {
    for (x = 0; x < crimp_h (image); x++) {

	R (result, x, y) = R (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);
	G (result, x, y) = G (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);
	B (result, x, y) = B (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);
	A (result, x, y) = A (image, crimp_w (image) - y - 1, crimp_h (image) - x - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-vertical-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_vertical_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = FLOATP (image, x, image->h - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_vertical_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = FLOATP (image, x, crimp_h (image) - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Added operator/flip-vertical-grey16.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_vertical_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	GREY16 (result, x, y) = GREY16 (image, x, crimp_h (image) - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/flip-vertical-grey32.crimp.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
flip_vertical_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	GREY32 (result, x, y) = GREY32 (image, x, crimp_h (image) - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/flip-vertical-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_vertical_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY8 (result, x, y) = GREY8 (image, x, image->h - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
flip_vertical_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	GREY8 (result, x, y) = GREY8 (image, x, crimp_h (image) - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-vertical-hsv.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_vertical_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	H (result, x, y) = H (image, x, image->h - y - 1);
	S (result, x, y) = S (image, x, image->h - y - 1);
	V (result, x, y) = V (image, x, image->h - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_vertical_hsv
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, hsv);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	H (result, x, y) = H (image, x, crimp_h (image) - y - 1);
	S (result, x, y) = S (image, x, crimp_h (image) - y - 1);
	V (result, x, y) = V (image, x, crimp_h (image) - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-vertical-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_vertical_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, image->h - y - 1);
	G (result, x, y) = G (image, x, image->h - y - 1);
	B (result, x, y) = B (image, x, image->h - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
flip_vertical_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	R (result, x, y) = R (image, x, crimp_h (image) - y - 1);
	G (result, x, y) = G (image, x, crimp_h (image) - y - 1);
	B (result, x, y) = B (image, x, crimp_h (image) - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/flip-vertical-rgba.crimp.
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
flip_vertical_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, image->h - y - 1);
	G (result, x, y) = G (image, x, image->h - y - 1);
	B (result, x, y) = B (image, x, image->h - y - 1);
	A (result, x, y) = A (image, x, image->h - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;












|
|

|
|
|
|







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
flip_vertical_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	R (result, x, y) = R (image, x, crimp_h (image) - y - 1);
	G (result, x, y) = G (image, x, crimp_h (image) - y - 1);
	B (result, x, y) = B (image, x, crimp_h (image) - y - 1);
	A (result, x, y) = A (image, x, crimp_h (image) - y - 1);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/gaussian-01-float.crimp.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianFilter01 (filter, whichDeriv, image->h, image->w,
		  (float*)(image->pixel),
		  (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));








|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianFilter01 (filter, whichDeriv, crimp_h (image), crimp_w (image),
		  (float*)(image->pixel),
		  (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));

Changes to operator/gaussian-10-float.crimp.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianFilter10 (filter, whichDeriv, image->h, image->w,
		  (float*)(image->pixel),
		  (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));








|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianFilter10 (filter, whichDeriv, crimp_h (image), crimp_w (image),
		  (float*)(image->pixel),
		  (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));

Changes to operator/gaussian-blur-float.crimp.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianBlur2D (filter, image->h, image->w,
		(float*)(image->pixel),
		(float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));








|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianBlur2D (filter, crimp_h (image), crimp_w (image),
		(float*)(image->pixel),
		(float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));

Changes to operator/gaussian-gradient-mag-float.crimp.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianGradientMagnitude2D (filter, image->h, image->w,
			     (float*)(image->pixel),
			     (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));








|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianGradientMagnitude2D (filter, crimp_h (image), crimp_w (image),
			     (float*)(image->pixel),
			     (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));

Changes to operator/gaussian-laplacian-float.crimp.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianLaplacian2D (filter, image->h, image->w,
		     (float*)(image->pixel),
		     (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));








|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
GaussianFilterSet filter = GaussianCreateFilter(fabs(radius));

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

GaussianLaplacian2D (filter, crimp_h (image), crimp_w (image),
		     (float*)(image->pixel),
		     (float*)(result->pixel));

GaussianDeleteFilter(filter);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));

Changes to operator/histogram.crimp.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Count the pixel values.
 */

#define BUCKET(c,v) histogram [((c) * maxv + (v))]

if (largegrey) {
    for (y = 0; y < image->h; y++) {
	for (x = 0; x < image->w; x++) {
	    BUCKET (0, GREY16 (image, x, y)) ++;
	}
    }
} else {
    for (y = 0; y < image->h; y++) {
	for (x = 0; x < image->w; x++) {
	    for (c = 0; c < image->itype->channels; c++) {
		BUCKET (c, CH (image, c, x, y)) ++;
	    }
	}
    }
}








|
|




|
|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Count the pixel values.
 */

#define BUCKET(c,v) histogram [((c) * maxv + (v))]

if (largegrey) {
    for (y = 0; y < crimp_h (image); y++) {
	for (x = 0; x < crimp_w (image); x++) {
	    BUCKET (0, GREY16 (image, x, y)) ++;
	}
    }
} else {
    for (y = 0; y < crimp_h (image); y++) {
	for (x = 0; x < crimp_w (image); x++) {
	    for (c = 0; c < image->itype->channels; c++) {
		BUCKET (c, CH (image, c, x, y)) ++;
	    }
	}
    }
}

Changes to operator/hough-grey8.crimp.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Destination size. 360 degrees, and 0.5sqrt(w^2+h^2) slope.
 *
 * FUTURE: Allow x/y factors as parameters, to select more or less buckets,
 * i.e. higher or lower precision.
 */

rw = 360;
rh = hypot (image->w, image->h)/2;

/*
 * Allocate and initialize the buckets.
 */

result = crimp_new_float (rw, rh);








|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Destination size. 360 degrees, and 0.5sqrt(w^2+h^2) slope.
 *
 * FUTURE: Allow x/y factors as parameters, to select more or less buckets,
 * i.e. higher or lower precision.
 */

rw = 360;
rh = hypot (crimp_w (image), crimp_h (image))/2;

/*
 * Allocate and initialize the buckets.
 */

result = crimp_new_float (rw, rh);

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
	if ((theta < 45) ||
	    (theta > 315) ||
	    ((theta > 135) && (theta < 225))) {
	    /*
	     * In these 4 octants iterate over y
	     */

	    for (y = 0; y < image->h; y++) {
		xf = image->w/2 + (rho - (image->h/2 - y)*si)/co;

		xi = xf;
		if ((xf - xi) >= 0.5) xi++;

		if ((xi < 0) || (xi >= image->w)) continue;

		total++;
		sum += GREY8 (image, xi, y);
	    }

	} else {
	    /*
	     * In the remaining octants iterate over x.
	     */

	    for (x = 0; x < image->w; x++) {
		yf = image->h/2 - (rho - (x - image->w/2)*co)/si;

		yi = yf;
		if ((yf - yi) >= 0.5) yi++;

		if ((yi < 0) || (yi >= image->h)) continue;

		total++;
		sum += GREY8 (image, x, yi);
	    }
	}

	/*







|
|




|










|
|




|







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
	if ((theta < 45) ||
	    (theta > 315) ||
	    ((theta > 135) && (theta < 225))) {
	    /*
	     * In these 4 octants iterate over y
	     */

	    for (y = 0; y < crimp_h (image); y++) {
		xf = crimp_w (image)/2 + (rho - (crimp_h (image)/2 - y)*si)/co;

		xi = xf;
		if ((xf - xi) >= 0.5) xi++;

		if ((xi < 0) || (xi >= crimp_w (image))) continue;

		total++;
		sum += GREY8 (image, xi, y);
	    }

	} else {
	    /*
	     * In the remaining octants iterate over x.
	     */

	    for (x = 0; x < crimp_w (image); x++) {
		yf = crimp_h (image)/2 - (rho - (x - crimp_w (image)/2)*co)/si;

		yi = yf;
		if ((yf - yi) >= 0.5) yi++;

		if ((yi < 0) || (yi >= crimp_h (image))) continue;

		total++;
		sum += GREY8 (image, x, yi);
	    }
	}

	/*
Changes to operator/hypot-float-float.crimp.
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
hypot_float_float
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, float);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (FLOATP (imageX, x, y),
				       FLOATP (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_float_float_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-float-grey16.crimp.
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
hypot_float_grey16
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, grey16);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (FLOATP (imageX, x, y),
				       GREY16 (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_float_grey16_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-float-grey32.crimp.
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
hypot_float_grey32
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, grey32);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (FLOATP (imageX, x, y),
				       GREY32 (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_float_grey32_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-float-grey8.crimp.
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
hypot_float_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, float);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageX);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (FLOATP (imageX, x, y),
				       GREY8  (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_float_grey8_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-grey16-grey16.crimp.
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
hypot_grey16_grey16
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey16);
crimp_input (imageYObj, imageY, grey16);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (GREY16 (imageX, x, y),
				       GREY16 (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_grey16_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_grey16_grey16_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-grey16-grey8.crimp.
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
hypot_grey16_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey16);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (GREY16 (imageX, x, y),
				       GREY8  (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_grey16_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_grey16_grey8_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-grey32-grey16.crimp.
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
hypot_grey32_grey16
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey32);
crimp_input (imageYObj, imageY, grey16);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (GREY32 (imageX, x, y),
				       GREY16 (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_grey32_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_grey32_grey16_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-grey32-grey32.crimp.
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
hypot_grey32_grey32
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey32);
crimp_input (imageYObj, imageY, grey32);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (GREY32 (imageX, x, y),
				       GREY32 (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_grey32_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_grey32_grey32_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-grey32-grey8.crimp.
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
hypot_grey32_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey32);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (GREY32 (imageX, x, y),
				       GREY8  (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_grey32_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_grey32_grey8_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/hypot-grey8-grey8.crimp.
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
hypot_grey8_grey8
Tcl_Obj* imageXObj
Tcl_Obj* imageYObj

/*
 * Hypot of all pixels of the two input images.
 */

crimp_image* imageX;
crimp_image* imageY;
crimp_image* result;
int          x, y;

crimp_input (imageXObj, imageX, grey8);
crimp_input (imageYObj, imageY, grey8);

if (!crimp_eq_dim (imageX, imageY)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageX->w, imageX->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = hypot (GREY8 (imageX, x, y),
				       GREY8 (imageY, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|


|


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
hypot_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * hypot() of all pixels of the two input images.
 */





#define BINOP(x,y) (hypot((x),(y)))


#include "binop_grey8_grey8_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/ifftx-float.crimp.
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
ifftx_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying makes use of the
     * identity between the float and real types to be quick.
     */
    memcpy (&FLOATP (result, 0, y),
	    &FLOATP (image,  0, y),
	    sizeof(float)*image->w);

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));













|
|


|







|








|







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
ifftx_float
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying makes use of the
     * identity between the float and real types to be quick.
     */
    memcpy (&FLOATP (result, 0, y),
	    &FLOATP (image,  0, y),
	    sizeof(float)*crimp_w (image));

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/ifftx-fpcomplex.crimp.
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
ifftx_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

n = image->w;
workspace = CRIMP_ALLOC_ARRAY (4*image->w+15, real);
cffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying makes use of the
     * identity between the float and real types to be quick.
     */
    memcpy (&RE (result, 0, y),
	    &RE (image,  0, y),
	    2*sizeof(float)*image->w);

    cfftb_ (&n, &RE (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < image->w; x++) {
	RE (result, x, y) /= n;
	IM (result, x, y) /= n;
	
    }
}

ckfree ((char*) workspace);













|
|


|







|








|







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
ifftx_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (4*crimp_w (image)+15, real);
cffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying makes use of the
     * identity between the float and real types to be quick.
     */
    memcpy (&RE (result, 0, y),
	    &RE (image,  0, y),
	    2*sizeof(float)*crimp_w (image));

    cfftb_ (&n, &RE (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < crimp_w (image); x++) {
	RE (result, x, y) /= n;
	IM (result, x, y) /= n;
	
    }
}

ckfree ((char*) workspace);
Changes to operator/ifftx-grey16.crimp.
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
ifftx_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey16);

result = crimp_new_float (image->w, image->h);


n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying is done with a loop,
     * as we have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) = GREY16 (image,  x, y);
    }

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));











|
>

|
|


|






|










|







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
ifftx_grey16
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey16);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying is done with a loop,
     * as we have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) = GREY16 (image,  x, y);
    }

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/ifftx-grey32.crimp.
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
ifftx_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
real*        workspace;
integer      n;

crimp_input (imageObj, image, grey32);

result = crimp_new_float (image->w, image->h);


n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying is done with a loop,
     * as we have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) = GREY32 (image,  x, y);
    }

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));











|
>

|
|


|






|










|







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
ifftx_grey32
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
real*        workspace;
integer      n;

crimp_input (imageObj, image, grey32);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying is done with a loop,
     * as we have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) = GREY32 (image,  x, y);
    }

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/ifftx-grey8.crimp.
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
ifftx_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey8);

result = crimp_new_float (image->w, image->h);


n = image->w;
workspace = CRIMP_ALLOC_ARRAY (2*image->w+15, real);
rffti_ (&n, workspace);

for (y = 0; y < image->h; y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying is done with a loop,
     * as we have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) = GREY8 (image,  x, y);
    }

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < image->w; x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));











|
>

|
|


|






|










|







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
ifftx_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;
integer      n;
real*        workspace;

crimp_input (imageObj, image, grey8);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

n = crimp_w (image);
workspace = CRIMP_ALLOC_ARRAY (2*crimp_w (image)+15, real);
rffti_ (&n, workspace);

for (y = 0; y < crimp_h (image); y++) {
    /*
     * Inverse FFT on horizontal scan lines.  We copy each line to the result
     * and then run the iFFT on it in place.  The copying is done with a loop,
     * as we have to cast the greyscale values into proper floats.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) = GREY8 (image,  x, y);
    }

    rfftb_ (&n, &FLOATP (result, 0, y), workspace);

    /*
     * Note that we have to divide the result elements by N. This is because
     * the FFT routines do not normalize their results.
     */

    for (x = 0; x < crimp_w (image); x++) {
	FLOATP (result, x, y) /= n;
    }
}

ckfree ((char*) workspace);

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/imaginary-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
imaginary_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	FLOATP (result, x, y) = IM (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;










|
>

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
imaginary_fpcomplex
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	FLOATP (result, x, y) = IM (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/indicator_grey8_float.crimp.
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
int width;
int height;
int x, y;

/* Process inputs */

crimp_input(imageObj, image, grey8);
width = image->w;
height = image->h;
trial = (unsigned char) testValue;

/* Make the output image */

result = crimp_new_float(width, height);

for (y = 0; y < height; ++y) {
    for (x = 0; x < width; ++x) {
	FLOATP(result, x, y) =
	    ((GREY8(image, x, y)) == trial) ? equalValue : notEqualValue;
    }
}








|
|




|
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
int width;
int height;
int x, y;

/* Process inputs */

crimp_input(imageObj, image, grey8);
width = crimp_w (image);
height = crimp_h (image);
trial = (unsigned char) testValue;

/* Make the output image */

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     width, height);
for (y = 0; y < height; ++y) {
    for (x = 0; x < width; ++x) {
	FLOATP(result, x, y) =
	    ((GREY8(image, x, y)) == trial) ? equalValue : notEqualValue;
    }
}

Changes to operator/integrate-float.crimp.
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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_float (image->w, image->h);

/* Initialize the accumulator */
FLOATP (result, 0, 0) = FLOATP (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < result->w; x++) {
    FLOATP (result, x, 0) = FLOATP (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < result->h; y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	FLOATP (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < result->w; x++) {
	FLOATP (result, x, y) = 
	    FLOATP (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}







|







|








|





|







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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

/* Initialize the accumulator */
FLOATP (result, 0, 0) = FLOATP (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < crimp_w (result); x++) {
    FLOATP (result, x, 0) = FLOATP (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < crimp_h (result); y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	FLOATP (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < crimp_w (result); x++) {
	FLOATP (result, x, y) = 
	    FLOATP (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}
Changes to operator/integrate-grey16.crimp.
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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_float (image->w, image->h);


/* Initialize the accumulator */
FLOATP (result, 0, 0) = GREY16 (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < result->w; x++) {
    FLOATP (result, x, 0) = GREY16 (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < result->h; y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	GREY16 (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < result->w; x++) {
	FLOATP (result, x, y) = 
	    GREY16 (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}







|
>







|








|





|







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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

/* Initialize the accumulator */
FLOATP (result, 0, 0) = GREY16 (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < crimp_w (result); x++) {
    FLOATP (result, x, 0) = GREY16 (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < crimp_h (result); y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	GREY16 (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < crimp_w (result); x++) {
	FLOATP (result, x, y) = 
	    GREY16 (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}
Changes to operator/integrate-grey32.crimp.
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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_float (image->w, image->h);


/* Initialize the accumulator */
FLOATP (result, 0, 0) = GREY32 (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < result->w; x++) {
    FLOATP (result, x, 0) = GREY32 (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < result->h; y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	GREY32 (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < result->w; x++) {
	FLOATP (result, x, y) = 
	    GREY32 (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}







|
>







|








|





|







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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

/* Initialize the accumulator */
FLOATP (result, 0, 0) = GREY32 (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < crimp_w (result); x++) {
    FLOATP (result, x, 0) = GREY32 (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < crimp_h (result); y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	GREY32 (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < crimp_w (result); x++) {
	FLOATP (result, x, y) = 
	    GREY32 (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}
Changes to operator/integrate-grey8.crimp.
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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_float (image->w, image->h);


/* Initialize the accumulator */
FLOATP (result, 0, 0) = GREY8 (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < result->w; x++) {
    FLOATP (result, x, 0) = GREY8 (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < result->h; y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	GREY8  (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < result->w; x++) {
	FLOATP (result, x, y) = 
	    GREY8  (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}







|
>







|








|





|







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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

/* Initialize the accumulator */
FLOATP (result, 0, 0) = GREY8 (image, 0, 0);

/*
 * Initialize the first line of the result. Only looking back to results in the same line.
 */
for (x = 1; x < crimp_w (result); x++) {
    FLOATP (result, x, 0) = GREY8 (image, x, 0) + FLOATP (result, x-1, 0);
}

/*
 * Remainder of the image, looking back to results on the same line and the
 * previous line.
 */

for (y = 1; y < crimp_h (result); y++) {
    /* Initialize first column */
    FLOATP (result, 0, y) = 
	GREY8  (image,  0, y) +
	FLOATP (result, 0, y-1);

    for (x = 1; x < crimp_w (result); x++) {
	FLOATP (result, x, y) = 
	    GREY8  (image,  x,   y) +
	    FLOATP (result, x-1, y) +
	    FLOATP (result, x,   y-1) -
	    FLOATP (result, x-1, y-1);
    }
}
Changes to operator/invert-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
invert_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY8 (result, x, y) = WHITE - GREY8 (image, x, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
invert_grey8
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	GREY8 (result, x, y) = WHITE - GREY8 (image, x, y);

    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/invert-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
invert_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * We are inverting (only) the color channels.
	 */

	R (result, x, y) = WHITE - R (image, x, y);
	G (result, x, y) = WHITE - G (image, x, y);











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
invert_rgb
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgb);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * We are inverting (only) the color channels.
	 */

	R (result, x, y) = WHITE - R (image, x, y);
	G (result, x, y) = WHITE - G (image, x, y);
Changes to operator/invert-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
invert_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * We are inverting (only) the color channels.
	 * The alpha channel is copied as is.
	 */

	R (result, x, y) = WHITE - R (image, x, y);











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
invert_rgba
Tcl_Obj* imageObj

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * We are inverting (only) the color channels.
	 * The alpha channel is copied as is.
	 */

	R (result, x, y) = WHITE - R (image, x, y);
Changes to operator/join-complex.crimp.
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26
27
28
crimp_input (imaginaryImageObj, imaginary, float);

if (!crimp_eq_dim (real, imaginary)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_fpcomplex (real->w, real->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	RE (result, x, y) = FLOATP (real,   x, y);







|
>

|
|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (imaginaryImageObj, imaginary, float);

if (!crimp_eq_dim (real, imaginary)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_fpcomplex_at (crimp_x (real), crimp_y (real),
				 crimp_w (real), crimp_h (real));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	RE (result, x, y) = FLOATP (real,   x, y);
Changes to operator/join-grey16.crimp.
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26
27
28
crimp_input (lsbImageObj, lsb, grey8);

if (!crimp_eq_dim (msb, lsb)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey16 (msb->w, msb->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Assembling the bytes of a pixel from the associated input images.
	 */

	int value = 
	    GREY8  (lsb, x, y) |







|
>

|
|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_input (lsbImageObj, lsb, grey8);

if (!crimp_eq_dim (msb, lsb)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey16_at (crimp_x (msb), crimp_y (msb),
			      crimp_w (msb), crimp_h (msb));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Assembling the bytes of a pixel from the associated input images.
	 */

	int value = 
	    GREY8  (lsb, x, y) |
Changes to operator/join-grey32.crimp.
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
if (!crimp_eq_dim (mmsb, lmsb) ||
    !crimp_eq_dim (lmsb, mlsb) ||
    !crimp_eq_dim (mlsb, llsb)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey32 (mmsb->w, mmsb->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Assembling the bytes of a pixel from the associated input images.
	 */

	int value = 
	    GREY8  (llsb, x, y)        |







|
>

|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if (!crimp_eq_dim (mmsb, lmsb) ||
    !crimp_eq_dim (lmsb, mlsb) ||
    !crimp_eq_dim (mlsb, llsb)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey32_at (crimp_x (mmsb), crimp_y (mmsb),
			      crimp_w (mmsb), crimp_h (mmsb));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Assembling the bytes of a pixel from the associated input images.
	 */

	int value = 
	    GREY8  (llsb, x, y)        |
Changes to operator/join-hsv.crimp.
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32

if (!crimp_eq_dim (hue, sat) ||
    !crimp_eq_dim (hue, val)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv (hue->w, hue->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	H (result, x, y) = GREY8 (hue, x, y);







|
>

|
|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

if (!crimp_eq_dim (hue, sat) ||
    !crimp_eq_dim (hue, val)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv_at (crimp_x (hue), crimp_y (hue),
			   crimp_w (hue), crimp_h (hue));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	H (result, x, y) = GREY8 (hue, x, y);
Changes to operator/join-rgb.crimp.
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32

if (!crimp_eq_dim (red, green) ||
    !crimp_eq_dim (red, blue)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb (red->w, red->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	R (result, x, y) = GREY8 (red,   x, y);







|
>

|
|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

if (!crimp_eq_dim (red, green) ||
    !crimp_eq_dim (red, blue)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb_at (crimp_x (red), crimp_y (red),
			   crimp_w (red), crimp_h (red));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	R (result, x, y) = GREY8 (red,   x, y);
Changes to operator/join-rgba.crimp.
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
if (!crimp_eq_dim (red, green) ||
    !crimp_eq_dim (red, blue) ||
    !crimp_eq_dim (red, alpha)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba (red->w, red->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	R (result, x, y) = GREY8 (red,   x, y);







|
>

|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if (!crimp_eq_dim (red, green) ||
    !crimp_eq_dim (red, blue) ||
    !crimp_eq_dim (red, alpha)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba_at (crimp_x (red), crimp_y (red),
			    crimp_w (red), crimp_h (red));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Assembling the pixels of each color channel from the associated
	 * input images.
	 */

	R (result, x, y) = GREY8 (red,   x, y);
Changes to operator/joint_bilateral-grey8.crimp.
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
 * Process and validate the arguments.
 */

crimp_input (imageObj,  image, grey8);
crimp_input (wimageObj, wimage, grey8);

if (!crimp_eq_dim (image, wimage)) {
    Tcl_SetResult(interp, "Unable to  filter, expected equally-sized images", TCL_STATIC);
    return TCL_ERROR;
}

CRIMP_ASSERT (sigma_space >= 1, "Cannot use sigma/s < 1");
CRIMP_ASSERT (sigma_range >= 1, "Cannot use sigma/r < 1");

result = crimp_new_like (image);

/*
 * Determine the size of the bilateral grid.
 * +1 = One more, in case the float->int of the ceil result rounded down.
 * +4 = Borders for the convolution of the grid.
 *
 * TODO NOTE: The SParis BF code obtains the min and max grey levels from the
 * TODO NOTE: image and uses that for the range, instead of a fixed 256 (Also
 * TODO NOTE: assumes that intensity is in [0,1]).
 */

bgrid_width  = 4 + 1 + (int) ceil (image->w/sigma_space);
bgrid_height = 4 + 1 + (int) ceil (image->w/sigma_space);
bgrid_range  = 4 + 1 + (int) ceil (256/sigma_range);
bgrid_maxdim = MAX (bgrid_width, MAX (bgrid_height, bgrid_range));

/*
 * Phase I. Allocate and initialize the bilateral grid (2 volumes).
 */








|


















|
|







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
 * Process and validate the arguments.
 */

crimp_input (imageObj,  image, grey8);
crimp_input (wimageObj, wimage, grey8);

if (!crimp_eq_dim (image, wimage)) {
    Tcl_SetResult(interp, "Unable to filter, expected equally-sized images", TCL_STATIC);
    return TCL_ERROR;
}

CRIMP_ASSERT (sigma_space >= 1, "Cannot use sigma/s < 1");
CRIMP_ASSERT (sigma_range >= 1, "Cannot use sigma/r < 1");

result = crimp_new_like (image);

/*
 * Determine the size of the bilateral grid.
 * +1 = One more, in case the float->int of the ceil result rounded down.
 * +4 = Borders for the convolution of the grid.
 *
 * TODO NOTE: The SParis BF code obtains the min and max grey levels from the
 * TODO NOTE: image and uses that for the range, instead of a fixed 256 (Also
 * TODO NOTE: assumes that intensity is in [0,1]).
 */

bgrid_width  = 4 + 1 + (int) ceil (crimp_w (image)/sigma_space);
bgrid_height = 4 + 1 + (int) ceil (crimp_w (image)/sigma_space);
bgrid_range  = 4 + 1 + (int) ceil (256/sigma_range);
bgrid_maxdim = MAX (bgrid_width, MAX (bgrid_height, bgrid_range));

/*
 * Phase I. Allocate and initialize the bilateral grid (2 volumes).
 */

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    }
}

/*
 * Phase II. Update the bilateral grid with the downsampled image data.
 */

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	double p = GREY8 (image, x, y);
	double pw = GREY8 (wimage, x, y);

	/* +2 is the offset to keep the borders empty. */

	int xr = 2 + lrint (((double) x) / sigma_space);







|
|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    }
}

/*
 * Phase II. Update the bilateral grid with the downsampled image data.
 */

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	double p = GREY8 (image, x, y);
	double pw = GREY8 (wimage, x, y);

	/* +2 is the offset to keep the borders empty. */

	int xr = 2 + lrint (((double) x) / sigma_space);
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
 * interpolation.
 *
 * #define I(a,b,s) ((b) + ((a)-(b))*(s))
 */

#define BETWEEN(a,b,s) ((a)*(s) + (b)*(1-(s)))

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	double winew, wnew, p = GREY8 (image, x, y);

	/* Continuous grid location */
	double xf = 2 + ((double) x) / sigma_space;
	double yf = 2 + ((double) y) / sigma_space;
	double pf = 2 + p / sigma_range;







|
|







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
 * interpolation.
 *
 * #define I(a,b,s) ((b) + ((a)-(b))*(s))
 */

#define BETWEEN(a,b,s) ((a)*(s) + (b)*(1-(s)))

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	double winew, wnew, p = GREY8 (image, x, y);

	/* Continuous grid location */
	double xf = 2 + ((double) x) / sigma_space;
	double yf = 2 + ((double) y) / sigma_space;
	double pf = 2 + p / sigma_range;
Changes to operator/log-float.crimp.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = log (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, y) = log (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/log10-float.crimp.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = log10 (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, y) = log10 (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/lpt_float.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, float);
w = image->w;
h = image->h;

result = crimp_new_float (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	FLOATP (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */







|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, float);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_float (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	FLOATP (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */
Changes to operator/lpt_fpcomplex.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, fpcomplex);
w = image->w;
h = image->h;

result = crimp_new_fpcomplex (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	RE (result, i, j) = BLACK;
	IM (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.







|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, fpcomplex);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_fpcomplex (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	RE (result, i, j) = BLACK;
	IM (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
Changes to operator/lpt_grey16.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, grey16);
w = image->w;
h = image->h;

result = crimp_new_grey16 (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	GREY16 (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */







|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, grey16);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_grey16 (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	GREY16 (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */
Changes to operator/lpt_grey32.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, grey32);
w = image->w;
h = image->h;

result = crimp_new_grey32 (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	GREY32 (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */







|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, grey32);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_grey32 (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	GREY32 (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */
Changes to operator/lpt_grey8.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, grey8);
w = image->w;
h = image->h;

result = crimp_new_grey8 (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	GREY8 (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */







|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, grey8);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_grey8 (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	GREY8 (result, i, j) = BLACK;
    }
}

/*
 * Determine the maximum radial co-ordinate.
 */
Changes to operator/lpt_hsv.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, hsv);
w = image->w;
h = image->h;

result = crimp_new_hsv (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	H (result, i, j) = BLACK;
	S (result, i, j) = BLACK;
	V (result, i, j) = BLACK;
    }
}

/*







|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, hsv);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_hsv (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	H (result, i, j) = BLACK;
	S (result, i, j) = BLACK;
	V (result, i, j) = BLACK;
    }
}

/*
Changes to operator/lpt_rgb.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, rgb);
w = image->w;
h = image->h;

result = crimp_new_rgb (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	R (result, i, j) = BLACK;
	G (result, i, j) = BLACK;
	B (result, i, j) = BLACK;
    }
}

/*







|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, rgb);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_rgb (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	R (result, i, j) = BLACK;
	G (result, i, j) = BLACK;
	B (result, i, j) = BLACK;
    }
}

/*
Changes to operator/lpt_rgba.crimp.
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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, rgba);
w = image->w;
h = image->h;

result = crimp_new_rgba (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < result->h; j++) {
    for (i = 0; i < result->w; i++) {
	R (result, i, j) = BLACK;
	G (result, i, j) = BLACK;
	B (result, i, j) = BLACK;
	A (result, i, j) = TRANSPARENT;
    }
}








|
|













|
|







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
float        rhomax,  rmax;
float*       cosines;		/* Cosines of angles corresponding
				 * to phi = 0 .. rwidth-1 */
float*       sines;             /* Sines of angles corresponding
				 * to phi = 0 .. rwidth-1 */

crimp_input (imageObj, image, rgba);
w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_rgba (rwidth, rheight);

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#endif

/*
 * Initialize the result with a black background. As the transform below may
 * not reach all pixels in the result.
 */

for (j = 0; j < crimp_h (result); j++) {
    for (i = 0; i < crimp_w (result); i++) {
	R (result, i, j) = BLACK;
	G (result, i, j) = BLACK;
	B (result, i, j) = BLACK;
	A (result, i, j) = TRANSPARENT;
    }
}

Changes to operator/magnitude-fpcomplex.crimp.
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
crimp_image* result;
crimp_image* image;

int x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	RE (result, x, y) = hypotf (RE (image, x, y),
				    IM (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|
>

|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
crimp_image* result;
crimp_image* image;

int x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	RE (result, x, y) = hypotf (RE (image, x, y),
				    IM (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/map-grey8.crimp.
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if (!crimp_require_dim (map, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      GREY8 (result, x, y) = GREY8 (map, GREY8 (image, x, y), 0);







|
|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if (!crimp_require_dim (map, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      GREY8 (result, x, y) = GREY8 (map, GREY8 (image, x, y), 0);
Changes to operator/map-hsv.crimp.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
if (!crimp_require_dim (valMap, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for value map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      H (result, x, y) = GREY8 (hueMap, H (image, x, y), 0);







|
|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
if (!crimp_require_dim (valMap, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for value map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      H (result, x, y) = GREY8 (hueMap, H (image, x, y), 0);
Changes to operator/map-rgb.crimp.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
if (!crimp_require_dim (blueMap, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for blue map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), 0);







|
|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
if (!crimp_require_dim (blueMap, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for blue map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), 0);
Changes to operator/map-rgba.crimp.
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
if (!crimp_require_dim (alphaMap, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for alpha map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), 0);







|
|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
if (!crimp_require_dim (alphaMap, 256, 1)) {
    Tcl_SetResult(interp, "bad image dimension for alpha map, expected 256x1", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), 0);
Changes to operator/map2-hsv.crimp.
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
if (!CRIMP_RANGEOK (valControlChannel,2)) {
    Tcl_SetResult(interp, "bad control for value map, expected index in (0...2)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      H (result, x, y) = GREY8 (hueMap, H (image, x, y), CH (image, hueControlChannel, x, y));







|
|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
if (!CRIMP_RANGEOK (valControlChannel,2)) {
    Tcl_SetResult(interp, "bad control for value map, expected index in (0...2)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      H (result, x, y) = GREY8 (hueMap, H (image, x, y), CH (image, hueControlChannel, x, y));
Changes to operator/map2-rgb.crimp.
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
if (!CRIMP_RANGEOK (blueControlChannel,2)) {
    Tcl_SetResult(interp, "bad control for blue map, expected index in (0...2)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), CH (image, redControlChannel,   x, y));







|
|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
if (!CRIMP_RANGEOK (blueControlChannel,2)) {
    Tcl_SetResult(interp, "bad control for blue map, expected index in (0...2)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), CH (image, redControlChannel,   x, y));
Changes to operator/map2-rgba.crimp.
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
if (!CRIMP_RANGEOK (alphaControlChannel,3)) {
    Tcl_SetResult(interp, "bad control for alpha map, expected index in (0...3)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), CH (image, redControlChannel,   x, y));







|
|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
if (!CRIMP_RANGEOK (alphaControlChannel,3)) {
    Tcl_SetResult(interp, "bad control for alpha map, expected index in (0...3)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	/*
	 * Run the pixel value of the input image through the map to
	 * produce the value for the output.
	 */

      R (result, x, y) = GREY8 (redMap,   R (image, x, y), CH (image, redControlChannel,   x, y));
Changes to operator/matrix.crimp.
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    for (j = 0; j < 3; ++j) {
        invert[i][j] = cofact[j][i] / det;
    }
}

crimp_input (imageObj, image, rgba);

w = image->w;
h = image->h;

result = crimp_new_like (image);

for (oy = 0, oyf = -1; oy < h; ++oy, oyf += 2.0 / h) {
    for (ox = 0, oxf = -1; ox < w; ++ox, oxf += 2.0 / w) {
        double ixf = (invert[0][0] * oxf + invert[0][1] * oyf + invert[0][2]);
        double iyf = (invert[1][0] * oxf + invert[1][1] * oyf + invert[1][2]);







|
|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    for (j = 0; j < 3; ++j) {
        invert[i][j] = cofact[j][i] / det;
    }
}

crimp_input (imageObj, image, rgba);

w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_like (image);

for (oy = 0, oyf = -1; oy < h; ++oy, oyf += 2.0 / h) {
    for (ox = 0, oxf = -1; ox < w; ++ox, oxf += 2.0 / w) {
        double ixf = (invert[0][0] * oxf + invert[0][1] * oyf + invert[0][2]);
        double iyf = (invert[1][0] * oxf + invert[1][1] * oyf + invert[1][2]);
Changes to operator/max-float-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-float-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-float-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-float-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_float_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/max-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4





|







1
2
3
4
5
6
7
8
9
10
11
12
13
max_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

#define BINOP(a,b) (MAX((a),(b)))
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-float-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-float-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-float-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-float-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_float_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/min-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
min_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise min-combination of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) (MIN((a),(b)))
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/montageh-float.crimp.
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
crimp_input (imageRightObj, imageRight, float);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageLeft->w + imageRight->w, imageLeft->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageLeft->w; x++) {

	FLOATP (result, x, y) = FLOATP (imageLeft, x, y);
    }
}

for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageRight->w; x++) {

	FLOATP (result, imageLeft->w + x, y) = FLOATP (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|





|
|

|







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
crimp_input (imageRightObj, imageRight, float);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float_at (crimp_x (imageLeft), crimp_y (imageLeft),
			     crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	FLOATP (result, x, y) = FLOATP (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	FLOATP (result, crimp_w (imageLeft) + x, y) = FLOATP (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Added operator/montageh-fpcomplex.crimp.








































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
montageh_fpcomplex
Tcl_Obj* imageLeftObj
Tcl_Obj* imageRightObj

/*
 * Place the two images adjacent to each other in the result, from left to
 * right. The images have to have the same height.
 */

crimp_image*     result;
crimp_image*     imageLeft;
crimp_image*     imageRight;
int x, y;

crimp_input (imageLeftObj,  imageLeft,  fpcomplex);
crimp_input (imageRightObj, imageRight, fpcomplex);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_fpcomplex_at (crimp_x (imageLeft), crimp_y (imageLeft),
				 crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	RE (result, x, y) = RE (imageLeft, x, y);
	IM (result, x, y) = IM (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	RE (result, crimp_w (imageLeft) + x, y) = RE (imageRight, x, y);
	IM (result, crimp_w (imageLeft) + x, y) = IM (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/montageh-grey16.crimp.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
montageh_grey16
Tcl_Obj* imageLeftObj
Tcl_Obj* imageRightObj

/*
 * Place the two images adjacent to each other in the result, from left to
 * right. The images have to have the same height.
 */

crimp_image*     result;
crimp_image*     imageLeft;
crimp_image*     imageRight;
int x, y;

crimp_input (imageLeftObj,  imageLeft,  grey16);
crimp_input (imageRightObj, imageRight, grey16);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey16_at (crimp_x (imageLeft), crimp_y (imageLeft),
			     crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	GREY16 (result, x, y) = GREY16 (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	GREY16 (result, crimp_w (imageLeft) + x, y) = GREY16 (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/montageh-grey32.crimp.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
montageh_grey32
Tcl_Obj* imageLeftObj
Tcl_Obj* imageRightObj

/*
 * Place the two images adjacent to each other in the result, from left to
 * right. The images have to have the same height.
 */

crimp_image*     result;
crimp_image*     imageLeft;
crimp_image*     imageRight;
int x, y;

crimp_input (imageLeftObj,  imageLeft,  grey32);
crimp_input (imageRightObj, imageRight, grey32);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey32_at (crimp_x (imageLeft), crimp_y (imageLeft),
			     crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	GREY32 (result, x, y) = GREY32 (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	GREY32 (result, crimp_w (imageLeft) + x, y) = GREY32 (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/montageh-grey8.crimp.
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
crimp_input (imageRightObj, imageRight, grey8);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey8 (imageLeft->w + imageRight->w, imageLeft->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageLeft->w; x++) {

	GREY8 (result, x, y) = GREY8 (imageLeft, x, y);
    }
}

for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageRight->w; x++) {

	GREY8 (result, imageLeft->w + x, y) = GREY8 (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|





|
|

|







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
crimp_input (imageRightObj, imageRight, grey8);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey8_at (crimp_x (imageLeft), crimp_y (imageLeft),
			     crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	GREY8 (result, x, y) = GREY8 (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	GREY8 (result, crimp_w (imageLeft) + x, y) = GREY8 (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/montageh-hsv.crimp.
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
crimp_input (imageRightObj, imageRight, hsv);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv (imageLeft->w + imageRight->w, imageLeft->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageLeft->w; x++) {

	H (result, x, y) = H (imageLeft, x, y);
	S (result, x, y) = S (imageLeft, x, y);
	V (result, x, y) = V (imageLeft, x, y);
    }
}

for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageRight->w; x++) {

	H (result, imageLeft->w + x, y) = H (imageRight, x, y);
	S (result, imageLeft->w + x, y) = S (imageRight, x, y);
	V (result, imageLeft->w + x, y) = V (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|







|
|

|
|
|







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
crimp_input (imageRightObj, imageRight, hsv);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv_at (crimp_x (imageLeft), crimp_y (imageLeft),
			   crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	H (result, x, y) = H (imageLeft, x, y);
	S (result, x, y) = S (imageLeft, x, y);
	V (result, x, y) = V (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	H (result, crimp_w (imageLeft) + x, y) = H (imageRight, x, y);
	S (result, crimp_w (imageLeft) + x, y) = S (imageRight, x, y);
	V (result, crimp_w (imageLeft) + x, y) = V (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/montageh-rgb.crimp.
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
crimp_input (imageRightObj, imageRight, rgb);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb (imageLeft->w + imageRight->w, imageLeft->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageLeft->w; x++) {

	R (result, x, y) = R (imageLeft, x, y);
	G (result, x, y) = G (imageLeft, x, y);
	B (result, x, y) = B (imageLeft, x, y);
    }
}

for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageRight->w; x++) {

	R (result, imageLeft->w + x, y) = R (imageRight, x, y);
	G (result, imageLeft->w + x, y) = G (imageRight, x, y);
	B (result, imageLeft->w + x, y) = B (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|







|
|

|
|
|







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
crimp_input (imageRightObj, imageRight, rgb);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb_at (crimp_x (imageLeft), crimp_y (imageLeft),
			   crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	R (result, x, y) = R (imageLeft, x, y);
	G (result, x, y) = G (imageLeft, x, y);
	B (result, x, y) = B (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	R (result, crimp_w (imageLeft) + x, y) = R (imageRight, x, y);
	G (result, crimp_w (imageLeft) + x, y) = G (imageRight, x, y);
	B (result, crimp_w (imageLeft) + x, y) = B (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/montageh-rgba.crimp.
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
crimp_input (imageRightObj, imageRight, rgba);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba (imageLeft->w + imageRight->w, imageLeft->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageLeft->w; x++) {

	R (result, x, y) = R (imageLeft, x, y);
	G (result, x, y) = G (imageLeft, x, y);
	B (result, x, y) = B (imageLeft, x, y);
	A (result, x, y) = A (imageLeft, x, y);
    }
}

for (y = 0; y < result->h; y++) {
    for (x = 0; x < imageRight->w; x++) {

	R (result, imageLeft->w + x, y) = R (imageRight, x, y);
	G (result, imageLeft->w + x, y) = G (imageRight, x, y);
	B (result, imageLeft->w + x, y) = B (imageRight, x, y);
	A (result, imageLeft->w + x, y) = A (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|








|
|

|
|
|
|







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
crimp_input (imageRightObj, imageRight, rgba);

if (!crimp_eq_height (imageLeft, imageRight)) {
    Tcl_SetResult(interp, "image heights do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba_at (crimp_x (imageLeft), crimp_y (imageLeft),
			    crimp_w (imageLeft) + crimp_w (imageRight), crimp_h (imageLeft));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageLeft); x++) {

	R (result, x, y) = R (imageLeft, x, y);
	G (result, x, y) = G (imageLeft, x, y);
	B (result, x, y) = B (imageLeft, x, y);
	A (result, x, y) = A (imageLeft, x, y);
    }
}

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (imageRight); x++) {

	R (result, crimp_w (imageLeft) + x, y) = R (imageRight, x, y);
	G (result, crimp_w (imageLeft) + x, y) = G (imageRight, x, y);
	B (result, crimp_w (imageLeft) + x, y) = B (imageRight, x, y);
	A (result, crimp_w (imageLeft) + x, y) = A (imageRight, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/montagev-float.crimp.
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
crimp_input (imageBottomObj, imageBottom, float);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageTop->w, imageTop->h + imageBottom->h);


for (y = 0; y < imageTop->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = FLOATP (imageTop, x, y);
    }
}

for (y = 0; y < imageBottom->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, imageTop->h + y) = FLOATP (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|





|
|

|







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
crimp_input (imageBottomObj, imageBottom, float);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float_at (crimp_x (imageTop), crimp_y (imageTop),
			     crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, y) = FLOATP (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, crimp_h (imageTop) + y) = FLOATP (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Added operator/montagev-fpcomplex.crimp.








































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
montagev_fpcomplex
Tcl_Obj* imageTopObj
Tcl_Obj* imageBottomObj

/*
 * Place the two images adjacent to each other in the result, from top to
 * bottom. The images have to have the same width.
 */

crimp_image*     result;
crimp_image*     imageTop;
crimp_image*     imageBottom;
int x, y;

crimp_input (imageTopObj,    imageTop,    fpcomplex);
crimp_input (imageBottomObj, imageBottom, fpcomplex);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_fpcomplex_at (crimp_x (imageTop), crimp_y (imageTop),
				 crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	RE (result, x, y) = RE (imageTop, x, y);
	IM (result, x, y) = IM (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	RE (result, x, crimp_h (imageTop) + y) = RE (imageBottom, x, y);
	IM (result, x, crimp_h (imageTop) + y) = IM (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/montagev-grey16.crimp.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
montagev_grey16
Tcl_Obj* imageTopObj
Tcl_Obj* imageBottomObj

/*
 * Place the two images adjacent to each other in the result, from left to
 * right. The images have to have the same width.
 */

crimp_image*     result;
crimp_image*     imageTop;
crimp_image*     imageBottom;
int x, y;

crimp_input (imageTopObj,    imageTop,    grey16);
crimp_input (imageBottomObj, imageBottom, grey16);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey16_at (crimp_x (imageTop), crimp_y (imageTop),
			     crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY16 (result, x, y) = GREY16 (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY16 (result, x, crimp_h (imageTop) + y) = GREY16 (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Added operator/montagev-grey32.crimp.




































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
montagev_grey32
Tcl_Obj* imageTopObj
Tcl_Obj* imageBottomObj

/*
 * Place the two images adjacent to each other in the result, from left to
 * right. The images have to have the same width.
 */

crimp_image*     result;
crimp_image*     imageTop;
crimp_image*     imageBottom;
int x, y;

crimp_input (imageTopObj,    imageTop,    grey32);
crimp_input (imageBottomObj, imageBottom, grey32);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey32_at (crimp_x (imageTop), crimp_y (imageTop),
			     crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY32 (result, x, y) = GREY32 (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY32 (result, x, crimp_h (imageTop) + y) = GREY32 (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/montagev-grey8.crimp.
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
crimp_input (imageBottomObj, imageBottom, grey8);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey8 (imageTop->w, imageTop->h + imageBottom->h);


for (y = 0; y < imageTop->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY8 (result, x, y) = GREY8 (imageTop, x, y);
    }
}

for (y = 0; y < imageBottom->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY8 (result, x, imageTop->h + y) = GREY8 (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|





|
|

|







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
crimp_input (imageBottomObj, imageBottom, grey8);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_grey8_at (crimp_x (imageTop), crimp_y (imageTop),
			     crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY8 (result, x, y) = GREY8 (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY8 (result, x, crimp_h (imageTop) + y) = GREY8 (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/montagev-hsv.crimp.
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
crimp_input (imageBottomObj, imageBottom, hsv);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv (imageTop->w, imageTop->h + imageBottom->h);


for (y = 0; y < imageTop->h; y++) {
    for (x = 0; x < result->w; x++) {

	H (result, x, y) = H (imageTop, x, y);
	S (result, x, y) = S (imageTop, x, y);
	V (result, x, y) = V (imageTop, x, y);
    }
}

for (y = 0; y < imageBottom->h; y++) {
    for (x = 0; x < result->w; x++) {

	H (result, x, imageTop->h + y) = H (imageBottom, x, y);
	S (result, x, imageTop->h + y) = S (imageBottom, x, y);
	V (result, x, imageTop->h + y) = V (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|







|
|

|
|
|







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
crimp_input (imageBottomObj, imageBottom, hsv);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_hsv_at (crimp_x (imageTop), crimp_y (imageTop),
			   crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	H (result, x, y) = H (imageTop, x, y);
	S (result, x, y) = S (imageTop, x, y);
	V (result, x, y) = V (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	H (result, x, crimp_h (imageTop) + y) = H (imageBottom, x, y);
	S (result, x, crimp_h (imageTop) + y) = S (imageBottom, x, y);
	V (result, x, crimp_h (imageTop) + y) = V (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/montagev-rgb.crimp.
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
crimp_input (imageBottomObj, imageBottom, rgb);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb (imageTop->w, imageTop->h + imageBottom->h);


for (y = 0; y < imageTop->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = R (imageTop, x, y);
	G (result, x, y) = G (imageTop, x, y);
	B (result, x, y) = B (imageTop, x, y);
    }
}

for (y = 0; y < imageBottom->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, imageTop->h + y) = R (imageBottom, x, y);
	G (result, x, imageTop->h + y) = G (imageBottom, x, y);
	B (result, x, imageTop->h + y) = B (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|







|
|

|
|
|







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
crimp_input (imageBottomObj, imageBottom, rgb);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgb_at (crimp_x (imageTop), crimp_y (imageTop),
			   crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	R (result, x, y) = R (imageTop, x, y);
	G (result, x, y) = G (imageTop, x, y);
	B (result, x, y) = B (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	R (result, x, crimp_h (imageTop) + y) = R (imageBottom, x, y);
	G (result, x, crimp_h (imageTop) + y) = G (imageBottom, x, y);
	B (result, x, crimp_h (imageTop) + y) = B (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/montagev-rgba.crimp.
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
crimp_input (imageBottomObj, imageBottom, rgba);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba (imageTop->w, imageTop->h + imageBottom->h);


for (y = 0; y < imageTop->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, y) = R (imageTop, x, y);
	G (result, x, y) = G (imageTop, x, y);
	B (result, x, y) = B (imageTop, x, y);
	A (result, x, y) = A (imageTop, x, y);
    }
}

for (y = 0; y < imageBottom->h; y++) {
    for (x = 0; x < result->w; x++) {

	R (result, x, imageTop->h + y) = R (imageBottom, x, y);
	G (result, x, imageTop->h + y) = G (imageBottom, x, y);
	B (result, x, imageTop->h + y) = B (imageBottom, x, y);
	A (result, x, imageTop->h + y) = A (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */







|
>

|
|








|
|

|
|
|
|







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
crimp_input (imageBottomObj, imageBottom, rgba);

if (!crimp_eq_width (imageTop, imageBottom)) {
    Tcl_SetResult(interp, "image widths do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba_at (crimp_x (imageTop), crimp_y (imageTop),
			    crimp_w (imageTop), crimp_h (imageTop) + crimp_h (imageBottom));

for (y = 0; y < crimp_h (imageTop); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	R (result, x, y) = R (imageTop, x, y);
	G (result, x, y) = G (imageTop, x, y);
	B (result, x, y) = B (imageTop, x, y);
	A (result, x, y) = A (imageTop, x, y);
    }
}

for (y = 0; y < crimp_h (imageBottom); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	R (result, x, crimp_h (imageTop) + y) = R (imageBottom, x, y);
	G (result, x, crimp_h (imageTop) + y) = G (imageBottom, x, y);
	B (result, x, crimp_h (imageTop) + y) = B (imageBottom, x, y);
	A (result, x, crimp_h (imageTop) + y) = A (imageBottom, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
Changes to operator/multiply-float-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-float-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-float-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-float-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions.
 */

#define BINOP(a,b) ((a)*(b))
#include "binop_float_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-fpcomplex-fpcomplex.crimp.
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
multiply_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel wise multiplication of two images. The images have to
 * have equal dimensions.
 */

crimp_image*     result;
crimp_image*     imageA;
crimp_image*     imageB;
int x, y;

crimp_input (imageAObj, imageA,fpcomplex);
crimp_input (imageBObj, imageB,fpcomplex);

if (!crimp_eq_dim (imageA, imageB)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageA);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	RE (result, x, y) = ( RE (imageA, x, y) * RE (imageB, x, y) ) - ( IM (imageA, x, y)  * IM (imageB, x, y) ) ;
	IM (result, x, y) = ( RE (imageA, x, y) * IM (imageB, x, y) ) + ( RE (imageB, x, y)  * IM (imageA, x, y) ) ;
	}
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
 
 





|
<


<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<









<
<
1
2
3
4
5
6

7
8




9


10




11












12
13
14
15
16
17
18
19
20


multiply_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel wise multiplication of two images.

 */





#define BINOP_RE(ar,ai,br,bi) (((ar) * (br)) - ((ai) *(bi)))


#define BINOP_IM(ar,ai,br,bi) (((ar) * (bi)) + ((br) *(ai)))




#include "binop_fpcomplex_fpcomplex_fpcomplex2.c"













/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */


Changes to operator/multiply-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/multiply-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multiply_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise multiplication of two images. The images have to
 * have equal dimensions. The results are scaled into the range.
 */

#define BINOP(a,b) ((a)*(b)/255)
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/noise-gaussian-grey16.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double ran = sqrt ((-2.0f ) * log(RAND_FLOAT())) * sin (2 * M_PI * RAND_FLOAT());
	double pix = maxval * ((GREY16 (image, x, y) / maxval) + (sqrt(variance) * ran) + mean);

	GREY16 (result, x, y) = CLAMP (0, (int) pix, MAXVAL_GREY16);
    }
}








|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	double ran = sqrt ((-2.0f ) * log(RAND_FLOAT())) * sin (2 * M_PI * RAND_FLOAT());
	double pix = maxval * ((GREY16 (image, x, y) / maxval) + (sqrt(variance) * ran) + mean);

	GREY16 (result, x, y) = CLAMP (0, (int) pix, MAXVAL_GREY16);
    }
}

Changes to operator/noise-gaussian-grey32.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double ran = sqrt ((-2.0f ) * log(RAND_FLOAT())) * sin (2 * M_PI * RAND_FLOAT());
	double pix = maxval * ((GREY32 (image, x, y) / maxval) + (sqrt(variance) * ran) + mean);

	GREY32 (result, x, y) = CLAMP (0, (int) pix, MAXVAL_GREY32);
    }
}








|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	double ran = sqrt ((-2.0f ) * log(RAND_FLOAT())) * sin (2 * M_PI * RAND_FLOAT());
	double pix = maxval * ((GREY32 (image, x, y) / maxval) + (sqrt(variance) * ran) + mean);

	GREY32 (result, x, y) = CLAMP (0, (int) pix, MAXVAL_GREY32);
    }
}

Changes to operator/noise-gaussian-grey8.crimp.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double ran = sqrt ((-2.0f ) * log(RAND_FLOAT())) * sin (2 * M_PI * RAND_FLOAT());
	double pix = maxval * ((GREY8 (image, x, y) / maxval) + (sqrt(variance) * ran) + mean);

	GREY8 (result, x, y) = CLAMP (0, (int) pix, MAXVAL_GREY8);
    }
}








|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	double ran = sqrt ((-2.0f ) * log(RAND_FLOAT())) * sin (2 * M_PI * RAND_FLOAT());
	double pix = maxval * ((GREY8 (image, x, y) / maxval) + (sqrt(variance) * ran) + mean);

	GREY8 (result, x, y) = CLAMP (0, (int) pix, MAXVAL_GREY8);
    }
}

Changes to operator/noise-salt-pepper-grey16.crimp.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    GREY16 (result, x, y) = BLACK;







|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    GREY16 (result, x, y) = BLACK;
Changes to operator/noise-salt-pepper-grey32.crimp.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    GREY32 (result, x, y) = BLACK;







|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    GREY32 (result, x, y) = BLACK;
Changes to operator/noise-salt-pepper-grey8.crimp.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    GREY8 (result, x, y) = BLACK;







|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    GREY8 (result, x, y) = BLACK;
Changes to operator/noise-salt-pepper-rgb.crimp.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj,  image,        rgb);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    R (result, x, y) = BLACK;







|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj,  image,        rgb);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	randval = RAND_FLOAT();

	if (randval < 0) {
	    goto keep;
	}
	if (randval < half) {
	    R (result, x, y) = BLACK;
Changes to operator/noise-salt-pepper-rgba.crimp.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	randval = RAND_FLOAT();

	A (result, x, y) = A (image, x, y);

	if (randval < 0) {
	    goto keep;
	}







|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
double       half = threshold / 2.;
double       randval;

crimp_input (imageObj, image, rgba);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	randval = RAND_FLOAT();

	A (result, x, y) = A (image, x, y);

	if (randval < 0) {
	    goto keep;
	}
Changes to operator/noise-speckle-grey16.crimp.
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
crimp_image* image;
crimp_image* result;
int          x, y;
double       temp;

crimp_input (imageObj, image, grey16);

result = crimp_new_float (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	temp = GREY16 (image, x, y) / 255.0f;

	FLOATP (result, x, y) = temp +
	    (sqrt(10.0f * variance) * temp * (RAND_FLOAT() - 0.5f));
    }
}








|
>

|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
crimp_image* image;
crimp_image* result;
int          x, y;
double       temp;

crimp_input (imageObj, image, grey16);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	temp = GREY16 (image, x, y) / 255.0f;

	FLOATP (result, x, y) = temp +
	    (sqrt(10.0f * variance) * temp * (RAND_FLOAT() - 0.5f));
    }
}

Changes to operator/noise-speckle-grey32.crimp.
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
crimp_image* image;
crimp_image* result;
int          x, y;
double       temp;

crimp_input (imageObj, image, grey32);

result = crimp_new_float (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	temp = GREY32 (image, x, y) / 255.0f;

	FLOATP (result, x, y) = temp +
	    (sqrt(10.0f * variance) * temp * (RAND_FLOAT() - 0.5f));
    }
}








|
>

|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
crimp_image* image;
crimp_image* result;
int          x, y;
double       temp;

crimp_input (imageObj, image, grey32);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	temp = GREY32 (image, x, y) / 255.0f;

	FLOATP (result, x, y) = temp +
	    (sqrt(10.0f * variance) * temp * (RAND_FLOAT() - 0.5f));
    }
}

Changes to operator/noise-speckle-grey8.crimp.
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
crimp_image* image;
crimp_image* result;
int          x, y;
double       temp;

crimp_input (imageObj, image, grey8);

result = crimp_new_float (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	temp = GREY8 (image, x, y) / 255.0f;

	FLOATP (result, x, y) = temp +
	    (sqrt(10.0f * variance) * temp * (RAND_FLOAT() - 0.5f));
    }
}








|
>

|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
crimp_image* image;
crimp_image* result;
int          x, y;
double       temp;

crimp_input (imageObj, image, grey8);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	temp = GREY8 (image, x, y) / 255.0f;

	FLOATP (result, x, y) = temp +
	    (sqrt(10.0f * variance) * temp * (RAND_FLOAT() - 0.5f));
    }
}

Changes to operator/non_max_suppression.crimp.
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
33
34
crimp_input (imageAObj, imageA, float);

if (!crimp_eq_dim (imageM, imageA)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized gradient fields", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float (imageM->w - 2, imageM->h - 2);


for (yo = 0, y = 1; yo < result->h; y++, yo++) {
    for (xo = 0, x = 1; xo < result->w; x++, xo++) {

	double mag   = FLOATP(imageM, x, y);
	double angle = FLOATP(imageA, x, y);
	int    keep;

	/* Octants:
	 * [    0 -  22.5) : - horiz  e..w







|
>

|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
crimp_input (imageAObj, imageA, float);

if (!crimp_eq_dim (imageM, imageA)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized gradient fields", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_float_at (crimp_x (imageM) + 1, crimp_y (imageM) + 1,
			     crimp_w (imageM) - 2, crimp_h (imageM) - 2);

for (yo = 0, y = 1; yo < crimp_h (result); y++, yo++) {
    for (xo = 0, x = 1; xo < crimp_w (result); x++, xo++) {

	double mag   = FLOATP(imageM, x, y);
	double angle = FLOATP(imageA, x, y);
	int    keep;

	/* Octants:
	 * [    0 -  22.5) : - horiz  e..w
Changes to operator/offset-float.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = offset + FLOATP (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, y) = offset + FLOATP (image, x, y);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/pow-float-float.crimp.
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
pow_float_float
Tcl_Obj* imageBaseObj
Tcl_Obj* imageExpnObj

/*
 * pow() of all pixels of the two input images.
 */

crimp_image* imageBase;
crimp_image* imageExpn;
crimp_image* result;
int          x, y;

crimp_input (imageBaseObj, imageBase, float);
crimp_input (imageExpnObj, imageExpn, float);

if (!crimp_eq_dim (imageBase, imageExpn)) {
    Tcl_SetResult(interp, "Unable to proceed, expected equally-sized inputs", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (imageBase);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = pow (FLOATP (imageBase, x, y),
				     FLOATP (imageExpn, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|





<
<
<
<
|
<
<
|
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8




9


10




11













12
13
14
15
16
17
18
pow_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * pow() of all pixels of the two input images.
 */





#define BINOP(a,b) (pow((a),(b)))


#include "binop_float_float_float.c"




#undef BINOP














/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/random_uniform.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
random_uniform
int width 
int height 

crimp_image* result;
int          x, y;

result = crimp_new_float (width, height);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	FLOATP (result, x, y) =  RAND_FLOAT();
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;










|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
random_uniform
int width 
int height 

crimp_image* result;
int          x, y;

result = crimp_new_float (width, height);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	FLOATP (result, x, y) =  RAND_FLOAT();
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;

Changes to operator/region_sum.crimp.
20
21
22
23
24
25
26
27




28
29
30
31
32
33
34
35
36
37

if (radius <= 0) {
    Tcl_SetResult(interp, "bad radius, expected positive value", TCL_STATIC);
    return TCL_ERROR;
}

n = 2*(radius+1);
result = crimp_new (image->itype, image->w - n, image->h - n);





for (yo = 0, yi = radius+1; yo < result->h; yo++, yi++) {
    for (xo = 0, xi = radius+1; xo < result->w; xo++, xi++) {

	FLOATP (result, xo, yo) = 
	      FLOATP (image, xi+radius,   yi+radius)
	    + FLOATP (image, xi-radius-1, yi-radius-1)
	    - FLOATP (image, xi+radius,   yi-radius-1)
	    - FLOATP (image, xi-radius-1, yi+radius);
    }







|
>
>
>
>

|
|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

if (radius <= 0) {
    Tcl_SetResult(interp, "bad radius, expected positive value", TCL_STATIC);
    return TCL_ERROR;
}

n = 2*(radius+1);
result = crimp_new_at (image->itype,
		       crimp_x (image) + radius+1,
		       crimp_y (image) + radius+1,
		       crimp_w (image) - n,
		       crimp_h (image) - n);

for (yo = 0, yi = radius+1; yo < crimp_h (result); yo++, yi++) {
    for (xo = 0, xi = radius+1; xo < crimp_w (result); xo++, xi++) {

	FLOATP (result, xo, yo) = 
	      FLOATP (image, xi+radius,   yi+radius)
	    + FLOATP (image, xi-radius-1, yi-radius-1)
	    - FLOATP (image, xi+radius,   yi-radius-1)
	    - FLOATP (image, xi-radius-1, yi+radius);
    }
Changes to operator/rof-grey8.crimp.
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
crimp_input (imageObj, image, grey8);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogram = CRIMP_ALLOC_ARRAY (image->w * 256, int);
memset (colhistogram,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHIST(xi,value) colhistogram [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
 */
#define UP(xi,value)   COLHIST (xi, value)++







|
>
>
>
>



















|
|

















|







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
crimp_input (imageObj, image, grey8);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogram = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int);
memset (colhistogram,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHIST(xi,value) colhistogram [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
 */
#define UP(xi,value)   COLHIST (xi, value)++
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UP (xi, GREY8 (image, xi, yi));
    }
}

/*
 * Initialization II.
 * Add the first 2*radius+1 column histogram into the initial row histogram.
 */

memset (rowhistogram,'\0', 256 * sizeof(int));
for (xi = 0 ; xi < 2*radius+1; xi++) { ADD (xi); }

/*
 * Now we can start filtering. The initial histogram is already properly set
 * up for (xo,yo) = (0,0). For the remaining pixels of the first row in the
 * output we can sweep through without having to pull the column histograms
 * down.
 */

GREY8 (result, 0, 0) = crimp_rank (rowhistogram, percentile, n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    GREY8 (result, xo, 0) = crimp_rank (rowhistogram, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogram,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADD (xi);
    }

    GREY8 (result, 0, yo) = crimp_rank (rowhistogram, percentile, n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	GREY8 (result, xo, yo) = crimp_rank (rowhistogram, percentile, n);
    }
 }

Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|




















|








|









|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UP (xi, GREY8 (image, xi, yi));
    }
}

/*
 * Initialization II.
 * Add the first 2*radius+1 column histogram into the initial row histogram.
 */

memset (rowhistogram,'\0', 256 * sizeof(int));
for (xi = 0 ; xi < 2*radius+1; xi++) { ADD (xi); }

/*
 * Now we can start filtering. The initial histogram is already properly set
 * up for (xo,yo) = (0,0). For the remaining pixels of the first row in the
 * output we can sweep through without having to pull the column histograms
 * down.
 */

GREY8 (result, 0, 0) = crimp_rank (rowhistogram, percentile, n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    GREY8 (result, xo, 0) = crimp_rank (rowhistogram, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogram,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADD (xi);
    }

    GREY8 (result, 0, yo) = crimp_rank (rowhistogram, percentile, n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	GREY8 (result, xo, yo) = crimp_rank (rowhistogram, percentile, n);
    }
 }

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/rof-hsv.crimp.
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
crimp_input (imageObj, image, hsv);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramh = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramh,'\0', image->w * 256 * sizeof(int));
colhistograms = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistograms,'\0', image->w * 256 * sizeof(int));
colhistogramv = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramh,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHISTH(xi,value) colhistogramh [CHINDEX (xi, value)]
#define COLHISTS(xi,value) colhistograms [CHINDEX (xi, value)]
#define COLHISTV(xi,value) colhistogramh [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.







|
>
>
>
>



















|
|
|

















|







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
crimp_input (imageObj, image, hsv);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramh = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramh,'\0', crimp_w (image) * 256 * sizeof(int));
colhistograms = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistograms,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramv = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramh,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHISTH(xi,value) colhistogramh [CHINDEX (xi, value)]
#define COLHISTS(xi,value) colhistograms [CHINDEX (xi, value)]
#define COLHISTV(xi,value) colhistogramh [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UPH (xi, R (image, xi, yi));
	UPS (xi, G (image, xi, yi));
	UPV (xi, B (image, xi, yi));
    }
}

/*







|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UPH (xi, R (image, xi, yi));
	UPS (xi, G (image, xi, yi));
	UPV (xi, B (image, xi, yi));
    }
}

/*
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
 * output we can sweep through without having to pull the column histograms
 * down.
 */

H (result, 0, 0) = crimp_rank (rowhistogramh, percentile, n);
S (result, 0, 0) = crimp_rank (rowhistograms, percentile, n);
V (result, 0, 0) = crimp_rank (rowhistogramv, percentile, n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    H (result, xo, 0) = crimp_rank (rowhistogramh, percentile, n);
    S (result, xo, 0) = crimp_rank (rowhistograms, percentile, n);
    V (result, xo, 0) = crimp_rank (rowhistogramv, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramh,'\0', 256 * sizeof(int));
    memset (rowhistograms,'\0', 256 * sizeof(int));
    memset (rowhistogramv,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDH (xi);
	ADDS (xi);
	ADDV (xi);
    }

    H (result, 0, yo) = crimp_rank (rowhistogramh, percentile, n);
    S (result, 0, yo) = crimp_rank (rowhistograms, percentile, n);
    V (result, 0, yo) = crimp_rank (rowhistogramv, percentile, n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	H (result, xo, yo) = crimp_rank (rowhistogramh, percentile, n);
	S (result, xo, yo) = crimp_rank (rowhistograms, percentile, n);
	V (result, xo, yo) = crimp_rank (rowhistogramv, percentile, n);
    }
 }







|










|















|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
 * output we can sweep through without having to pull the column histograms
 * down.
 */

H (result, 0, 0) = crimp_rank (rowhistogramh, percentile, n);
S (result, 0, 0) = crimp_rank (rowhistograms, percentile, n);
V (result, 0, 0) = crimp_rank (rowhistogramv, percentile, n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    H (result, xo, 0) = crimp_rank (rowhistogramh, percentile, n);
    S (result, xo, 0) = crimp_rank (rowhistograms, percentile, n);
    V (result, xo, 0) = crimp_rank (rowhistogramv, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramh,'\0', 256 * sizeof(int));
    memset (rowhistograms,'\0', 256 * sizeof(int));
    memset (rowhistogramv,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDH (xi);
	ADDS (xi);
	ADDV (xi);
    }

    H (result, 0, yo) = crimp_rank (rowhistogramh, percentile, n);
    S (result, 0, yo) = crimp_rank (rowhistograms, percentile, n);
    V (result, 0, yo) = crimp_rank (rowhistogramv, percentile, n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	H (result, xo, yo) = crimp_rank (rowhistogramh, percentile, n);
	S (result, xo, yo) = crimp_rank (rowhistograms, percentile, n);
	V (result, xo, yo) = crimp_rank (rowhistogramv, percentile, n);
    }
 }
Changes to operator/rof-rgb.crimp.
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
crimp_input (imageObj, image, rgb);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramr,'\0', image->w * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramg,'\0', image->w * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramb,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.







|
>
>
>
>



















|
|
|

















|







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
crimp_input (imageObj, image, rgb);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramr,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramg,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramb,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]

/*
 * Basic operations on column histograms. Add/remove pixel values.
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
    }
}

/*







|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
    }
}

/*
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
 * output we can sweep through without having to pull the column histograms
 * down.
 */

R (result, 0, 0) = crimp_rank (rowhistogramr, percentile, n);
G (result, 0, 0) = crimp_rank (rowhistogramg, percentile, n);
B (result, 0, 0) = crimp_rank (rowhistogramb, percentile, n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_rank (rowhistogramr, percentile, n);
    G (result, xo, 0) = crimp_rank (rowhistogramg, percentile, n);
    B (result, xo, 0) = crimp_rank (rowhistogramb, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
    }

    R (result, 0, yo) = crimp_rank (rowhistogramr, percentile, n);
    G (result, 0, yo) = crimp_rank (rowhistogramg, percentile, n);
    B (result, 0, yo) = crimp_rank (rowhistogramb, percentile, n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_rank (rowhistogramr, percentile, n);
	G (result, xo, yo) = crimp_rank (rowhistogramg, percentile, n);
	B (result, xo, yo) = crimp_rank (rowhistogramb, percentile, n);
    }
 }







|










|















|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
 * output we can sweep through without having to pull the column histograms
 * down.
 */

R (result, 0, 0) = crimp_rank (rowhistogramr, percentile, n);
G (result, 0, 0) = crimp_rank (rowhistogramg, percentile, n);
B (result, 0, 0) = crimp_rank (rowhistogramb, percentile, n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_rank (rowhistogramr, percentile, n);
    G (result, xo, 0) = crimp_rank (rowhistogramg, percentile, n);
    B (result, xo, 0) = crimp_rank (rowhistogramb, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
    }

    R (result, 0, yo) = crimp_rank (rowhistogramr, percentile, n);
    G (result, 0, yo) = crimp_rank (rowhistogramg, percentile, n);
    B (result, 0, yo) = crimp_rank (rowhistogramb, percentile, n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_rank (rowhistogramr, percentile, n);
	G (result, xo, yo) = crimp_rank (rowhistogramg, percentile, n);
	B (result, xo, yo) = crimp_rank (rowhistogramb, percentile, n);
    }
 }
Changes to operator/rof-rgba.crimp.
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
crimp_input (imageObj, image, rgba);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new (image->itype, image->w - 2*radius, image->h - 2*radius);





/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramr,'\0', image->w * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramg,'\0', image->w * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistogramb,'\0', image->w * 256 * sizeof(int));
colhistograma = CRIMP_ALLOC_ARRAY (image->w * 256, int); memset (colhistograma,'\0', image->w * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * image->w + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]
#define COLHISTA(xi,value) colhistograma [CHINDEX (xi, value)]

/*







|
>
>
>
>



















|
|
|
|

















|







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
crimp_input (imageObj, image, rgba);

if ((percentile < 0) || (percentile > 10000)) {
    Tcl_SetResult(interp, "bad percentile, expected integer in (0..10000)", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_at (image->itype,
		       crimp_x (image) + radius,
		       crimp_y (image) + radius,
		       crimp_w (image) - 2*radius,
		       crimp_h (image) - 2*radius);

/*
 * We are using the method described by Simon Perreault and Patrick Hebert in
 * their paper 'Median Filtering In Constant Time'. This method trades memory
 * for speed by keeping one histogram per column, plus a row histogram of the
 * current 2r+1 columns. When moving from pixel to pixel these histograms are
 * incrementally updated, each in constant time. The trick is that the column
 * histograms keep history between rows.
 *
 * Right now we are not making use of any of the proposed optimizations, like
 * multi-level histograms, conditional updating, or vertical striping for
 * cache friendliness.
 *
 * Relationship between input and result coordinate systems:
 *
 * xi = xo + radius, xo in (0...w-2*radius)
 * yi = yo + radius, yo in (0...w-2*radius)
 */

colhistogramr = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramr,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramg = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramg,'\0', crimp_w (image) * 256 * sizeof(int));
colhistogramb = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistogramb,'\0', crimp_w (image) * 256 * sizeof(int));
colhistograma = CRIMP_ALLOC_ARRAY (crimp_w (image) * 256, int); memset (colhistograma,'\0', crimp_w (image) * 256 * sizeof(int));

n = (2*radius+1);
n = n * n;

/*
 * TODO :: Test different storage orders for the histograms (row vs column
 *         major order).
 */

/*
 * Access to the column histograms.
 *
 * xi = column index, in the input image coordinate system.
 */
#if 1
#define CHINDEX(xi,value)   ((xi) * 256 + (value))
#else
#define CHINDEX(xi,value)   ((value) * crimp_w (image) + (xi))
#endif
#define COLHISTR(xi,value) colhistogramr [CHINDEX (xi, value)]
#define COLHISTG(xi,value) colhistogramg [CHINDEX (xi, value)]
#define COLHISTB(xi,value) colhistogramb [CHINDEX (xi, value)]
#define COLHISTA(xi,value) colhistograma [CHINDEX (xi, value)]

/*
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < image->w; xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
	UPA (xi, A (image, xi, yi));
    }
}








|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
 * Initialization I.
 * Scan the first 2*radius+1 rows of the input image into the column
 * histograms.
 */

for (yi = 0; yi < 2*radius+1; yi++) {
    for (xi = 0; xi < crimp_w (image); xi++) {
	UPR (xi, R (image, xi, yi));
	UPG (xi, G (image, xi, yi));
	UPB (xi, B (image, xi, yi));
	UPA (xi, A (image, xi, yi));
    }
}

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
 * down.
 */

R (result, 0, 0) = crimp_rank (rowhistogramr, percentile, n);
G (result, 0, 0) = crimp_rank (rowhistogramg, percentile, n);
B (result, 0, 0) = crimp_rank (rowhistogramb, percentile, n);
A (result, 0, 0) = crimp_rank (rowhistograma, percentile, n);
for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_rank (rowhistogramr, percentile, n);
    G (result, xo, 0) = crimp_rank (rowhistogramg, percentile, n);
    B (result, xo, 0) = crimp_rank (rowhistogramb, percentile, n);
    A (result, xo, 0) = crimp_rank (rowhistograma, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < result->h; yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    memset (rowhistograma,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
	ADDA (xi);
    }

    R (result, 0, yo) = crimp_rank (rowhistogramr, percentile, n);
    G (result, 0, yo) = crimp_rank (rowhistogramg, percentile, n);
    B (result, 0, yo) = crimp_rank (rowhistogramb, percentile, n);
    A (result, 0, yo) = crimp_rank (rowhistograma, percentile, n);
    for (xo = 1, xi = radius+1; xo < result->w; xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_rank (rowhistogramr, percentile, n);
	G (result, xo, yo) = crimp_rank (rowhistogramg, percentile, n);
	B (result, xo, yo) = crimp_rank (rowhistogramb, percentile, n);
	A (result, xo, yo) = crimp_rank (rowhistograma, percentile, n);
    }







|











|


















|







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
 * down.
 */

R (result, 0, 0) = crimp_rank (rowhistogramr, percentile, n);
G (result, 0, 0) = crimp_rank (rowhistogramg, percentile, n);
B (result, 0, 0) = crimp_rank (rowhistogramb, percentile, n);
A (result, 0, 0) = crimp_rank (rowhistograma, percentile, n);
for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
    SHIFT_RIGHT (xi);
    R (result, xo, 0) = crimp_rank (rowhistogramr, percentile, n);
    G (result, xo, 0) = crimp_rank (rowhistogramg, percentile, n);
    B (result, xo, 0) = crimp_rank (rowhistogramb, percentile, n);
    A (result, xo, 0) = crimp_rank (rowhistograma, percentile, n);
}

/*
 * With the first row of the result done we can now sweep the remaining lines.
 */

for (yo = 1, yi = radius+1; yo < crimp_h (result); yo++, yi++) {

    /* Re-initialize the row histogram for the line */
    memset (rowhistogramr,'\0', 256 * sizeof(int));
    memset (rowhistogramg,'\0', 256 * sizeof(int));
    memset (rowhistogramb,'\0', 256 * sizeof(int));
    memset (rowhistograma,'\0', 256 * sizeof(int));
    for (xi = 0 ; xi < 2*radius+1; xi++) {
	SHIFT_DOWN (xi,yi);
	ADDR (xi);
	ADDG (xi);
	ADDB (xi);
	ADDA (xi);
    }

    R (result, 0, yo) = crimp_rank (rowhistogramr, percentile, n);
    G (result, 0, yo) = crimp_rank (rowhistogramg, percentile, n);
    B (result, 0, yo) = crimp_rank (rowhistogramb, percentile, n);
    A (result, 0, yo) = crimp_rank (rowhistograma, percentile, n);
    for (xo = 1, xi = radius+1; xo < crimp_w (result); xo++, xi++) {
	SHIFT_DOWN  (xi+radius,yi);
	SHIFT_RIGHT (xi);
	R (result, xo, yo) = crimp_rank (rowhistogramr, percentile, n);
	G (result, xo, yo) = crimp_rank (rowhistogramg, percentile, n);
	B (result, xo, yo) = crimp_rank (rowhistogramb, percentile, n);
	A (result, xo, yo) = crimp_rank (rowhistograma, percentile, n);
    }
Changes to operator/scale-float.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = FLOATP (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, y) = FLOATP (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/scale-fpcomplex.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	RE (result, x, y) = RE (image, x, y) * factor;
	IM (result, x, y) = IM (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	RE (result, x, y) = RE (image, x, y) * factor;
	IM (result, x, y) = IM (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/scale-grey16.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY16 (result, x, y) = GREY16 (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey16);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY16 (result, x, y) = GREY16 (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/scale-grey32.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY32 (result, x, y) = GREY32 (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey32);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY32 (result, x, y) = GREY32 (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/scale-grey8.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	GREY8 (result, x, y) = GREY8 (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, grey8);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	GREY8 (result, x, y) = GREY8 (image, x, y) * factor;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/screen-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/screen-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/screen-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/screen-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/screen-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/screen-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
screen_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Pixel- and channel-wise 1-(1-A)*(1-B) combination of two images. The images
 * have to have equal dimensions. This could be done at Tcl level using a
 * combination of 'multiply' and 'invert'. Doing it in C on the other hand
 * avoids the three temporary images of that implementation.
 */

#define BINOP(a,b) (255 - (((255-(a))*(255-(b)))/255))
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/setalpha-rgb-grey8.crimp.
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
crimp_input (imageAlphaObj, imageA, grey8);

if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = GREY8 (imageA, x, y);
    }
}








|
>

|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
crimp_input (imageAlphaObj, imageA, grey8);

if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba_at (crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = GREY8 (imageA, x, y);
    }
}

Changes to operator/setalpha-rgb-rgba.crimp.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
crimp_input (imageAlphaObj, imageA, rgba);

if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba (image->w, image->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = A (imageA, x, y);
    }
}








|

|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
crimp_input (imageAlphaObj, imageA, rgba);

if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_rgba_at (crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = A (imageA, x, y);
    }
}

Changes to operator/setalpha-rgba-grey8.crimp.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = GREY8 (imageA, x, y);
    }
}








|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = GREY8 (imageA, x, y);
    }
}

Changes to operator/setalpha-rgba-rgba.crimp.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = A (imageA, x, y);
    }
}








|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
if (!crimp_eq_dim (image, imageA)) {
    Tcl_SetResult(interp, "image dimensions do not match", TCL_STATIC);
    return TCL_ERROR;
}

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	R (result, x, y) = R (image, x, y);
	G (result, x, y) = G (image, x, y);
	B (result, x, y) = B (image, x, y);
	A (result, x, y) = A (imageA, x, y);
    }
}

Changes to operator/split-complex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12

13

14
15
16
17
18
19
20
21
22
23
split_fpcomplex
Tcl_Obj* imageObj

Tcl_Obj*         list[2];
crimp_image*     image;
crimp_image*     real;
crimp_image*     imaginary;
int              x, y;

crimp_input (imageObj, image, fpcomplex);

real      = crimp_new_float (image->w, image->h);

imaginary = crimp_new_float (image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * Placing the pixels of each channel into their own image.
	 */

	FLOATP (real,      x, y) = RE (image, x, y);
	FLOATP (imaginary, x, y) = IM (image, x, y);











|
>
|
>

|
|







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
split_fpcomplex
Tcl_Obj* imageObj

Tcl_Obj*         list[2];
crimp_image*     image;
crimp_image*     real;
crimp_image*     imaginary;
int              x, y;

crimp_input (imageObj, image, fpcomplex);

real      = crimp_new_float_at (crimp_x (image), crimp_y (image),
				crimp_w (image), crimp_h (image));
imaginary = crimp_new_float_at (crimp_x (image), crimp_y (image),
				crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * Placing the pixels of each channel into their own image.
	 */

	FLOATP (real,      x, y) = RE (image, x, y);
	FLOATP (imaginary, x, y) = IM (image, x, y);
Changes to operator/split-grey16.crimp.
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
split_grey16
Tcl_Obj* imageObj

Tcl_Obj*         list[2];
const crimp_imagetype* grey = crimp_imagetype_find ("crimp::image::grey8");
crimp_image*     image;
crimp_image*     lsb;
crimp_image*     msb;
crimp_image*     blue;
int              x, y;

crimp_input (imageObj, image, grey16);

lsb = crimp_new (grey, image->w, image->h);

msb = crimp_new (grey, image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * Splitting the bytes of a pixel into their own images.
	 */

	int value = GREY16 (image, x, y);

	GREY8 (msb,   x, y) = (value >> 8) & 0xff;
	GREY8 (lsb, x, y)   = (value)      & 0xff;
    }
}

list [0] = crimp_new_image_obj (msb);
list [1] = crimp_new_image_obj (lsb);

Tcl_SetObjResult(interp, Tcl_NewListObj (2, list));













|
>
|
>

|
|







|
|







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
split_grey16
Tcl_Obj* imageObj

Tcl_Obj*         list[2];
const crimp_imagetype* grey = crimp_imagetype_find ("crimp::image::grey8");
crimp_image*     image;
crimp_image*     lsb;
crimp_image*     msb;
crimp_image*     blue;
int              x, y;

crimp_input (imageObj, image, grey16);

lsb = crimp_new_at (grey, crimp_x (image), crimp_y (image),
		          crimp_w (image), crimp_h (image));
msb = crimp_new_at (grey, crimp_x (image), crimp_y (image),
		          crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * Splitting the bytes of a pixel into their own images.
	 */

	int value = GREY16 (image, x, y);

	GREY8 (msb, x, y) = (value >> 8) & 0xff;
	GREY8 (lsb, x, y) = (value)      & 0xff;
    }
}

list [0] = crimp_new_image_obj (msb);
list [1] = crimp_new_image_obj (lsb);

Tcl_SetObjResult(interp, Tcl_NewListObj (2, list));
Changes to operator/split-grey32.crimp.
9
10
11
12
13
14
15
16

17

18

19

20
21
22
23
24
25
26
27
28
29
crimp_image*     lmsb;
crimp_image*     mmsb;
crimp_image*     blue;
int              x, y;

crimp_input (imageObj, image, grey32);

llsb = crimp_new (grey, image->w, image->h);

mlsb = crimp_new (grey, image->w, image->h);

lmsb = crimp_new (grey, image->w, image->h);

mmsb = crimp_new (grey, image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * Splitting the bytes of a pixel into their own images.
	 */

	int value = GREY32 (image, x, y);








|
>
|
>
|
>
|
>

|
|







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
crimp_image*     lmsb;
crimp_image*     mmsb;
crimp_image*     blue;
int              x, y;

crimp_input (imageObj, image, grey32);

llsb = crimp_new_at (grey, crimp_x (image), crimp_y (image),
		           crimp_w (image), crimp_h (image));
mlsb = crimp_new_at (grey, crimp_x (image), crimp_y (image),
		           crimp_w (image), crimp_h (image));
lmsb = crimp_new_at (grey, crimp_x (image), crimp_y (image),
		           crimp_w (image), crimp_h (image));
mmsb = crimp_new_at (grey, crimp_x (image), crimp_y (image),
		           crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * Splitting the bytes of a pixel into their own images.
	 */

	int value = GREY32 (image, x, y);

Changes to operator/split-hsv.crimp.
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
split_hsv
Tcl_Obj* imageObj

Tcl_Obj*         list[3];
const crimp_imagetype* grey = crimp_imagetype_find ("crimp::image::grey8");
crimp_image*     image;
crimp_image*     hue;
crimp_image*     sat;
crimp_image*     val;
int              x, y;

crimp_input (imageObj, image, hsv);

hue = crimp_new (grey, image->w, image->h);

sat = crimp_new (grey, image->w, image->h);

val = crimp_new (grey, image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * Placing the pixels of each color channel into their own images.
	 */

	GREY8 (hue, x, y) = H (image, x, y);
	GREY8 (sat, x, y) = S (image, x, y);













|
>
|
>
|
>

|
|







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
split_hsv
Tcl_Obj* imageObj

Tcl_Obj*         list[3];
const crimp_imagetype* grey = crimp_imagetype_find ("crimp::image::grey8");
crimp_image*     image;
crimp_image*     hue;
crimp_image*     sat;
crimp_image*     val;
int              x, y;

crimp_input (imageObj, image, hsv);

hue = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			  crimp_w (image), crimp_h (image));
sat = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			  crimp_w (image), crimp_h (image));
val = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			  crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * Placing the pixels of each color channel into their own images.
	 */

	GREY8 (hue, x, y) = H (image, x, y);
	GREY8 (sat, x, y) = S (image, x, y);
Changes to operator/split-rgb.crimp.
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
split_rgb
Tcl_Obj* imageObj

Tcl_Obj*         list[3];
const crimp_imagetype* grey = crimp_imagetype_find ("crimp::image::grey8");
crimp_image*     image;
crimp_image*     red;
crimp_image*     green;
crimp_image*     blue;
int              x, y;

crimp_input (imageObj, image, rgb);

red   = crimp_new (grey, image->w, image->h);

green = crimp_new (grey, image->w, image->h);

blue  = crimp_new (grey, image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * Placing the pixels of each color channel into their own images.
	 */

	GREY8 (red,   x, y) = R (image, x, y);
	GREY8 (green, x, y) = G (image, x, y);













|
>
|
>
|
>

|
|







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
split_rgb
Tcl_Obj* imageObj

Tcl_Obj*         list[3];
const crimp_imagetype* grey = crimp_imagetype_find ("crimp::image::grey8");
crimp_image*     image;
crimp_image*     red;
crimp_image*     green;
crimp_image*     blue;
int              x, y;

crimp_input (imageObj, image, rgb);

red   = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));
green = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));
blue  = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * Placing the pixels of each color channel into their own images.
	 */

	GREY8 (red,   x, y) = R (image, x, y);
	GREY8 (green, x, y) = G (image, x, y);
Changes to operator/split-rgba.crimp.
8
9
10
11
12
13
14
15

16

17

18

19
20
21
22
23
24
25
26
27
28
crimp_image*     green;
crimp_image*     blue;
crimp_image*     alpha;
int              x, y;

crimp_input (imageObj, image, rgba);

red   = crimp_new (grey, image->w, image->h);

green = crimp_new (grey, image->w, image->h);

blue  = crimp_new (grey, image->w, image->h);

alpha = crimp_new (grey, image->w, image->h);


for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	/*
	 * Placing the pixels of each color channel (and alpha) into
	 * their own images.
	 */

	GREY8 (red,   x, y) = R (image, x, y);







|
>
|
>
|
>
|
>

|
|







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
crimp_image*     green;
crimp_image*     blue;
crimp_image*     alpha;
int              x, y;

crimp_input (imageObj, image, rgba);

red   = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));
green = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));
blue  = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));
alpha = crimp_new_at (grey, crimp_x (image), crimp_y (image),
			    crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	/*
	 * Placing the pixels of each color channel (and alpha) into
	 * their own images.
	 */

	GREY8 (red,   x, y) = R (image, x, y);
Changes to operator/sqmagnitude-fpcomplex.crimp.
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
crimp_image* result;
crimp_image* image;

int x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float (image->w, image->h);


for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	double re = RE (image, x, y);
	double im = IM (image, x, y);

	FLOATP (result, x, y) = re*re + im*im;
    }
}








|
>

|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
crimp_image* result;
crimp_image* image;

int x, y;

crimp_input (imageObj, image, fpcomplex);

result = crimp_new_float_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	double re = RE (image, x, y);
	double im = IM (image, x, y);

	FLOATP (result, x, y) = re*re + im*im;
    }
}

Changes to operator/sqrt-float.crimp.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {

	FLOATP (result, x, y) = sqrt (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {

	FLOATP (result, x, y) = sqrt (FLOATP (image, x, y));
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/stats-float.crimp.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
size_t n;
int x, y, w, h;
double min, max, var, stddev, mean, middle, sum, sumsq;
int maxx, minx, maxy, miny;

crimp_input (imageObj, image, float);

w = image->w;
h = image->h;
n = crimp_image_area (image);

/* 
 * Scan image
 */

sum = sumsq = 0;







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
size_t n;
int x, y, w, h;
double min, max, var, stddev, mean, middle, sum, sumsq;
int maxx, minx, maxy, miny;

crimp_input (imageObj, image, float);

w = crimp_w (image);
h = crimp_h (image);
n = crimp_image_area (image);

/* 
 * Scan image
 */

sum = sumsq = 0;
Changes to operator/stats-grey16.crimp.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
size_t n;
int x, y, w, h, min, max;
double var, stddev, mean, middle, sum, sumsq;
int maxx, minx, maxy, miny;

crimp_input (imageObj, image, grey16);

w = image->w;
h = image->h;
n = crimp_image_area (image);

/* 
 * Scan image
 */

sum = sumsq = 0;







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
size_t n;
int x, y, w, h, min, max;
double var, stddev, mean, middle, sum, sumsq;
int maxx, minx, maxy, miny;

crimp_input (imageObj, image, grey16);

w = crimp_w (image);
h = crimp_h (image);
n = crimp_image_area (image);

/* 
 * Scan image
 */

sum = sumsq = 0;
Changes to operator/stats-grey32.crimp.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
int x, y, w, h;
Tcl_WideInt min, max;
double var, stddev, mean, middle, sum, sumsq;
int maxx, minx, maxy, miny;

crimp_input (imageObj, image, grey32);

w = image->w;
h = image->h;
n = crimp_image_area (image);

/* 
 * Scan image
 */

sum = sumsq = 0;







|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
int x, y, w, h;
Tcl_WideInt min, max;
double var, stddev, mean, middle, sum, sumsq;
int maxx, minx, maxy, miny;

crimp_input (imageObj, image, grey32);

w = crimp_w (image);
h = crimp_h (image);
n = crimp_image_area (image);

/* 
 * Scan image
 */

sum = sumsq = 0;
Changes to operator/stats-multi.crimp.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
double var, stddev, mean, middle, sum[4], sumsq[4];
int maxx[4], minx[4], maxy[4], miny[4];

crimp_input_any (imageObj, image);
CRIMP_ASSERT_NOTIMGTYPE(image,grey32);
CRIMP_ASSERT_NOTIMGTYPE(image,float);

w = image->w;
h = image->h;
n = crimp_image_area (image);

/* 
 * Scan image
 */

for (c = 0; c < image->itype->channels; c++) {







|
|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
double var, stddev, mean, middle, sum[4], sumsq[4];
int maxx[4], minx[4], maxy[4], miny[4];

crimp_input_any (imageObj, image);
CRIMP_ASSERT_NOTIMGTYPE(image,grey32);
CRIMP_ASSERT_NOTIMGTYPE(image,float);

w = crimp_w (image);
h = crimp_h (image);
n = crimp_image_area (image);

/* 
 * Scan image
 */

for (c = 0; c < image->itype->channels; c++) {
Changes to operator/subtract-float-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-float-grey16.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_grey16.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-float-grey32.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_grey32.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-float-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_float_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-fpcomplex-fpcomplex.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_fpcomplex_fpcomplex.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_fpcomplex_fpcomplex_fpcomplex.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-grey16-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey16_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey16_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey16_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey16_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-grey32-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey32_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey32_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey32_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey32_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-grey8-float.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
float scale
float offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_float_float.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-grey8-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_grey8_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-grey8-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-grey8-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_grey8_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_grey8_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-rgb-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgb_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgb_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgb_grey8_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-rgb-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgb_rgb_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-rgb-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgb_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgb_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgb_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-rgba-grey8.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgba_grey8.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgba_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgba_grey8_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-rgba-rgb.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgba_rgb.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgba_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgba_rgb_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/subtract-rgba-rgba.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
subtract_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj
int scale
int offset

/*
 * Pixel- and channel-wise scaled and biased subtraction of two images. The
 * images have to have equal dimensions. Values out of range are wrapped into
 * it (modulo).
 */

#define BINOP(a,b) ((((a) - (b)) / scale) + offset)
#include "binop_rgba_rgba_rgba.c"
#undef BINOP

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
Changes to operator/threshold-above.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
thresholdg_above
Tcl_Obj* imageObj
double threshold

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = 
	    FLOATP (image, x, y) > threshold 
	    ? 1.0
	    : 0.0
	    ;
    }












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
thresholdg_above
Tcl_Obj* imageObj
double threshold

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = 
	    FLOATP (image, x, y) > threshold 
	    ? 1.0
	    : 0.0
	    ;
    }
Changes to operator/threshold-below.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
thresholdg_below
Tcl_Obj* imageObj
double threshold

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = 
	    FLOATP (image, x, y) > threshold 
	    ? 0.0
	    : 1.0
	    ;
    }












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
thresholdg_below
Tcl_Obj* imageObj
double threshold

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = 
	    FLOATP (image, x, y) > threshold 
	    ? 0.0
	    : 1.0
	    ;
    }
Changes to operator/threshold-float-float.crimp.
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
threshold_float_float
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);
crimp_input (thresholdObj, threshold, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = FLOATP (image, x, y) >= FLOATP (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_float_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_float_float_float.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-float-grey16.crimp.
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
threshold_float_grey16
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);
crimp_input (thresholdObj, threshold, grey16);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = FLOATP (image, x, y) >= GREY16 (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_float_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_float_grey16_float.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-float-grey32.crimp.
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
threshold_float_grey32
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);
crimp_input (thresholdObj, threshold, grey32);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = FLOATP (image, x, y) >= GREY32 (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_float_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_float_grey32_float.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-float-grey8.crimp.
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
threshold_float_grey8
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);
crimp_input (thresholdObj, threshold, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = FLOATP (image, x, y) >= GREY8 (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_float_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_float_grey8_float.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Added operator/threshold-fpcomplex-fpcomplex.crimp.








































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
threshold_fpcomplex_fpcomplex
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj

/*
 * Thresholding of all pixels in the first image by the spatially varying
 * threshold specified through the second image.
 */

#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)
#include "binop_fpcomplex_fpcomplex_fpcomplex.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
Changes to operator/threshold-grey16-float.crimp.
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
threshold_grey16_float
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     grey16);
crimp_input (thresholdObj, threshold, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY16 (result, x, y) = GREY16 (image, x, y) >= FLOATP (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_grey16_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_grey16_float_grey16.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-grey16-grey16.crimp.
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
threshold_grey16_grey16
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     grey16);
crimp_input (thresholdObj, threshold, grey16);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY16 (result, x, y) = GREY16 (image, x, y) >= GREY16 (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_grey16_grey16
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_grey16_grey16_grey16.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-grey32-float.crimp.
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
threshold_grey32_float
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     grey32);
crimp_input (thresholdObj, threshold, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY32 (result, x, y) = GREY32 (image, x, y) >= FLOATP (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_grey32_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_grey32_float_grey32.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-grey32-grey32.crimp.
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
threshold_grey32_grey32
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     grey32);
crimp_input (thresholdObj, threshold, grey32);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY32 (result, x, y) = GREY32 (image, x, y) >= GREY32 (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_grey32_grey32
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_grey32_grey32_grey32.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-grey8-float.crimp.
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
threshold_grey8_float
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     grey8);
crimp_input (thresholdObj, threshold, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY8 (result, x, y) = GREY8 (image, x, y) >= FLOATP (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_grey8_float
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_grey8_float_grey8.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-grey8-grey8.crimp.
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
threshold_grey8_grey8
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     grey8);
crimp_input (thresholdObj, threshold, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	GREY8 (result, x, y) = GREY8 (image, x, y) >= GREY8 (threshold, x, y) 
	    ? BLACK
	    : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_grey8_grey8
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_grey8_grey8_grey8.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Deleted operator/threshold-hsv-float.crimp.
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
threshold_hsv_float
Tcl_Obj* imageObj
Tcl_Obj* thresholdHObj
Tcl_Obj* thresholdSObj
Tcl_Obj* thresholdVObj

crimp_image* image;
crimp_image* thresholdh;
crimp_image* thresholds;
crimp_image* thresholdv;
crimp_image* result;
int          x, y;

crimp_input (imageObj,      image,      hsv);
crimp_input (thresholdHObj, thresholdh, float);
crimp_input (thresholdSObj, thresholds, float);
crimp_input (thresholdVObj, thresholdv, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	H (result, x, y) = H (image, x, y) >= FLOATP (thresholdh, x, y) ? BLACK : WHITE;
	S (result, x, y) = S (image, x, y) >= FLOATP (thresholds, x, y) ? BLACK : WHITE;
	V (result, x, y) = V (image, x, y) >= FLOATP (thresholdv, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted operator/threshold-hsv-grey8.crimp.
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
threshold_hsv_grey8
Tcl_Obj* imageObj
Tcl_Obj* thresholdHObj
Tcl_Obj* thresholdSObj
Tcl_Obj* thresholdVObj

crimp_image* image;
crimp_image* thresholdh;
crimp_image* thresholds;
crimp_image* thresholdv;
crimp_image* result;
int          x, y;

crimp_input (imageObj,      image,      hsv);
crimp_input (thresholdHObj, thresholdh, grey8);
crimp_input (thresholdSObj, thresholds, grey8);
crimp_input (thresholdVObj, thresholdv, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	H (result, x, y) = H (image, x, y) >= GREY8 (thresholdh, x, y) ? BLACK : WHITE;
	S (result, x, y) = S (image, x, y) >= GREY8 (thresholds, x, y) ? BLACK : WHITE;
	V (result, x, y) = V (image, x, y) >= GREY8 (thresholdv, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Changes to operator/threshold-hsv-hsv.crimp.
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
threshold_hsv_hsv
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     hsv);
crimp_input (thresholdObj, threshold, hsv);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	H (result, x, y) = H (image, x, y) >= H (threshold, x, y) ? BLACK : WHITE;
	S (result, x, y) = S (image, x, y) >= S (threshold, x, y) ? BLACK : WHITE;
	V (result, x, y) = V (image, x, y) >= V (threshold, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_hsv_hsv
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_hsv_hsv_hsv.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/threshold-inside.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
thresholdg_inside
Tcl_Obj* imageObj
double min
double max

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = 
	    (min <= FLOATP (image, x, y)) &&
	    (FLOATP (image, x, y) <= max)
	    ? 1.0
	    : 0.0
	    ;













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
thresholdg_inside
Tcl_Obj* imageObj
double min
double max

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = 
	    (min <= FLOATP (image, x, y)) &&
	    (FLOATP (image, x, y) <= max)
	    ? 1.0
	    : 0.0
	    ;
Changes to operator/threshold-outside.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
thresholdg_outside
Tcl_Obj* imageObj
double min
double max

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	FLOATP (result, x, y) = 
	    (min <= FLOATP (image, x, y)) &&
	    (FLOATP (image, x, y) <= max)
	    ? 0.0
	    : 1.0
	    ;













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
thresholdg_outside
Tcl_Obj* imageObj
double min
double max

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     float);

result = crimp_new_like (image);

for (y = 0; y < crimp_h (image); y++) {
    for (x = 0; x < crimp_w (image); x++) {

	FLOATP (result, x, y) = 
	    (min <= FLOATP (image, x, y)) &&
	    (FLOATP (image, x, y) <= max)
	    ? 0.0
	    : 1.0
	    ;
Deleted operator/threshold-rgb-float.crimp.
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
threshold_rgb_float
Tcl_Obj* imageObj
Tcl_Obj* thresholdRObj
Tcl_Obj* thresholdGObj
Tcl_Obj* thresholdBObj

crimp_image* image;
crimp_image* thresholdr;
crimp_image* thresholdg;
crimp_image* thresholdb;
crimp_image* result;
int          x, y;

crimp_input (imageObj,      image,      rgb);
crimp_input (thresholdRObj, thresholdr, float);
crimp_input (thresholdGObj, thresholdg, float);
crimp_input (thresholdBObj, thresholdb, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, y) >= FLOATP (thresholdr, x, y) ? BLACK : WHITE;
	G (result, x, y) = G (image, x, y) >= FLOATP (thresholdg, x, y) ? BLACK : WHITE;
	B (result, x, y) = B (image, x, y) >= FLOATP (thresholdb, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted operator/threshold-rgb-grey8.crimp.
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
threshold_rgb_grey8
Tcl_Obj* imageObj
Tcl_Obj* thresholdRObj
Tcl_Obj* thresholdGObj
Tcl_Obj* thresholdBObj

crimp_image* image;
crimp_image* thresholdr;
crimp_image* thresholdg;
crimp_image* thresholdb;
crimp_image* result;
int          x, y;

crimp_input (imageObj,      image,      rgb);
crimp_input (thresholdRObj, thresholdr, grey8);
crimp_input (thresholdGObj, thresholdg, grey8);
crimp_input (thresholdBObj, thresholdb, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, y) >= GREY8 (thresholdr, x, y) ? BLACK : WHITE;
	G (result, x, y) = G (image, x, y) >= GREY8 (thresholdg, x, y) ? BLACK : WHITE;
	B (result, x, y) = B (image, x, y) >= GREY8 (thresholdb, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Changes to operator/threshold-rgb-rgb.crimp.
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
threshold_rgb_rgb
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     rgb);
crimp_input (thresholdObj, threshold, rgb);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, y) >= R (threshold, x, y) ? BLACK : WHITE;
	G (result, x, y) = G (image, x, y) >= G (threshold, x, y) ? BLACK : WHITE;
	B (result, x, y) = B (image, x, y) >= B (threshold, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8



9

10


11
12
13
14
15
16
17
18
threshold_rgb_rgb
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */





#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_rgb_rgb_rgb.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Deleted operator/threshold-rgba-float.crimp.
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
threshold_rgba_float
Tcl_Obj* imageObj
Tcl_Obj* thresholdRObj
Tcl_Obj* thresholdGObj
Tcl_Obj* thresholdBObj
Tcl_Obj* thresholdAObj

crimp_image* image;
crimp_image* thresholdr;
crimp_image* thresholdg;
crimp_image* thresholdb;
crimp_image* thresholda;
crimp_image* result;
int          x, y;

crimp_input (imageObj,      image,      rgba);
crimp_input (thresholdRObj, thresholdr, float);
crimp_input (thresholdGObj, thresholdg, float);
crimp_input (thresholdBObj, thresholdb, float);
crimp_input (thresholdAObj, thresholda, float);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, y) >= FLOATP (thresholdr, x, y) ? BLACK : WHITE;
	G (result, x, y) = G (image, x, y) >= FLOATP (thresholdg, x, y) ? BLACK : WHITE;
	B (result, x, y) = B (image, x, y) >= FLOATP (thresholdb, x, y) ? BLACK : WHITE;
	A (result, x, y) = A (image, x, y) >= FLOATP (thresholda, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Deleted operator/threshold-rgba-grey8.crimp.
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
threshold_rgba_grey8
Tcl_Obj* imageObj
Tcl_Obj* thresholdRObj
Tcl_Obj* thresholdGObj
Tcl_Obj* thresholdBObj
Tcl_Obj* thresholdAObj

crimp_image* image;
crimp_image* thresholdr;
crimp_image* thresholdg;
crimp_image* thresholdb;
crimp_image* thresholda;
crimp_image* result;
int          x, y;

crimp_input (imageObj,      image,      rgba);
crimp_input (thresholdRObj, thresholdr, grey8);
crimp_input (thresholdGObj, thresholdg, grey8);
crimp_input (thresholdBObj, thresholdb, grey8);
crimp_input (thresholdAObj, thresholda, grey8);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, y) >= GREY8 (thresholdr, x, y) ? BLACK : WHITE;
	G (result, x, y) = G (image, x, y) >= GREY8 (thresholdg, x, y) ? BLACK : WHITE;
	B (result, x, y) = B (image, x, y) >= GREY8 (thresholdb, x, y) ? BLACK : WHITE;
	A (result, x, y) = A (image, x, y) >= GREY8 (thresholda, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Changes to operator/threshold-rgba-rgba.crimp.
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
threshold_rgba_rgba
Tcl_Obj* imageObj
Tcl_Obj* thresholdObj

crimp_image* image;
crimp_image* threshold;
crimp_image* result;
int          x, y;

crimp_input (imageObj,     image,     rgba);
crimp_input (thresholdObj, threshold, rgba);

result = crimp_new_like (image);

for (y = 0; y < image->h; y++) {
    for (x = 0; x < image->w; x++) {

	R (result, x, y) = R (image, x, y) >= R (threshold, x, y) ? BLACK : WHITE;
	G (result, x, y) = G (image, x, y) >= G (threshold, x, y) ? BLACK : WHITE;
	B (result, x, y) = B (image, x, y) >= B (threshold, x, y) ? BLACK : WHITE;
	A (result, x, y) = A (image, x, y) >= A (threshold, x, y) ? BLACK : WHITE;
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;


/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78

|
|

<
<
<
<
|
<
<
|
<
|
<
<
|
<
<
<
<
|
<
|
<
<
|







1
2
3
4




5


6

7


8




9

10


11
12
13
14
15
16
17
18
threshold_rgba_rgba
Tcl_Obj* imageAObj
Tcl_Obj* imageBObj





/*


 * Thresholding of all pixels in the first image by the spatially varying

 * threshold specified through the second image.


 */






#define BINOP(p,t) ((p) >= (t) ? BLACK : WHITE)


#include "binop_rgba_rgba_rgba.c"

/* vim: set sts=4 sw=4 tw=80 et ft=c: */
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
Changes to operator/trace_hysteresis.crimp.
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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey8 (image->w, image->h);


/*
 * Fill with black
 */

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	GREY8(result, x, y) = BLACK;
    }
}

/*
 * Look for high-threshold ridges, then follow these until they sink below
 * suitability
 */

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	if (!GREY8 (result, x, y)  && FLOATP(image, x,y) >= highT) {
	    /*
	     * Found a good candidate. We now follow neighbours until they are
	     * insignificant or joining a ridge already traced out.
	     */
	    int xi, x0, x2, x1 = x;
	    int yi, y0, y2, y1 = y;
	    do {
	    next:
		GREY8(result, x1, y1) = WHITE;

		x0 = (x1 == 0)             ? x1 : x1 - 1;
		x2 = (x1 == (result->w-1)) ? x1 : x1 + 1;
		y0 = (y1 == 0)             ? y1 : y1 - 1;
		y2 = (y1 == (result->h-1)) ? y1 : y1 + 1;

		for (yi = y0; yi <= y2; yi++) {
		    for (xi = x0; xi <= x2; xi++) {
			if ((yi != y1 || xi != x1) &&
			    !GREY8 (result, xi, yi) &&
			    FLOATP (image, xi, yi) >= lowT) {
			    /*







|
>





|
|









|
|












|

|







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

crimp_image* image;
crimp_image* result;
int          x, y;

crimp_input (imageObj, image, float);

result = crimp_new_grey8_at (crimp_x (image), crimp_y (image),
			     crimp_w (image), crimp_h (image));

/*
 * Fill with black
 */

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	GREY8(result, x, y) = BLACK;
    }
}

/*
 * Look for high-threshold ridges, then follow these until they sink below
 * suitability
 */

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	if (!GREY8 (result, x, y)  && FLOATP(image, x,y) >= highT) {
	    /*
	     * Found a good candidate. We now follow neighbours until they are
	     * insignificant or joining a ridge already traced out.
	     */
	    int xi, x0, x2, x1 = x;
	    int yi, y0, y2, y1 = y;
	    do {
	    next:
		GREY8(result, x1, y1) = WHITE;

		x0 = (x1 == 0)             ? x1 : x1 - 1;
		x2 = (x1 == (crimp_w (result)-1)) ? x1 : x1 + 1;
		y0 = (y1 == 0)             ? y1 : y1 - 1;
		y2 = (y1 == (crimp_h (result)-1)) ? y1 : y1 + 1;

		for (yi = y0; yi <= y2; yi++) {
		    for (xi = x0; xi <= x2; xi++) {
			if ((yi != y1 || xi != x1) &&
			    !GREY8 (result, xi, yi) &&
			    FLOATP (image, xi, yi) >= lowT) {
			    /*
Changes to operator/upsample-float.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    FLOATP (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < result->w; xo++) {
	    FLOATP (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|












|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	FLOATP (result, xo, yo) = FLOATP (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    FLOATP (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < crimp_w (result); xo++) {
	    FLOATP (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsample-grey16.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY16 (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < result->w; xo++) {
	    GREY16 (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|












|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	GREY16 (result, xo, yo) = GREY16 (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY16 (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < crimp_w (result); xo++) {
	    GREY16 (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsample-grey32.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY32 (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < result->w; xo++) {
	    GREY32 (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|












|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	GREY32 (result, xo, yo) = GREY32 (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY32 (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < crimp_w (result); xo++) {
	    GREY32 (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsample-grey8.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY8 (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < result->w; xo++) {
	    GREY8 (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|












|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	GREY8 (result, xo, yo) = GREY8 (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY8 (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < crimp_w (result); xo++) {
	    GREY8 (result, xo, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsample-hsv.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = V (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    H (result, xo + dx, yo) = BLACK;
	    S (result, xo + dx, yo) = BLACK;
	    V (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < result->w; xo++) {
	    H (result, xo, yo + dy) = BLACK;
	    S (result, xo, yo + dy) = BLACK;
	    V (result, xo, yo + dy) = BLACK;
	}
    }
}








|

|
|
















|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	H (result, xo, yo) = H (image, xi, yi);
	S (result, xo, yo) = S (image, xi, yi);
	V (result, xo, yo) = V (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    H (result, xo + dx, yo) = BLACK;
	    S (result, xo + dx, yo) = BLACK;
	    V (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < crimp_w (result); xo++) {
	    H (result, xo, yo + dy) = BLACK;
	    S (result, xo, yo + dy) = BLACK;
	    V (result, xo, yo + dy) = BLACK;
	}
    }
}

Changes to operator/upsample-rgb.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    R (result, xo + dx, yo) = BLACK;
	    G (result, xo + dx, yo) = BLACK;
	    B (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < result->w; xo++) {
	    R (result, xo, yo + dy) = BLACK;
	    G (result, xo, yo + dy) = BLACK;
	    B (result, xo, yo + dy) = BLACK;
	}
    }
}








|

|
|
















|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    R (result, xo + dx, yo) = BLACK;
	    G (result, xo + dx, yo) = BLACK;
	    B (result, xo + dx, yo) = BLACK;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < crimp_w (result); xo++) {
	    R (result, xo, yo + dy) = BLACK;
	    G (result, xo, yo + dy) = BLACK;
	    B (result, xo, yo + dy) = BLACK;
	}
    }
}

Changes to operator/upsample-rgba.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
	A (result, xo, yo) = A (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    R (result, xo + dx, yo) = BLACK;
	    G (result, xo + dx, yo) = BLACK;
	    B (result, xo + dx, yo) = BLACK;
	    A (result, xo + dx, yo) = OPAQUE;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < result->w; xo++) {
	    R (result, xo, yo + dy) = BLACK;
	    G (result, xo, yo + dy) = BLACK;
	    B (result, xo, yo + dy) = BLACK;
	    A (result, xo, yo + dy) = OPAQUE;
	}
    }
}







|

|
|


















|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, yo) = R (image, xi, yi);
	G (result, xo, yo) = G (image, xi, yi);
	B (result, xo, yo) = B (image, xi, yi);
	A (result, xo, yo) = A (image, xi, yi);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    R (result, xo + dx, yo) = BLACK;
	    G (result, xo + dx, yo) = BLACK;
	    B (result, xo + dx, yo) = BLACK;
	    A (result, xo + dx, yo) = OPAQUE;
	}
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (xo = 0; xo < crimp_w (result); xo++) {
	    R (result, xo, yo + dy) = BLACK;
	    G (result, xo, yo + dy) = BLACK;
	    B (result, xo, yo + dy) = BLACK;
	    A (result, xo, yo + dy) = OPAQUE;
	}
    }
}
Changes to operator/upsamplex-float.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h);

for (y = 0; y < image->h; y ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	FLOATP (result, xo, y) = FLOATP (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    FLOATP (result, xo + dx, y) = BLACK;







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image));

for (y = 0; y < crimp_h (image); y ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	FLOATP (result, xo, y) = FLOATP (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    FLOATP (result, xo + dx, y) = BLACK;
Changes to operator/upsamplex-grey16.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h);

for (y = 0; y < image->h; y ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	GREY16 (result, xo, y) = GREY16 (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY16 (result, xo + dx, y) = BLACK;







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image));

for (y = 0; y < crimp_h (image); y ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	GREY16 (result, xo, y) = GREY16 (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY16 (result, xo + dx, y) = BLACK;
Changes to operator/upsamplex-grey32.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h);

for (y = 0; y < image->h; y ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	GREY32 (result, xo, y) = GREY32 (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY32 (result, xo + dx, y) = BLACK;







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image));

for (y = 0; y < crimp_h (image); y ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	GREY32 (result, xo, y) = GREY32 (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY32 (result, xo + dx, y) = BLACK;
Changes to operator/upsamplex-grey8.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h);

for (y = 0; y < image->h; y ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	GREY8 (result, xo, y) = GREY8 (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY8 (result, xo + dx, y) = BLACK;







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image));

for (y = 0; y < crimp_h (image); y ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	GREY8 (result, xo, y) = GREY8 (image, xi, y);

	/* And insert factor black (0) pixels after */
	for (dx = 1; dx < factor; dx++) {
	    GREY8 (result, xo + dx, y) = BLACK;
Changes to operator/upsamplex-hsv.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h);

for (y = 0; y < image->h; y ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	H (result, xo, y) = H (image, xi, y);
	S (result, xo, y) = S (image, xi, y);
	V (result, xo, y) = V (image, xi, y);

	/* And insert factor black (0) pixels after */







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image));

for (y = 0; y < crimp_h (image); y ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	H (result, xo, y) = H (image, xi, y);
	S (result, xo, y) = S (image, xi, y);
	V (result, xo, y) = V (image, xi, y);

	/* And insert factor black (0) pixels after */
Changes to operator/upsamplex-rgb.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h);

for (y = 0; y < image->h; y ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);

	/* And insert factor black (0) pixels after */







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image));

for (y = 0; y < crimp_h (image); y ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);

	/* And insert factor black (0) pixels after */
Changes to operator/upsamplex-rgba.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w*factor, image->h);

for (y = 0; y < image->h; y ++) {
    for (xo = 0, xi = 0; xi < image->w; xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);
	A (result, xo, y) = A (image, xi, y);








|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image)*factor, crimp_h (image));

for (y = 0; y < crimp_h (image); y ++) {
    for (xo = 0, xi = 0; xi < crimp_w (image); xo += factor, xi ++) {

	/* Copy the pixel */
	R (result, xo, y) = R (image, xi, y);
	G (result, xo, y) = G (image, xi, y);
	B (result, xo, y) = B (image, xi, y);
	A (result, xo, y) = A (image, xi, y);

Changes to operator/upsampley-float.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (x = 0; x < image->w; x ++) {

	/* Copy the pixel */
	FLOATP (result, x, yo) = FLOATP (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < image->w; x++) {
	    FLOATP (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (x = 0; x < crimp_w (image); x ++) {

	/* Copy the pixel */
	FLOATP (result, x, yo) = FLOATP (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < crimp_w (image); x++) {
	    FLOATP (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsampley-grey16.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (x = 0; x < image->w; x ++) {

	/* Copy the pixel */
	GREY16 (result, x, yo) = GREY16 (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < image->w; x++) {
	    GREY16 (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (x = 0; x < crimp_w (image); x ++) {

	/* Copy the pixel */
	GREY16 (result, x, yo) = GREY16 (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < crimp_w (image); x++) {
	    GREY16 (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsampley-grey32.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (x = 0; x < image->w; x ++) {

	/* Copy the pixel */
	GREY32 (result, x, yo) = GREY32 (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < image->w; x++) {
	    GREY32 (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (x = 0; x < crimp_w (image); x ++) {

	/* Copy the pixel */
	GREY32 (result, x, yo) = GREY32 (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < crimp_w (image); x++) {
	    GREY32 (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsampley-grey8.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (x = 0; x < image->w; x ++) {

	/* Copy the pixel */
	GREY8 (result, x, yo) = GREY8 (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < image->w; x++) {
	    GREY8 (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|







|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (x = 0; x < crimp_w (image); x ++) {

	/* Copy the pixel */
	GREY8 (result, x, yo) = GREY8 (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < crimp_w (image); x++) {
	    GREY8 (result, x, yo + dy) = BLACK;
	}
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/upsampley-hsv.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (x = 0; x < image->w; x ++) {

	/* Copy the pixel */
	H (result, x, yo) = H (image, x, yi);
	S (result, x, yo) = S (image, x, yi);
	V (result, x, yo) = V (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < image->w; x++) {
	    H (result, x, yo + dy) = BLACK;
	    S (result, x, yo + dy) = BLACK;
	    V (result, x, yo + dy) = BLACK;
	}
    }
}








|

|
|









|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (x = 0; x < crimp_w (image); x ++) {

	/* Copy the pixel */
	H (result, x, yo) = H (image, x, yi);
	S (result, x, yo) = S (image, x, yi);
	V (result, x, yo) = V (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < crimp_w (image); x++) {
	    H (result, x, yo + dy) = BLACK;
	    S (result, x, yo + dy) = BLACK;
	    V (result, x, yo + dy) = BLACK;
	}
    }
}

Changes to operator/upsampley-rgb.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (x = 0; x < image->w; x ++) {

	/* Copy the pixel */
	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < image->w; x++) {
	    R (result, x, yo + dy) = BLACK;
	    G (result, x, yo + dy) = BLACK;
	    B (result, x, yo + dy) = BLACK;
	}
    }
}








|

|
|









|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (x = 0; x < crimp_w (image); x ++) {

	/* Copy the pixel */
	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < crimp_w (image); x++) {
	    R (result, x, yo + dy) = BLACK;
	    G (result, x, yo + dy) = BLACK;
	    B (result, x, yo + dy) = BLACK;
	}
    }
}

Changes to operator/upsampley-rgba.crimp.
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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new (image->itype, image->w, image->h*factor);

for (yo = 0, yi = 0; yi < image->h; yo += factor, yi ++) {
    for (x = 0; x < image->w; x ++) {

	/* Copy the pixel */
	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
	A (result, x, yo) = A (image, x, yi);

    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < image->w; x++) {
	    R (result, x, yo + dy) = BLACK;
	    G (result, x, yo + dy) = BLACK;
	    B (result, x, yo + dy) = BLACK;
	    A (result, x, yo + dy) = OPAQUE;
	}
    }
}







|

|
|











|







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
}

if (factor == 1) {
    Tcl_SetObjResult(interp, imageObj);
    return TCL_OK;
}

result = crimp_new_at (image->itype, crimp_x (image), crimp_y (image), crimp_w (image), crimp_h (image)*factor);

for (yo = 0, yi = 0; yi < crimp_h (image); yo += factor, yi ++) {
    for (x = 0; x < crimp_w (image); x ++) {

	/* Copy the pixel */
	R (result, x, yo) = R (image, x, yi);
	G (result, x, yo) = G (image, x, yi);
	B (result, x, yo) = B (image, x, yi);
	A (result, x, yo) = A (image, x, yi);

    }

    /* And insert factor black lines after the intput line*/
    for (dy = 1; dy < factor; dy++) {
	for (x = 0; x < crimp_w (image); x++) {
	    R (result, x, yo + dy) = BLACK;
	    G (result, x, yo + dy) = BLACK;
	    B (result, x, yo + dy) = BLACK;
	    A (result, x, yo + dy) = OPAQUE;
	}
    }
}
Changes to operator/warp-float-field-bicubic.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (FLOATP (image, (ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|

|
|




















|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (FLOATP (image, (ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-float-field-bilinear.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += FLOATP (image, ix, iy) * yf * xf;
                }
            }

	    FLOATP (result, x, y) = val;







|

|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += FLOATP (image, ix, iy) * yf * xf;
                }
            }

	    FLOATP (result, x, y) = val;
Changes to operator/warp-float-field-nneighbour.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	FLOATP (result, x, y) = outside ? BLACK : FLOATP (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|










|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	FLOATP (result, x, y) = outside ? BLACK : FLOATP (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/warp-float-projective-bicubic.crimp.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (FLOATP (image,(ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (FLOATP (image,(ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-float-projective-bilinear.crimp.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += FLOATP (image, ix, iy) * yf * xf;
                }
            }

	    FLOATP (result, x, y) = val;







|

|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += FLOATP (image, ix, iy) * yf * xf;
                }
            }

	    FLOATP (result, x, y) = val;
Changes to operator/warp-float-projective-nneighbour.crimp.
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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	FLOATP (result, x, y) = outside ? BLACK : FLOATP (image, xi, yi);
    }
}

crimp_del (backward);
Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|
|















|







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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	FLOATP (result, x, y) = outside ? BLACK : FLOATP (image, xi, yi);
    }
}

crimp_del (backward);
Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/warp-grey16-field-bicubic.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (GREY16 (image, (ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|

|
|




















|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (GREY16 (image, (ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-grey16-field-bilinear.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += GREY16 (image, ix, iy) * yf * xf;
                }
            }

	    GREY16 (result, x, y) = val;







|

|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += GREY16 (image, ix, iy) * yf * xf;
                }
            }

	    GREY16 (result, x, y) = val;
Changes to operator/warp-grey16-field-nneighbour.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	GREY16 (result, x, y) = outside ? BLACK : GREY16 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|










|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	GREY16 (result, x, y) = outside ? BLACK : GREY16 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/warp-grey16-projective-bicubic.crimp.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (GREY16 (image,(ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (GREY16 (image,(ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-grey16-projective-bilinear.crimp.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += GREY16 (image, ix, iy) * yf * xf;
                }
            }

	    GREY16 (result, x, y) = val;







|

|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += GREY16 (image, ix, iy) * yf * xf;
                }
            }

	    GREY16 (result, x, y) = val;
Changes to operator/warp-grey16-projective-nneighbour.crimp.
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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	GREY16 (result, x, y) = outside ? BLACK : GREY16 (image, xi, yi);
    }
}

crimp_del (backward);
Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|
|















|







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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	GREY16 (result, x, y) = outside ? BLACK : GREY16 (image, xi, yi);
    }
}

crimp_del (backward);
Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/warp-grey32-field-bicubic.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (GREY32 (image, (ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|

|
|




















|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (GREY32 (image, (ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-grey32-field-bilinear.crimp.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels







|

|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += GREY32 (image, ix, iy) * yf * xf;
                }
            }

	    GREY32 (result, x, y) = val;







|

|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += GREY32 (image, ix, iy) * yf * xf;
                }
            }

	    GREY32 (result, x, y) = val;
Changes to operator/warp-grey32-field-nneighbour.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	GREY32 (result, x, y) = outside ? BLACK : GREY32 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;







|

|
|










|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	GREY32 (result, x, y) = outside ? BLACK : GREY32 (image, xi, yi);
    }
}

Tcl_SetObjResult(interp, crimp_new_image_obj (result));
return TCL_OK;
Changes to operator/warp-grey32-projective-bicubic.crimp.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (GREY32 (image,(ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (GREY32 (image,(ixw+(dx)), (iyw+(dy)))))

	{
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-grey32-projective-bilinear.crimp.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += GREY32 (image, ix, iy) * yf * xf;
                }
            }

	    GREY32 (result, x, y) = val;







|

|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

        xf -= ixw;
        yf -= iyw;

	{
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += GREY32 (image, ix, iy) * yf * xf;
                }
            }

	    GREY32 (result, x, y) = val;
Changes to operator/warp-grey32-projective-nneighbour.crimp.
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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	GREY32 (result, x, y) = outside ? BLACK : GREY32 (image, xi, yi);
    }
}

crimp_del (backward);
Tcl_SetObjResult(interp, crimp_new_image_obj (result));







|
|















|







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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	GREY32 (result, x, y) = outside ? BLACK : GREY32 (image, xi, yi);
    }
}

crimp_del (backward);
Tcl_SetObjResult(interp, crimp_new_image_obj (result));
Changes to operator/warp-mbyte-field-bicubic.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (CH (image, c, (ixw+(dx)), (iyw+(dy)))))

        for (c = 0; c < 4; ++c) {
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|

|
|




















|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bicubic interpolation (1,2) using the nearest 4x4 pixels
	 * around the sampling location.
	 *
	 * (Ad 1) http://en.wikipedia.org/wiki/Bicubic_interpolation
	 * (Ad 2) http://www.paulinternet.nl/?page=bicubic
	 */

        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (CH (image, c, (ixw+(dx)), (iyw+(dy)))))

        for (c = 0; c < 4; ++c) {
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-mbyte-field-bilinear.crimp.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels







|

|
|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int ixw, iyw;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	/*
	 * Perform bilinear interpolation (1) using the nearest 2x2 pixels
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

        xf -= ixw;
        yf -= iyw;

        for (c = 0; c < 4; ++c) {
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += CH (image, c, ix, iy) * yf * xf;
                }
            }

	    CH (result, c, x, y) = val;







|

|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

        xf -= ixw;
        yf -= iyw;

        for (c = 0; c < 4; ++c) {
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += CH (image, c, ix, iy) * yf * xf;
                }
            }

	    CH (result, c, x, y) = val;
Changes to operator/warp-mbyte-field-nneighbour.crimp.
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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new (image->itype, xvector->w, xvector->h);

for (y = 0; y < result->h; y++) {
    for (x = 0; x < result->w; x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	for (c = 0; c < image->itype->channels; c++) {
	    CH (result, c, x, y) = outside ? BLACK : CH (image, c, xi, yi);
	}
    }
}








|

|
|










|







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
}

/*
 * Create result and scan through it, sampling the input under the guidance of
 * the coordinate fields.
 */

result = crimp_new_at (image->itype, crimp_x (xvector), crimp_y (xvector), crimp_w (xvector), crimp_h (xvector));

for (y = 0; y < crimp_h (result); y++) {
    for (x = 0; x < crimp_w (result); x++) {
	int xi, yi, outside;

	xf = FLOATP (xvector, x, y);
	yf = FLOATP (yvector, x, y);

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	for (c = 0; c < image->itype->channels; c++) {
	    CH (result, c, x, y) = outside ? BLACK : CH (image, c, xi, yi);
	}
    }
}

Changes to operator/warp-mbyte-projective-bicubic.crimp.
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= image->w) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= image->h)) ? BLACK : (CH (image, c, (ixw+(dx)), (iyw+(dy)))))

        for (c = 0; c < 4; ++c) {
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);







|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
        ixw = xf;  xf -= ixw;
        iyw = yf;  yf -= iyw;

	ixw --; xf += 1.; xf /= 3.;
	iyw --; yf += 1.; yf /= 3.;

#undef  SAMPLE
#define SAMPLE(dx,dy) ((((ixw+(dx)) < 0) || ((ixw+(dx)) >= crimp_w (image)) || ((iyw+(dy)) < 0) || ((iyw+(dy)) >= crimp_h (image))) ? BLACK : (CH (image, c, (ixw+(dx)), (iyw+(dy)))))

        for (c = 0; c < 4; ++c) {
	    double p00 = SAMPLE(0,0);
	    double p01 = SAMPLE(0,1);
	    double p02 = SAMPLE(0,2);
	    double p03 = SAMPLE(0,3);
	    double p10 = SAMPLE(1,0);
Changes to operator/warp-mbyte-projective-bilinear.crimp.
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*







|
|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	int ixw, iyw;

	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

        xf -= ixw;
        yf -= iyw;

        for (c = 0; c < 4; ++c) {
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, image->h); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, image->w); ix++) {
                    xf = 1 - xf;

		    val += CH (image, c, ix, iy) * yf * xf;
                }
            }

	    CH (result, c, x, y) = val;







|

|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

        xf -= ixw;
        yf -= iyw;

        for (c = 0; c < 4; ++c) {
            float val = 0;
	    int ix, iy;
            for (iy = MAX(iyw, 0); iy < MIN(iyw + 2, crimp_h (image)); iy++) {
                yf = 1 - yf;
                for (ix = MAX(ixw, 0); ix < MIN(ixw + 2, crimp_w (image)); ix++) {
                    xf = 1 - xf;

		    val += CH (image, c, ix, iy) * yf * xf;
                }
            }

	    CH (result, c, x, y) = val;
Changes to operator/warp-mbyte-projective-nneighbour.crimp.
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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < result->h; y++, yt++) {
    for (x = 0, xt = origx; x < result->w; x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= image->w) || (yi < 0) || (yi >= image->h);

	for (c = 0; c < image->itype->channels; c++) {
	    CH (result, c, x, y) = outside ? BLACK : CH (image, c, xi, yi);
	}
    }
}








|
|















|







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
/*
 * Determine size of the result, and the location of the origin point inside
 * based on the four corners of the input image and the forward transformation.
 */

result = crimp_geo_warp_init (image, forward, &origx, &origy);

for (y = 0, yt = origy; y < crimp_h (result); y++, yt++) {
    for (x = 0, xt = origx; x < crimp_w (result); x++, xt++) {
	xf = xt;
	yf = yt;
	crimp_geo_warp_point (backward, &xf, &yf);

	/*
	 * Choose the nearest neighbour in x and y to the sampling location as
	 * the source of the pixel.  Use black for when we moved outside the
	 * boundaries of the input.
	 */

	xi = xf;
	yi = yf;
	if ((xf - xi) >= 0.5) xi++;
	if ((yf - yi) >= 0.5) yi++;

	outside = (xi < 0) || (xi >= crimp_w (image)) || (yi < 0) || (yi >= crimp_h (image));

	for (c = 0; c < image->itype->channels; c++) {
	    CH (result, c, x, y) = outside ? BLACK : CH (image, c, xi, yi);
	}
    }
}

Changes to operator/wavy.crimp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
wavy
Tcl_Obj* imageObj float offset float adj1 float adj2

crimp_image*     result;
crimp_image*     image;
int              w, h;

int              oy, ox, c, iy, ix;

crimp_input (imageObj, image, rgba);

w = image->w;
h = image->h;

result = crimp_new_like (image);


for (oy = 0; oy < h; ++oy) {
    for (ox = 0; ox < w; ++ox) {












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
wavy
Tcl_Obj* imageObj float offset float adj1 float adj2

crimp_image*     result;
crimp_image*     image;
int              w, h;

int              oy, ox, c, iy, ix;

crimp_input (imageObj, image, rgba);

w = crimp_w (image);
h = crimp_h (image);

result = crimp_new_like (image);


for (oy = 0; oy < h; ++oy) {
    for (ox = 0; ox < w; ++ox) {

Changes to operator/window_float.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	FLOATP (result, x, y) = FLOATP (image, x, y) * weightx * weighty;
    }
}   








|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	FLOATP (result, x, y) = FLOATP (image, x, y) * weightx * weighty;
    }
}   

Changes to operator/window_fpcomplex.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	RE (result, x, y) = RE (image, x, y) * weightx * weighty;
	IM (result, x, y) = IM (image, x, y) * weightx * weighty;
    }
}   







|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	RE (result, x, y) = RE (image, x, y) * weightx * weighty;
	IM (result, x, y) = IM (image, x, y) * weightx * weighty;
    }
}   
Changes to operator/window_grey16.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	GREY16 (result, x, y) = GREY16 (image, x, y) * weightx * weighty;
    }
}   








|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	GREY16 (result, x, y) = GREY16 (image, x, y) * weightx * weighty;
    }
}   

Changes to operator/window_grey32.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	GREY32 (result, x, y) = GREY32 (image, x, y) * weightx * weighty;
    }
}   








|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	GREY32 (result, x, y) = GREY32 (image, x, y) * weightx * weighty;
    }
}   

Changes to operator/window_grey8.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	GREY8 (result, x, y) = GREY8 (image, x, y) * weightx * weighty;
    }
}   








|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	GREY8 (result, x, y) = GREY8 (image, x, y) * weightx * weighty;
    }
}   

Changes to operator/window_hsv.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	/*
	 * As the windowing is meant to fade pixels towards black we are not
	 * changing the hue, nor saturation, only the value (luma
	 * approximation).







|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	/*
	 * As the windowing is meant to fade pixels towards black we are not
	 * changing the hue, nor saturation, only the value (luma
	 * approximation).
Changes to operator/window_rgb.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	R (result, x, y) = R (image, x, y) * weightx * weighty;
	G (result, x, y) = G (image, x, y) * weightx * weighty;
	B (result, x, y) = B (image, x, y) * weightx * weighty;
    }







|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	R (result, x, y) = R (image, x, y) * weightx * weighty;
	G (result, x, y) = G (image, x, y) * weightx * weighty;
	B (result, x, y) = B (image, x, y) * weightx * weighty;
    }
Changes to operator/window_rgba.crimp.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = image->w / 2.0;
halfh = image->h / 2.0;

for (y = 0; y < image->h; y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < image->w; x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	R (result, x, y) = R (image, x, y) * weightx * weighty;
	G (result, x, y) = G (image, x, y) * weightx * weighty;
	B (result, x, y) = B (image, x, y) * weightx * weighty;
	A (result, x, y) = A (image, x, y);







|
|

|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * outpixel(x,y) = weight(x,width) * weight(y,height) * inpixel(x,y)
 *    where
 *    w(x,range) = 1 - ((x - (range-1)/2) / (range/2))**2
 */

result = crimp_new_like (image);

halfw = crimp_w (image) / 2.0;
halfh = crimp_h (image) / 2.0;

for (y = 0; y < crimp_h (image); y++) {
    tmp     = (y - halfh - 0.5) / halfh;
    weighty =  1.0 - tmp * tmp;

    for (x = 0; x < crimp_w (image); x++) {
	tmp     = (x - halfw - 0.5) / halfw;
	weightx = 1.0 - tmp * tmp;

	R (result, x, y) = R (image, x, y) * weightx * weighty;
	G (result, x, y) = G (image, x, y) * weightx * weighty;
	B (result, x, y) = B (image, x, y) * weightx * weighty;
	A (result, x, y) = A (image, x, y);
Changes to policy.tcl.
725
726
727
728
729
730
731
732
733





734




735





736




737
738
739
740
741
742
743
744
745
746
747
748
749
750

751
752
753
754
755
756
757
758
759
760
761

762
























763
764
765
766
767
768
769
    foreach map $args {
	set xtype [::crimp::TypeOf $map]
	if {$xtype ne $mtype} {
	    return -code error "Map type mismatch between \"$mtype\" and \"$xtype\", all maps have to have the same type."
	}
    }

    set f threshold_${itype}_$mtype
    if {![::crimp::Has $f]} {





	return -code error "Unable to locally threshold images of type \"$itype\" with maps of type \"$mtype\""




    }










    # Shrink or extend the set of thresholding maps if too many or not
    # enough were specified, the latter by replicating the last map.

    switch -- $itype/$mtype {
	hsv/float - rgb/float -
	hsv/grey8 - rgb/grey8 {
	    if {[llength $args]} {
		while {[llength $args] < 3} {
		    lappend args [lindex $args end]
		}
	    }
	    if {[llength $args] > 3} {
		set args [lrange $args 0 2]
	    }

	}
	rgba/float -
	rgba/grey8 {
	    if {[llength $args]} {
		while {[llength $args] < 4} {
		    lappend args [lindex $args end]
		}
	    }
	    if {[llength $args] > 4} {
		set args [lrange $args 0 3]
	    }

	}
























    }

    return [::crimp::$f $image {*}$args]
}

# # ## ### ##### ######## #############








|
|
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
|
<
|
<










>











>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755

756

757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
    foreach map $args {
	set xtype [::crimp::TypeOf $map]
	if {$xtype ne $mtype} {
	    return -code error "Map type mismatch between \"$mtype\" and \"$xtype\", all maps have to have the same type."
	}
    }

    # Multi-channel inputs with single-channel thresholds are handled
    # specially. Not only are we shrinking or extending the set of
    # thresholding maps if too many or not enough were specified (the
    # latter by replicating the last map), but we also have to split
    # the input and then rejoin the results. This may also require us
    # to resize the separate planes to match as the individual binary
    # operations may have left us with results of differing geometries.

    set multi 0
    switch -glob -- $itype/$mtype {
	fpcomplex/fpcomplex - rgba/rgba - rgb/rgb - hsv/hsv {
	    # Nothing to do. Handled later by the generic branch.
	}
	fpcomplex/float -
	fpcomplex/grey8 - {
	    if {[llength $args]} {
		while {[llength $args] < 2} {
		    lappend args [lindex $args end]
		}
	    }
	    if {[llength $args] > 2} {
		set args [lrange $args 0 1]
	    }
	    set multi 1

	}

	hsv/float - rgb/float -
	hsv/grey8 - rgb/grey8 {
	    if {[llength $args]} {
		while {[llength $args] < 3} {
		    lappend args [lindex $args end]
		}
	    }
	    if {[llength $args] > 3} {
		set args [lrange $args 0 2]
	    }
	    set multi 1
	}
	rgba/float -
	rgba/grey8 {
	    if {[llength $args]} {
		while {[llength $args] < 4} {
		    lappend args [lindex $args end]
		}
	    }
	    if {[llength $args] > 4} {
		set args [lrange $args 0 3]
	    }
	    set multi 1
	}
	fpcomplex/* - rgba/* - rgb/* - hsv/* {
	    return -code error "Unable to locally threshold images of type \"$itype\" with maps of type \"$mtype\""
	}
    }

    if {$multi} {
	foreach plane [::crimp::split $image] threshold $args {
	    lappend result [local $plane $threshold]
	}

	# Match geometries... Compute the union bounding box from the
	# result planes, then expand the planes to match it, at last
	# join them.

	set bbox [::crimp::bbox {*}$result]
	foreach plane $result {
	    lappend matched [::crimp::matchgeo $plane $bbox]
	}
	return [::crimp::join::2$itype {*}$matched]
    }

    set f threshold_${itype}_$mtype
    if {![::crimp::Has $f]} {
	return -code error "Unable to locally threshold images of type \"$itype\" with maps of type \"$mtype\""
    }

    return [::crimp::$f $image {*}$args]
}

# # ## ### ##### ######## #############

1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381



1382
1383
1384
1385
1386
1387
1388
1389
    set f    crop_$type
    if {![::crimp::Has $f]} {
	return -code error "Cropping is not supported for images of type \"$type\""
    }
    return [::crimp::$f $image $ww $hn $we $hs]
}

proc ::crimp::cut {image x y w h} {
    lassign [dimensions $image] iw ih
    if {$x < 0} { set x 0 }
    if {$y < 0} { set y 0 }
    set south [expr {$y + $h}]
    set east  [expr {$x + $w}]
    if {$south > $ih} { set south $ih }
    if {$east  > $iw} { set east  $iw }
    set dw [expr {$iw - $east}]
    set dh [expr {$ih - $south}]




    return [crop $image $x $y $dw $dh]
}

# # ## ### ##### ######## #############

namespace eval ::crimp::alpha {
    namespace export *
    namespace ensemble create







|
|
|
|
|
<
<
<
<
<
|
>
>
>
|







1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417





1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
    set f    crop_$type
    if {![::crimp::Has $f]} {
	return -code error "Cropping is not supported for images of type \"$type\""
    }
    return [::crimp::$f $image $ww $hn $we $hs]
}

proc ::crimp::cut {image dx dy w h} {
    set type [TypeOf $image]
    set f    cut_$type
    if {![::crimp::Has $f]} {
	return -code error "Cutting is not supported for images of type \"$type\""





    }
    lassign [::crimp::at $image] ox oy
    incr ox $dx
    incr oy $dy
    return [::crimp::$f $image $ox $oy $w $h]
}

# # ## ### ##### ######## #############

namespace eval ::crimp::alpha {
    namespace export *
    namespace ensemble create
2444
2445
2446
2447
2448
2449
2450

































2451
2452
2453
2454
2455
2456
2457
	return [::crimp::window_$itype  $image]
    } else {
	return -code error "Window function is not supported for image type \"$itype\" "
    }
}

# # ## ### ##### ######## #############


































proc ::crimp::matchsize {image1 image2} {

    lassign [dimensions $image1] w1 h1
    lassign [dimensions $image2] w2 h2

    if { $w1 > $w2 } {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
	return [::crimp::window_$itype  $image]
    } else {
	return -code error "Window function is not supported for image type \"$itype\" "
    }
}

# # ## ### ##### ######## #############

proc ::crimp::matchgeo {image bbox} {
    # Modify the image to match the bounding box. This works only if
    # the image is fully contained in that box. We check this by
    # testing that the union of image and box is the box itself.

    lassign $bbox                           x y w h
    lassign [bbox2 [geometry $image] $bbox] a b c d

    if {($x != $a) || ($y != $b) || ($w != c) || ($h != d)} {
	return -code error "The is image not fully contained in the bounding box to match to."
    }

    lassign [geometry $image] ix iy iw ih

    # Due to the 'contained' check above we can be sure of the
    # following contraints of image geometry to bounding box.

    # (1) ix      >= x
    # (2) iy      >= y
    # (3) (ix+iw) <= (x+w)
    # (4) (iy+ih) <= (y+h)

    # This then provides us easily with the sizes of the various areas
    # by which to extend the image to match that bounding box.

    set w [expr {$ix - $x}]
    set e [expr {$x+$w-$ix-$iw}]
    set n [expr {$iy - $y}]
    set s [expr {$y+$h-$iy-$ih}]

    return [expand const $image $w $n $e $s 0]
}

proc ::crimp::matchsize {image1 image2} {

    lassign [dimensions $image1] w1 h1
    lassign [dimensions $image2] w2 h2

    if { $w1 > $w2 } {
Changes to policy_core.tcl.
25
26
27
28
29
30
31










32
33
34
35
36
37
38
proc ::crimp::Has {name} {
    expr {[namespace which -command ::crimp::$name] ne {}}
}

proc ::crimp::P {fqn} {
    return [lrange [::split [namespace tail $fqn] _] 1 end]
}











# # ## ### ##### ######## ############# #####################
## Importing images into the CRIMP eco-system is handled by the 'read'
## ensemble command. It will have one method per format, handling image
## data in that format. Here we just define the ensemble, and a
## command for the most basic import (Tcl lists).
#







>
>
>
>
>
>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
proc ::crimp::Has {name} {
    expr {[namespace which -command ::crimp::$name] ne {}}
}

proc ::crimp::P {fqn} {
    return [lrange [::split [namespace tail $fqn] _] 1 end]
}

# # ## ### ##### ######## ############# #####################

proc ::crimp::bbox {head args} {
    set bbox [geometry $head]
    foreach image $args {
	set bbox [bbox2 $bbox [geometry $image]]
    }
    return $bbox
}

# # ## ### ##### ######## ############# #####################
## Importing images into the CRIMP eco-system is handled by the 'read'
## ensemble command. It will have one method per format, handling image
## data in that format. Here we just define the ensemble, and a
## command for the most basic import (Tcl lists).
#