示例#1
0
/* Refill all image data buffers with refreshed data. */
int MidasGL::fill_viewdata( MidasView *vw)
{
  int i;
  int refz = VW->xtype == XTYPE_XREF ? vw->zsize : vw->refz;

  Islice *curSlice  = midasGetSlice(vw, MIDAS_SLICE_CURRENT);

  unsigned char *currImageData;
  unsigned char *prevImageData;
  currImageData = curSlice->data.b;

  /* set previous image data pointer. */
  prevImageData = midasGetPrevImage(vw);

  if (vw->vmode == MIDAS_VIEW_COLOR){

    /* Fill each channel from the indicated image */
    for (i = 0; i < 3; i++) {
      if (vw->imageForChannel[i] == 2)
        fill_rgb(currImageData, vw->id, vw->xysize, i + 1, &vw->tr[vw->cz]);
      else if (vw->imageForChannel[i] == 1)
        fill_rgb(prevImageData, vw->id, vw->xysize, i + 1, &vw->tr[refz]);
      else
        fill_rgb(NULL, vw->id, vw->xysize, i + 1, &vw->tr[refz]);
    }
    return(0);
  }	  
     
  if (vw->vmode == MIDAS_VIEW_SINGLE){
    if (vw->showref){
      fill_rgb(prevImageData, vw->id, vw->xysize, 0, &vw->tr[refz]);
    }else{
      fill_rgb(currImageData, vw->id, vw->xysize, 0, &vw->tr[vw->cz]);
    }
  }

  return 0;
}
示例#2
0
/* 
 *  update the just transformed slice,
 *  The slice must already be transformed if needed because a slice may be returned
 * that needs shifting
 */
int MidasGL::update_slice_view(void)
{
  int i;
  Islice *curSlice = midasGetSlice(VW, MIDAS_SLICE_CURRENT);

  if (VW->vmode == MIDAS_VIEW_SINGLE)
    fill_viewdata(VW);

  if (VW->vmode == MIDAS_VIEW_COLOR) {
    for (i = 0; i < 3; i++) {
      if (VW->imageForChannel[i] == 2)
        fill_rgb(curSlice->data.b, VW->id, VW->xysize, i + 1, &VW->tr[VW->cz]);
    }
  }
  draw();
  return(0);
}
示例#3
0
uint8 DRAW_generate_map( NextWorld::WorldUnit unit[][1024], NextWorld::WorldBase* world )
{
static int f_idx = 0;
bmp_file_header_type    file_header;
bmp_info_type           info_header;
FILE*   fp;
char    filename[128];
int i, j;
int ofset = PIXEL_PER_POINT / 2;
//w = 16;
//h = 9;
color_type* rgb;
get_default_info_header(&info_header, world->mWidth, world->mHeight);
get_header( &file_header, &info_header );

rgb = (color_type*)malloc(info_header.biWidth * 3);

snprintf( filename, 128, "%s_%d.bmp", DEFAULT_MAP_NAME, f_idx );
f_idx++;
fp = fopen(filename, "wb");
if(fp == NULL)
    {
    return 0;
    }

memset(rgb, 0x0, info_header.biWidth * 3);
fwrite(&file_header, sizeof(file_header), 1, fp );
fwrite(&info_header, sizeof(info_header), 1, fp );
printf("%d x %d: %d[%d]\n ",info_header.biWidth, info_header.biHeight, file_header.bfSize, info_header.biSizeImage);
for(i = 0; i < world->mHeight ;i ++)
    {
    fill_rgb(rgb, unit[i], world, info_header.biWidth);
    fwrite(rgb, info_header.biWidth * 3, 1, fp);
    fwrite(rgb, info_header.biWidth * 3, 1, fp);
    }


fclose(fp);

return 0;
}