Dali: ByteImage -- C API

[ Header Files | Types | Constants | Allocation | Initialization | Query | See Also ]

Header Files

#include <dvmbasic.h>

Type Definitions

ByteImage

A ByteImage stores a 2 dimensional array of pixels. Each pixel can take value between 0 and 255, inclusive. ByteImages can be physical or virtual. When a physical ByteImage is created (via a call to ByteNew), memory is allocated for the header structure and the array. When a virtual ByteImage is allocated (via a call to ByteClip), memory is allocated for the header, but the array data is shared with a physical ByteImage. Thus, the pixel array is contiguous in physical ByteImages, but usually not contiguous in virtual ByteImages.

    typedef struct ByteImage {
        int width;
        int height;
        int x;
        int y;
        int parentWidth;
        unsigned char isVirtual;
        unsigned char *firstByte;
    } ByteImage;
  
width
the width of the ByteImage
height
the height of the ByteImage
x
the x-offset of the top-left corner of the ByteImage from it's parent. 0 if the ByteImage is a physical ByteImage.
y
the y-offset of the top-left corner of the ByteImage from it's parent. 0 if the ByteImage is a physical ByteImage.
parentWidth
the width of the physical parent of this ByteImage. (should probably be called "rootWidth" since the parent might not be physical)
isVirtual
1 iff the ByteImage is virtual. 0 otherwise.
firstByte
pointer to the first byte in the buffer.

Constants

Return Code

Return code from various byte primitives. DVM_BYTE_OK indicates the primitives executed succesfully. DVM_BYTE_ERROR indicates that an error has occured.

    #define DVM_BYTE_OK 0
    #define DVM_BYTE_ERROR 1
  

Operators

Allocation

ByteImage *ByteNew(int w, int h)

ByteImage *ByteClip (ByteImage *byteImage, int x, int y, int w, int h)

void ByteReclip (ByteImage *byteImage, int x, int y, int w, int h, ByteImage *clipped)

void ByteFree (ByteImage *byteImage)


Initialization

void ByteSet (ByteImage *byteImage, unsigned char value)
void ByteSetWithMask (ByteImage *byteImage, BitImage *bitMask, unsigned char value)

void ByteSetMux1 (ByteImage *byteImage, int offset, int stride, unsigned char value)
void ByteSetMux2 (ByteImage *byteImage, int offset, int stride, unsigned char value)
void ByteSetMux4 (ByteImage *byteImage, int offset, int stride, unsigned char value)

void ByteCopy (ByteImage *src, ByteImage *dest)
void ByteCopyWithMask (ByteImage *src, BitImage *bitMask, ByteImage *dest)

void ByteCopyMux1 (ByteImage *src, int srcOffset, int srcStride, ByteImage *dest, int destOffset, int destStride)
void ByteCopyMux2 (ByteImage *src, int srcOffset, int srcStride, ByteImage *dest, int destOffset, int destStride)
void ByteCopyMux4 (ByteImage *src, int srcOffset, int srcStride, ByteImage *dest, int destOffset, int destStride)

void ByteExtend (ByteImage *byteImage, int bw, int bh)


Query

int ByteGetX(ByteImage *byteImage)
int ByteGetY(ByteImage *byteImage)
int ByteGetWidth(ByteImage *byteImage)
int ByteGetHeight(ByteImage *byteImage)
int ByteGetVirtual(ByteImage *byteImage)

int ByteHash(ByteImage *byteImage)


See Also

BitImage , BitImageScan API , ByteGeom Package API


Last updated : Sunday, January 31, 1999, 05:56 PM