VCLinux Library Documentation  2.3.1
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Pixel based Image Data
+ Collaboration diagram for Pixel based Image Data:


 Types of Image Data

Data Structures

struct  image
 Main Structure for Describing Pixel Images. More...

Detailed Description


Images are usually represented by a two-dimensional set of pixels. Since computer memories always have a linear structure, image data is saved in sequence, the pixels are stored in the same order as characters in a (western) book: The image origin is located at position (0,0). This pixel corresponds to the image start address st at the upper left corner. Increasing the x value by one will lead to the next pixel column to the right, increasing the y value by one will lead to the next pixel row downwards. An image consists of dx pixel in the horizontal direction and dy pixel in the vertical direction. Note that the 'last' viewable pixel lies at (dx-1, dy-1).

pitch defines the pixel count going from one pixel to its lower neighbouring pixel (which has the meaning of 'raise the y-value by one'). The advantage of such a parameter – instead of simply adding dx – lies in the ability to define sub-images of a larger image: The pitch of the larger image is also used as pitch for the sub-image, but the dimensions of the sub-image are set to a smaller value, and the start address pointer of the sub-image is set to an address within the larger image. It is clear that pitch must always be equal or greater than dx.


Therefore the address of a pixel should always be calculated using the following formula:

\[ \textsl{pPx}_{(x,y)}\/ = \texttt{st}\/ + [(y) * \texttt{pitch}\/] + (x). \]

Here, st is the start address of the video memory area (where also the data of the pixel at position (0,0) lies), x and y are the coordinates of the pixel to be addressed by pPx.

Data Structure Documentation

struct image

This structure describes the type of the image, its dimensions and its location in memory. It is the most important structure of the VCLıb.

Data Fields
U8 * st

Image Data Start Address (Channel 0 Pixel Data).

U32 type

Type of Image Data, Listed in 'Types of Image Data'.

I32 dx

Horizontal Visible Pixel Count.

I32 dy

Vertical Visible Pixel Count.

I32 pitch

Address Offset from a Pixel to its Lower Neighbour Pixel.

U8 * ccmp1

Color Component 1 (Channel 1 Pixel Data).

U8 * ccmp2

Color Component 2 (Channel 2 Pixel Data).