byte_shrink_1x2 src dest
byte_shrink_2x1 src dest
byte_shrink_2x2 src dest
byte_shrink_4x4 src dest
ByteShrinkMxN shrinks src by a factor of M in the horizontal direction and N in the vertical direction. The result is written into dest. Pixels are combined by averaging (i.e., a box filter is used). Upon return, newWidth and newHeight contain the width and height of the resulting image.
For example, to scale a 320x240 image down to 160x120, you would use ByteShrink2x2(). ByteShrink1x2() would scale the same image to 320x120. These functions return a list containing the new width and height of the resulting image.
byte_expand_4x4 src dest
byte_expand_2x2 src dest
byte_expand_1x2 src dest
byte_expand_2x1 src dest
ByteExpandMxN enlarges src by a factor of M in the horizontal direction and N in the vertical direction. The result is written into dest. Pixels are combined by duplication (i.e., the effect is one of "fat-bitting" the pixels) Upon return, newWidth and newHeight contain the width and height of the resulting image.
For example, to scale a 80x60 image up to 320x240, you would use ByteExpand4x4(). These functions return a list containing the new width and height of the resulting image.
byte_scale_bilinear src dest newWidth newHeight
Scale src to fit into an area newWidth x newHeight pixels in dest using bilinear interpolation. The result is written into starting at the upper left corner of dest.
For best results, the overall scaling factor should be between 1/2 and 2. ByteScaleBilinear will produce reasonable results for other factors, but some aliasing may occur. For scaling up or down by more than a factor of two, you should apply ByteShrinkMxN or ByteExpandMxN until the scaling factor is within between 1/2 and 2. Nothing is returned if the operations is successful, otherwise an error is thrown.
byte_rotate_90a src dest
byte_rotate_90c src dest
ByteRotate90a rotates src anti-clockwise by 90 degrees and stores the result in dest. ByteRotate90c rotates src clockwise by 90 degrees.
byte_rotate_orig src dest theta
This function rotates src counter-clockwise by theta degrees around its origin (i.e., the top-left corner of src). The rotated image is stored in dest.
byte_rotate src dest theta x y
This function rotates src counter-clockwise by theta degrees around the point (x,y). The rotated image is stored in dest.
byte_affine src dest a b c d e f
Texture map src using the affine transformation specified by the parameters a..f. The result is written into dest.
The equation of the transform isx' = ax + by + c
where (x,y) are coordinates in src, and (x',y') are coordinates in dest.
y' = dx + ey + f
byte_affine_rect_region src a b c d e f
Return the bounding box that src will map to (in the coordinate system of dest) given the affine coefficients specified. The return value is a list of four numbers, {x y w h}, which give the upper left corner (x,y) and the width and height (w,h) of the box.
byte_homo src dest a b c d e f m n p
Texture map src using the homogeneous transformation specified by the floating point parameters a..p. The result is written into dest.
The equation of the transform isx' = (ax+by+c) / w
where
y' = (dx+ey+f) / ww = mx+ny+p
The coordinates (x,y) are in src, and (x',y') are in the dest.Note: this function assumes that dest is large enough to accomodate the transformed image. It may cause a segmentation fault otherwise.
byte_homo_rect_region src a b c d e f m n p
Return the bounding box (in destination image coordinates) where src will be mapped if it is texture mapped using the given homogeneous matrix coefficients. The return value is a list of four numbers, {x y w h}, which give the upper left corner (x,y) and the width and height (w,h) of the box in the coordinate system of the destination image.
byte_homo_compute_matrix w h x1 y1 x2 y2 x3 y3
Find the homogeneous matrix which transforms the rectangle with corners at (0,0), (w,0), (w,h), (0,h) into the the quadrilateral with coordinates (0,0), (x1,y1), (x2,y2) (x3,y3)
![]()
The return value is a list of six floating point numbers, {a b d e m n}, in the matrixa b 0
d e 0
m n 1An error is generated if no projective transform exists given the value specified.
byte_homo_invert_matrix a b d e m n
Compute the inverse of the homogeneous matrix
a b 0 d e 0 m n 1The return value is a list of six floating point numbers numbers, {a' b' d' e' m' n'} in the matrixa' b' 0
d' e' 0
m' n' 1An error is generated if the matrix passed has no inverse
Last updated : Saturday, November 14, 1998, 07:50 PM