imCopy

copy src image from copy_reg to dst image in paste_pos with repack

  1. void imCopy(ref Image dst, in Vector!(A, T) paste_pos, in Image src, in Region!(B, E) copy_reg, ImRepack repack = ImRepack.NONE, size_t[2] repack_dim = [0, 1])
    void
    imCopy
    (
    string file = __FILE__
    size_t line = __LINE__
    size_t A
    size_t B
    T
    E
    )
    (
    ,
    in Vector!(A, T) paste_pos
    ,,
    in Region!(B, E) copy_reg
    ,,
    size_t[2] repack_dim = [0, 1]
    )
    if (
    isIntegral!T &&
    isIntegral!E
    )
  2. void imCopy(ref Image dst, in Vector!(A, T) paste_pos, in Image src, ImRepack repack = ImRepack.NONE, size_t[2] repack_dim = [0, 1])

Examples

1 auto etype = ElemInfo( 1, DataType.INT );
2 auto dst = Image( ivec2(3,3), etype );
3 
4 auto src = Image( ivec2(2,2), etype, [ 1,2, 3,4 ]);
5 
6 imCopy( dst, ivec2(1,1), src, CrdRegionD(0,0,2,2), ImRepack.ROT90 );
7 
8 assertEq( dst.data, [ 0,0,0,
9                       0,2,4,
10                       0,1,3 ] );
11 
12 imCopy( dst, ivec2(0,0), src, CrdRegionD(0,0,2,2), ImRepack.ROT270 );
13 
14 assertEq( dst.data, [ 3,1,0,
15                       4,2,4,
16                       0,1,3 ] );
1 auto etype = ElemInfo( 1, DataType.INT );
2 auto dst = Image( ivec3(3,3,3), etype );
3 auto src = Image( CrdVectorD(3), etype, [1,2,4] );
4 
5 imCopy( dst, ivec3(0,0,0), src, CrdRegionD(0,0,0,3,1,1), ImRepack.ROT270 );
6 assertEq( dst.mapAs!int, [ 1,0,0,
7                            2,0,0,
8                            4,0,0, // z=0
9 
10                            0,0,0,
11                            0,0,0,
12                            0,0,0, // z=1
13 
14                            0,0,0,
15                            0,0,0,
16                            0,0,0, // z=2
17                          ] );
18 
19 imCopy( dst, ivec3(1,0,0), src, CrdRegionD(0,0,0,3,1,1), ImRepack.ROT90, [0,2] );
20 assertEq( dst.mapAs!int, [ 1,4,0,
21                            2,0,0,
22                            4,0,0, // z=0
23 
24                            0,2,0,
25                            0,0,0,
26                            0,0,0, // z=1
27 
28                            0,1,0,
29                            0,0,0,
30                            0,0,0, // z=2
31                          ] );
1 auto etype = ElemInfo( 1, DataType.INT );
2 auto dst = Image( ivec3(3,3,3), etype );
3 auto src = Image( CrdVectorD(3), etype, [1,2,4] );
4 
5 imCopy( dst, ivec3(1,0,0), src, CrdRegionD(1,0,0,2,1,1), ImRepack.ROT270 );
6 assertEq( dst.mapAs!int, [ 0,2,0,
7                            0,4,0,
8                            0,0,0, // z=0
9 
10                            0,0,0,
11                            0,0,0,
12                            0,0,0, // z=1
13 
14                            0,0,0,
15                            0,0,0,
16                            0,0,0, // z=2
17                          ] );

Meta