'ShiftMatrix' |
Print Previous Next |
The shifting function allows you to move the content of the matrix into a given direction. It is declared as follows: void ShiftPixelMatrix(int x, int y, int w, int h, int dir, int step)
Again there are two possibilities. One is used with absolute pixel coordinates and values, and one uses relative coordinates and values between 0 and 1.
The following script for the MAS Script Effect fills the matrix with yellow and draws a red cross onto it during initialization. During the rendering of the content, the whole matrix is shifted downwards. Hence, the cross is moving to the bottom of the matrix. You can simply copy and paste it. void InitEffect() { color colbg ={255,255}; color col ={255}; Clear(colbg); DrawVectorCross(col,0.0,0.0,1.0,1.0); }
void RenderEffect() { ShiftPixelMatrix(0,0,GetMatrixWidth(),GetMatrixHeight(),SHIFT_DOWN,1); }
The script also demonstrates an important behavior of the function. As you can see, the matrix remains yellow, but the cross moves to the bottom. Furthermore, red lines will be drawn on the left and right side. This is due to the fact that the Shift function copies the complete content of the matrix and redraws this picture on the new position. While the the content is moved into the given direction, the original matrix is left unchanged. This leaves the first pixel "line" unchanged in our example.
|
MADRIX Version: 3.6j | Script Version: 2.22 |
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100% |
Print Previous Next |