Cirrus Logic CS485 Especificaciones Pagina 105

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 319
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 104
Image Creation and Access
4-51
4
The dimensions of the converted IplImage should be greater than or
equal to that of the DIB image. When the converted image is larger
than the DIB image, the origins of
IplImage and the DIB image are
made coincident for the purposes of copying.
When converting a DIB RGBA image, the destination
IplImage
should also contain an alpha channel.
Example 4-9 Converting a DIB Image Into an IplImage
int example48( void ) {
BITMAPINFO *dib; // pointer to bitmap
RGBQUAD *rgb; // pointer to bitmap colors
unsigned char *data; // pointer to bitmap data
BITMAPINFOHEADER *dibh; // header beginning
IplImage *img = NULL;
int i;
__try {
int size = HEIGHT * ((WIDTH+3) & ~3);
// allocate memory for bitmap
dib = malloc(sizeof(BITMAPINFOHEADER)
+ sizeof(RGBQUAD)*256 + size );
if( NULL == dib ) return 0;
// define corresponedt pointers
dibh = (BITMAPINFOHEADER*)dib;
rgb=(RGBQUAD*)((char*)dib + sizeof(BITMAPINFOHEADER));
data = (unsigned char*)((char*)rgb +
sizeof(RGBQUAD)*256);
// define bitmap
dibh->biSize = sizeof(BITMAPINFOHEADER);
dibh->biWidth = WIDTH;
dibh->biHeight = HEIGHT;
dibh->biPlanes = 1;
dibh->biBitCount = 8;
continued
Vista de pagina 104
1 2 ... 100 101 102 103 104 105 106 107 108 109 110 ... 318 319

Comentarios a estos manuales

Sin comentarios