xp_comm_proj/cine/imgcache.c
/* routine: CreatePixmap
 * purpose: Create pixmap buffer to save frames into
 */
CreatePixmap
purpose: Create pixmap buffer to save frames into
CreatePixmap purpose : Create pixmap buffer to save frames into
static void CreatePixmap( CacheInfo *cache, GDview *view, int frame_out )
{
  int width, height;
  GDwinfo *winfo;
#ifdef MSDOS
  FullBmpInfoT Info;
  LPBITMAPINFOHEADER Hdr = &Info.bmiHeader;
  int *ppvBits;
  int i;
#endif
  winfo = view->Winfo;
  width = winfo->w;
  height = winfo->h;
#ifdef MSDOS
  GdiFlush();
  if( cache->hdcMem == 0 )
    {
      cache->hdcMem = CreateCompatibleDC( winfo->hdc );
      SelectPalette(cache->hdcMem, view->VirtPal->mapinfo->hPalette, FALSE);
      RealizePalette(cache->hdcMem);
    }
  Hdr->biSize = sizeof(BITMAPINFOHEADER);
  Hdr->biPlanes = 1;
  Hdr->biCompression = BI_RGB;
  Hdr->biClrImportant = 0;
  Hdr->biWidth = width;
  Hdr->biHeight = height;
  Hdr->biBitCount = view->VirtPal->depth;
  Hdr->biXPelsPerMeter = winfo->xPPM;
  Hdr->biYPelsPerMeter = winfo->yPPM;
  if( view->VirtPal->depth == 8 )
    {
      Hdr->biSizeImage = width * height;
      Hdr->biClrUsed = 256;
      for (i=0; i<256; i++)
	Info.bmiColors[i] = i;
      cache->pixmaps[frame_out] =
	CreateDIBSection(cache->hdcMem, (LPBITMAPINFO)&Info,
			 DIB_PAL_COLORS, &ppvBits,
			 NULL, 0);
    }
  else
    {
      Hdr->biSizeImage = width * height * 3;
      Hdr->biClrUsed = 0;
      cache->pixmaps[frame_out] =
	CreateDIBSection(cache->hdcMem, (LPBITMAPINFO)&Info,
			 DIB_RGB_COLORS, &ppvBits,
			 NULL, 0);
    }
  if( !cache->pixmaps[frame_out] )
    fprintf( stderr, "CacheProcessTrigger: Unable to allocate pixmap, err = %d\n", GetLastError() );
#else
  cache->disp = winfo->disp;
  cache->pixmaps[frame_out] = (void *)XCreatePixmap(winfo->disp, winfo->window,
					   width, height, view->VirtPal->depth);
#endif
  return;
}
static void CreatePixmap ( CacheInfo * cache , GDview * view , int frame_out ) { int width , height ; GDwinfo * winfo ; #ifdef MSDOS FullBmpInfoT Info ; LPBITMAPINFOHEADER Hdr = & Info . bmiHeader ; int * ppvBits ; int i ; #endif winfo = view -> Winfo ; width = winfo -> w ; height = winfo -> h ; #ifdef MSDOS GdiFlush ( ) ; if ( cache -> hdcMem == 0 ) { cache -> hdcMem = CreateCompatibleDC ( winfo -> hdc ) ; SelectPalette ( cache -> hdcMem , view -> VirtPal -> mapinfo -> hPalette , FALSE ) ; RealizePalette ( cache -> hdcMem ) ; } Hdr -> biSize = sizeof ( BITMAPINFOHEADER ) ; Hdr -> biPlanes = 1 ; Hdr -> biCompression = BI_RGB ; Hdr -> biClrImportant = 0 ; Hdr -> biWidth = width ; Hdr -> biHeight = height ; Hdr -> biBitCount = view -> VirtPal -> depth ; Hdr -> biXPelsPerMeter = winfo -> xPPM ; Hdr -> biYPelsPerMeter = winfo -> yPPM ; if ( view -> VirtPal -> depth == 8 ) { Hdr -> biSizeImage = width * height ; Hdr -> biClrUsed = 256 ; for ( i = 0 ; i < 256 ; i ++ ) Info . bmiColors [ i ] = i ; cache -> pixmaps [ frame_out ] = CreateDIBSection ( cache -> hdcMem , ( LPBITMAPINFO ) & Info , DIB_PAL_COLORS , & ppvBits , NULL , 0 ) ; } else { Hdr -> biSizeImage = width * height * 3 ; Hdr -> biClrUsed = 0 ; cache -> pixmaps [ frame_out ] = CreateDIBSection ( cache -> hdcMem , ( LPBITMAPINFO ) & Info , DIB_RGB_COLORS , & ppvBits , NULL , 0 ) ; } if ( ! cache -> pixmaps [ frame_out ] ) fprintf ( stderr , " \n " , GetLastError ( ) ) ; #else cache -> disp = winfo -> disp ; cache -> pixmaps [ frame_out ] = ( void * ) XCreatePixmap ( winfo -> disp , winfo -> window , width , height , view -> VirtPal -> depth ) ; #endif return ; }
routine: CreatePixmap
 purpose: Create pixmap buffer to save frames into
routine : CreatePixmap purpose : Create pixmap buffer to save frames into