#include <dvmbasic.h>
A Byte16Image is a buffer storing 2D array of shorts. Just like a ByteImage, a Byte16Image can be either physical or virtual.
typedef struct Byte16Image {
int width;
int height;
int x;
int y;
int parentWidth;
unsigned char isVirtual;
short *firstByte;
} Byte16Image;
- width
- the width of the Byte16Image
- height
- the height of the Byte16Image
- x
- the x-offset of the top-left corner of the Byte16Image from it's parent.
- y
- the y-offset of the top-left corner of the Byte16Image from it's parent.
- parentWidth
- the width of the physical parent of this Byte16Image. (should be called rootWidth since the parent might not be physical)
- virtual
- 1 iff the Byte16Image is virtual. 0 otherwise.
- firstByte
- pointer to the first short in this Byte16Image.
Return codes from various byte16 primitives. DVM_BYTE16_OK indicates the primitives executed successfully. DVM_BYTE16_ERROR indicates some error has occurs. We may defined more error codes to indicates different type of errors.
#define DVM_BYTE16_OK 0
#define DVM_BYTE16_ERROR 1
Byte16Image *Byte16New (int w, int h)
Create a new physical Byte16Image with w x h shorts and return a pointer to that Byte16Image.
void Byte16Free (Byte16Image *image)
Deallocate image.
Byte16Image *Byte16Clip (Byte16Image *image, int x, int y, int w, int h)
Create a virtual Byte16Image of size w by h, with image as the parent, and offset (x, y) from the upper-left corner of image. A pointer to the new Byte16Image is returned.
void Byte16Reclip (Byte16Image *image, int x, int y, int w, int h, Byte16Image *clipped)
This function is identical to Byte16Clip, except that it destructively modifies the virtual Byte16Image clipped (instead of creating a new virtual Byte16Image). Warning : memory leaks will occurs if clipped is a physical Byte16Image.
void Byte16Copy (Byte16Image *src, Byte16Image *dest)
Copy the top-left w x h area of Byte16Image src into Byte16Image dest, where w and h are minimum width and height of src and dest.
int Byte16GetX(Byte16Image *image)
int Byte16GetY(Byte16Image *image)
int Byte16GetWidth(Byte16Image *image)
int Byte16GetHeight(Byte16Image *image)
int Byte16GetVirtual(Byte16Image *image)
These functions (macros in the C version) access various fields in the Byte16Image data structure. The first two function return the x or y offset of image within its parent, the next two return the width or height of image, and the last function returns 1 if image is virtual, 0 otherwise.
Last updated : Monday, February 01, 1999, 04:44 PM