AKTIVE

indexed.tcl at trunk
Login

indexed.tcl at trunk

File etc/generator/virtual/indexed.tcl artifact 2abeee7ef5 on branch trunk


     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
## -*- mode: tcl ; fill-column: 90 -*-
# # ## ### ##### ######## ############# #####################
## Generators -- Virtual Image - Pixels proclaim their location

operator image::indexed {
    section generator virtual

    # !xref-mark indexed
    example {          width 5 height 5 | -int -matrix}
    example {x -5 y -5 width 8 height 8 | -int -matrix}
    # !xref-mark /end

    note Returns a 2-band image where each pixel declares its own position.

    note __Note__ that while the result is usable as a warp map for \
	the "<!xref aktive op warp map>" operation, it will not do \
	anything, as it represents the identity warping.

    int? 0 x      X location of the returned image in the 2D plane
    int? 0 y      Y location of the returned image in the 2D plane
    uint   width  Width of the returned image
    uint   height Height of the returned image

    state -setup {
	aktive_geometry_set (domain, param->x, param->y, param->width, param->height, 2);
    }

    blit indexed {
	{AH {y AY 1 up} {y SY 1 up}}
	{AW {x AX 1 up} {x SX 1 up}}
	{DD {z  0 1 up} {z  0 1 up}}
    } {point {
	(z == 0) ? ((int) x) : ((int) y)
    }}

    pixels {
	#define SD (idomain->depth)
	#define SH (idomain->height)
	#define SW (idomain->width)
	#define SX (request->x)
	#define SY (request->y)
	@@indexed@@
    }
}

##
# # ## ### ##### ######## ############# #####################
::return