示例#1
0
FrameBufferImage FrameBufferImage::New(unsigned int width, unsigned int height, Pixel::Format pixelformat, ReleasePolicy releasePolicy, RenderBuffer::Format bufferformat)
{
  Dali::Vector2 stageSize = Stage::GetCurrent().GetSize();
  Internal::FrameBufferImagePtr internal = Internal::FrameBufferImage::New(
    (0 == width) ? stageSize.width : width,
    (0 == height) ? stageSize.height : height,
    pixelformat,
    releasePolicy,
    bufferformat);

  return FrameBufferImage(internal.Get());
}
示例#2
0
文件: image.c 项目: ajribeiro/VT_RST3
int SplotImage(struct Splot *ptr,
	      struct PlotMatrix *matrix,
              struct FrameBuffer *img,
	      unsigned  char mask,
              float x,float y,int sflg) {
  

  if (ptr==NULL) return -1;
  if (ptr->ps.ptr !=NULL) {
    struct PostScriptMatrix psmatrix;
    struct PostScriptMatrix *mptr=NULL;

    if (matrix !=NULL) {
       psmatrix.a=matrix->a;
       psmatrix.b=matrix->b;
       psmatrix.c=matrix->c;
       psmatrix.d=matrix->d;
       mptr=&psmatrix;
     }
     return PostScriptImage(ptr->ps.ptr,mptr,img,mask,x,y,ptr->ps.clip);
  }

  if (ptr->fb.ptr !=NULL) { 
    struct FrameBuffer *iptr;
    struct FrameBufferMatrix fbmatrix;
    struct FrameBufferMatrix *mptr=NULL;

    iptr=*(ptr->fb.ptr);
    if (iptr==NULL) return -1;


    if (matrix !=NULL) {
      fbmatrix.a=matrix->a;
      fbmatrix.b=matrix->b;
      fbmatrix.c=matrix->c;
      fbmatrix.d=matrix->d;
      mptr=&fbmatrix;
    }
    return FrameBufferImage(iptr,mptr,img,mask,x,y,sflg,ptr->fb.clip);
  }



  return 0;
}
示例#3
0
int main(int argc,char *argv[]) {
  
  int arg=0;
  FILE *fp;
  struct FrameBuffer *src=NULL;
  struct FrameBuffer *dst=NULL;

  unsigned int bgcolor=0;
  char *bgtxt=NULL;

  unsigned alpha=0;

  unsigned char help=0;
  unsigned char option=0;

 
  OptionAdd(&opt,"-help",'x',&help);
  OptionAdd(&opt,"-option",'x',&option);

  OptionAdd(&opt,"bgcol",'t',&bgtxt);
  OptionAdd(&opt,"alpha",'x',&alpha);
   
  arg=OptionProcess(1,argc,argv,&opt,NULL);   

  if (help==1) {
    OptionPrintInfo(stdout,hlpstr);
    exit(0);
  }

  if (option==1) {
    OptionDump(stdout,&opt);
    exit(0);
  }

  if (arg<argc) {
    fp=fopen(argv[arg],"r");
    if (fp==NULL) {
      fprintf(stderr,"Error opening file.\n");
      exit(-1);
    }
  } else fp=stdin;

  bgcolor=FrameBufferColor(0x00,0x00,0x00,0x00);

  if (bgtxt !=NULL) {
     sscanf(bgtxt,"%x",&bgcolor);
  }

  while ((src=FrameBufferLoadPNG(fp,"image")) !=NULL) {
 
    if (bgcolor !=0) {
      if (dst==NULL) {
        dst=FrameBufferMake(NULL,src->wdt,src->hgt,24);
         if (dst==NULL) {
          fprintf(stderr,"Error creating image.\n");
          exit(-1);
         }
      }
      FrameBufferClear(dst,bgcolor,0x0f);
      FrameBufferImage(dst,NULL,src,0x0f,0,0,0,NULL); 
      if (alpha==0) FrameBufferSavePPM(dst,stdout);
      else  FrameBufferSavePPMAlpha(dst,stdout);
    } else {
      if (alpha==0) FrameBufferSavePPM(src,stdout);
      else FrameBufferSavePPMAlpha(src,stdout);
    }
    FrameBufferFree(src);
    src=NULL;
  }


  if (arg<argc) fclose(fp);



  return 0;
}
示例#4
0
int main(int argc,char *argv[]) {
  
  
  int arg=0;
  FILE *fp;
  
  struct FrameBuffer *src=NULL;
  struct FrameBuffer *dst=NULL;
  struct FrameBufferMatrix m;
 
  unsigned char sflg=0;
  float wdt=-1;
  float hgt=-1;
  float sf=1.0;


  unsigned char help=0;
  unsigned char option=0;


 
  OptionAdd(&opt,"-help",'x',&help);
  OptionAdd(&opt,"-option",'x',&option);

  OptionAdd(&opt,"smooth",'x',&sflg);
  OptionAdd(&opt,"wdt",'f',&wdt);
  OptionAdd(&opt,"hgt",'f',&hgt);
   OptionAdd(&opt,"sf",'f',&sf);
  
  arg=OptionProcess(1,argc,argv,&opt,NULL);   

  if (help==1) {
    OptionPrintInfo(stdout,hlpstr);
    exit(0);
  }

  if (option==1) {
    OptionDump(stdout,&opt);
    exit(0);
  }


  if (arg<argc) {
    fp=fopen(argv[arg],"r");
    if (fp==NULL) {
      fprintf(stderr,"Error opening file.\n");
      exit(-1);
    }
  } else fp=stdin;

  while ((src=FrameBufferLoadPPMX(fp)) !=NULL) {

    if (dst==NULL) {
      if ((wdt==-1) && (hgt==-1)) {
         wdt=src->wdt*sf;
         hgt=src->hgt*sf;
      } else if (wdt==-1) {
         wdt=src->wdt*hgt/src->hgt;
      } else if (hgt==-1) {
         hgt=src->hgt*wdt/src->wdt;
      }
      if ((wdt==0) || (hgt==0)) {
        fprintf(stderr,"Invalid image size.\n");
        exit(-1);
      }
      dst=FrameBufferMake(NULL,wdt,hgt,src->depth);
    }

    if ((wdt==src->wdt) && (hgt==src->hgt))
      FrameBufferImage(dst,NULL,src,0xf0,0,0,0,NULL);  
    else {
      float xsc=wdt/src->wdt;
      float ysc=hgt/src->hgt;
      m.a=xsc;
      m.b=0;
      m.c=0;
      m.d=ysc;
      FrameBufferImage(dst,&m,src,0xf0,0,0,sflg,NULL); 
    }
 
    FrameBufferSavePPMX(dst,stdout); 

    FrameBufferFree(src);
    src=NULL;
  }

  if (arg<argc) fclose(fp);



  return 0;
}
示例#5
0
int main(int argc,char *argv[]) {
  char lbuf[256];
  int s=0;
  int arg=0;
  FILE *fp;
  struct FrameBuffer *src=NULL;
  struct FrameBuffer *dst=NULL;

  struct XMLdata *xmldata=NULL;
  struct FrameBufferXML xmlimg;

  unsigned int bgcolor=0;
  char *bgtxt=NULL;

  unsigned char alpha=0;

  unsigned char help=0;
  unsigned char option=0;

 
  OptionAdd(&opt,"-help",'x',&help);
  OptionAdd(&opt,"-option",'x',&option);

  OptionAdd(&opt,"bgcol",'t',&bgtxt);
  OptionAdd(&opt,"alpha",'x',&alpha);
   
  arg=OptionProcess(1,argc,argv,&opt,NULL);   

  if (help==1) {
    OptionPrintInfo(stdout,hlpstr);
    exit(0);
  }

  if (option==1) {
    OptionDump(stdout,&opt);
    exit(0);
  }

  xmldata=XMLMake();
  xmlimg.xml=xmldata;
  xmlimg.img=&src;

  XMLSetStart(xmldata,FrameBufferXMLStart,&xmlimg);
  XMLSetEnd(xmldata,FrameBufferXMLEnd,&xmlimg);

  if (arg<argc) {
    fp=fopen(argv[arg],"r");
    if (fp==NULL) {
      fprintf(stderr,"Error opening file.\n");
      exit(-1);
    }
  } else fp=stdin;

  while(fgets(lbuf,255,fp) !=NULL) {
    s=XMLDecode(xmldata,lbuf,strlen(lbuf));
    if (s !=0) break;
  }
  if (s !=0) {
    fprintf(stderr,"Error decoding image.\n");
    exit(-1);
  }
  if (arg<argc) fclose(fp);

  bgcolor=FrameBufferColor(0x00,0x00,0x00,0x00);


  if (bgtxt !=NULL) {
     sscanf(bgtxt,"%x",&bgcolor);
  }

  if (src==NULL) {
    fprintf(stderr,"Error decoding image.\n");
    exit(-1);
  }



  if (bgcolor !=0) {
    dst=FrameBufferMake(NULL,src->wdt,src->hgt,24);
    if (dst==NULL) {
      fprintf(stderr,"Error creating image.\n");
      exit(-1);
    }
    FrameBufferClear(dst,bgcolor,0x0f);
    FrameBufferImage(dst,NULL,src,0x0f,0,0,0,NULL);
    if (alpha==0) FrameBufferSavePPM(dst,stdout);
    else FrameBufferSavePPMAlpha(dst,stdout);
  } else {
    if (alpha==0)  FrameBufferSavePPM(src,stdout);
    else FrameBufferSavePPMAlpha(src,stdout);
  }


  



  return 0;
}
示例#6
0
FrameBufferImage FrameBufferImage::DownCast( BaseHandle handle )
{
  return FrameBufferImage( dynamic_cast<Dali::Internal::FrameBufferImage*>(handle.GetObjectPtr()) );
}
示例#7
0
FrameBufferImage FrameBufferImage::New( NativeImageInterface& image )
{
  Internal::FrameBufferImagePtr internal = Internal::FrameBufferImage::New( image );
  return FrameBufferImage(internal.Get());
}
示例#8
0
FrameBufferImage FrameBufferImage::New( NativeImageInterface& image, ReleasePolicy releasePolicy )
{
  Internal::FrameBufferImagePtr internal = Internal::FrameBufferImage::New( image, releasePolicy );
  return FrameBufferImage(internal.Get());
}
示例#9
0
文件: ppmxd.c 项目: ajribeiro/VT_RST3
int main(int argc,char *argv[]) {

#ifdef _XLIB_
  char *name="ppmxd";
  int xdf=0;
  struct XwinDisplay *dp;
  struct XwinWindow *win;
  char *display_name=NULL;
  int xdoff=-1;
  int ydoff=-1;
#endif

  int arg=0;
  FILE *fp;

  unsigned int bgcolor=0;
  struct FrameBufferMatrix m;
  struct FrameBuffer *src=NULL;
  struct FrameBuffer *dst=NULL;
 
  char *bgtxt=NULL;
  unsigned char cflg=0;
  unsigned char sflg=0;
  float scale=100;

  float wdt=-1;
  float hgt=-1;
  unsigned char help=0;
  unsigned char option=0;

 
  OptionAdd(&opt,"-help",'x',&help);
  OptionAdd(&opt,"-option",'x',&option);

  OptionAdd(&opt,"smooth",'x',&sflg);
  OptionAdd(&opt,"scale",'f',&scale);
  OptionAdd(&opt,"check",'x',&cflg);
  OptionAdd(&opt,"bgcol",'t',&bgtxt);


#ifdef _XLIB_ 
  OptionAdd(&opt,"display",'t',&display_name);
  OptionAdd(&opt,"xoff",'i',&xdoff);
  OptionAdd(&opt,"yoff",'i',&ydoff);
#endif

  arg=OptionProcess(1,argc,argv,&opt,NULL);   

  if (help==1) {
    OptionPrintInfo(stdout,hlpstr);
    exit(0);
  }

  if (option==1) {
    OptionDump(stdout,&opt);
    exit(0);
  }

 

  if (arg<argc) {
    fp=fopen(argv[arg],"r");
    if (fp==NULL) {
      fprintf(stderr,"Error opening file.\n");
      exit(-1);
    }
  } else fp=stdin;
 
  src=FrameBufferLoadPPMX(fp);

  if (src==NULL) {
    fprintf(stderr,"Error decoding image.\n");
    exit(-1);
  }
  if (arg<argc) fclose(fp);

  bgcolor=FrameBufferColor(0x00,0x00,0x00,0xff);

  if (bgtxt !=NULL) {
     sscanf(bgtxt,"%x",&bgcolor);
     bgcolor=bgcolor | 0xff000000;
  }
  
  
  if (scale<=0) scale=0.5;
  
  if (scale !=100) {
    wdt=src->wdt*scale/100.0;
    hgt=src->hgt*scale/100.0;
  } else {
    wdt=src->wdt;
    hgt=src->hgt;
  }

  if ((wdt==0) || (hgt==0)) {
    fprintf(stderr,"Invalid image size.\n");
    exit(-1);
  }

  dst=FrameBufferMake(NULL,wdt,hgt,24);
  FrameBufferClear(dst,bgcolor,0x0f);

  if (cflg !=0) { /* plot checker board */
    int x,y;
    int c=0,d=0;
    for (x=0;x<wdt;x+=8) {
      c=d;
      d=!d;
      for (y=0;y<hgt;y+=8) {
        c=!c;
        if (c==0) FrameBufferRectangle(dst,NULL,x,y,8,8,1,
                             0xffc0c0c0,0x0f,0,NULL,NULL);
        else FrameBufferRectangle(dst,NULL,x,y,8,8,1,
                             0xffffffff,0x0f,0,NULL,NULL);
     
      }
    }
  } 


  if (scale==100)
    FrameBufferImage(dst,NULL,src,0x0f,0,0,0,NULL);  
  else {
    m.a=scale/100.0;
    m.b=0;
    m.c=0;
    m.d=scale/100.0;
    FrameBufferImage(dst,&m,src,0x0f,0,0,sflg,NULL); 
  }  

#ifdef _XLIB_
  dp=XwinOpenDisplay(display_name,&xdf);
 
  if (dp==NULL) {
    fprintf(stderr,"Could not open display.\n");
    exit(-1);
  }

  if (xdoff==-1) xdoff=(dp->wdt-dst->wdt)/2;
  if (ydoff==-1) ydoff=(dp->hgt-dst->hgt)/2;

  win=XwinMakeWindow(xdoff,ydoff,dst->wdt,dst->hgt,0,
                       dp,name,
                       name,argv[0],name,argc,argv,&xdf);
  if (win==NULL) {
    fprintf(stderr,"Could not create window.\n");
    exit(-1);
  }

  XwinFrameBufferWindow(dst,win);

  XwinShowWindow(win);

  XwinDisplayEvent(dp,1,&win,1,NULL);

  XwinFreeWindow(win);
  XwinCloseDisplay(dp); 
#endif

  return 0;
}