예제 #1
0
int
main(int argc, char *argv[])
{
   Display *dpy;
   GLXFBConfig pixmapConfig;
   XVisualInfo *windowVis;
   GLXPixmap gp;
   Window win;
   GLXContext ctx;
   Pixmap p;

   dpy = OpenDisplay();

   pixmapConfig = ChoosePixmapFBConfig(dpy);
   windowVis = ChooseWindowVisual(dpy);
   win = CreateWindow(dpy, windowVis, 500, 500, "Texture From Pixmap");

   gp = CreatePixmap(dpy, pixmapConfig, 512, 512, &p);
   DrawPixmapImage(dpy, p, 512, 512);

   ctx = glXCreateContext(dpy, windowVis, NULL, True);
   if (!ctx) {
      printf("Couldn't create GLX context\n");
      exit(1);
   }

   glXMakeCurrent(dpy, win, ctx);

   BindPixmapTexture(dpy, gp);

   EventLoop(dpy, win);

   return 0;
}
예제 #2
0
void Needle::SetSize(QSize sz, int iOffset)
{ 
	m_size = sz; 
	m_iOffset = iOffset; 
	if(m_eType != tPlain) {
		CreatePixmap();
	}
}
예제 #3
0
void pImage::setImage(const image &image) {
  qtLabel->setPixmap(QPixmap());

  if(!image.empty()) {
    QPixmap pixmap = CreatePixmap(image);
    qtLabel->setPixmap(pixmap);
    qtLabel->setMinimumSize(pixmap.width(), pixmap.height());
  }
}
예제 #4
0
void
JXImage::ConvertToPixmap()
	const
{
	if (itsPixmap == None)
		{
		assert( itsImage != NULL );

		JXImage* me = const_cast<JXImage*>(this);
		me->itsPixmap = CreatePixmap();

		XDestroyImage(itsImage);
		me->itsImage = NULL;
		}
}
예제 #5
0
/* static */
already_AddRefed<gfxXlibSurface>
gfxXlibSurface::Create(Screen *screen, XRenderPictFormat *format,
                       const gfxIntSize& size, Drawable relatedDrawable)
{
    Drawable drawable =
        CreatePixmap(screen, size, format->depth, relatedDrawable);
    if (!drawable)
        return nsnull;

    nsRefPtr<gfxXlibSurface> result =
        new gfxXlibSurface(screen, drawable, format, size);
    result->TakePixmap();

    if (result->CairoStatus() != 0)
        return nsnull;

    return result.forget();
}
예제 #6
0
/* static */
already_AddRefed<gfxXlibSurface>
gfxXlibSurface::Create(Screen *screen, Visual *visual,
                       const gfxIntSize& size, Drawable relatedDrawable)
{
    Drawable drawable =
        CreatePixmap(screen, size, DepthOfVisual(screen, visual),
                     relatedDrawable);
    if (!drawable)
        return nsnull;

    nsRefPtr<gfxXlibSurface> result =
        new gfxXlibSurface(DisplayOfScreen(screen), drawable, visual, size);
    result->TakePixmap();

    if (result->CairoStatus() != 0)
        return nsnull;

    return result.forget();
}
void QSettingColorTableItem::setText(const QString & str)
{
	QSettingTextTableItem::setText(str);
	setPixmap(CreatePixmap());
}
QSettingColorTableItem::QSettingColorTableItem(Q3Table * parent, Setting * pSetting)
: QSettingTextTableItem(parent, pSetting)
{
	setPixmap(CreatePixmap());
}
예제 #9
0
t_dlg *MessageBox(t_x11 *x11, Window Parent, char *title,
		  int nlines, char *lines[], unsigned long Flags,
		  DlgCallback *cb, void *data)
{
  t_dlg         *dlg;
  int		width,nicon;
  int           x,y,x0;
  unsigned long         nFlag;
  unsigned long         bg;
  
  /* Check flags for inconsistencies */
  if (((Flags & MB_OK) && (Flags & MB_YES)) 	||
      ((Flags & MB_NO) && (Flags & MB_CANCEL))  ||
      (!(Flags & MB_OK) && !(Flags & MB_YES))) {
    fprintf(stderr,"Invalid button selection in MessageBox\n");
    exit(1);
  }
  nicon=0;
  if (Flags & MB_ICONSTOP) nicon++;
  if (Flags & MB_ICONINFORMATION) nicon++;
  if (Flags & MB_ICONEXCLAMATION) nicon++;
  if (Flags & MB_ICONGMX) nicon++;
  if (nicon > 1) 
    gmx_fatal(FARGS,"More than one (%d) icon selected in MessageBox",nicon);
  /* Input seems ok */
  bg=x11->bg;
  if (nicon > 0) {
    if (Flags & MB_ICONSTOP)
      SetIcon(stop_bits,stop_width,stop_height,RED,bg);
    if (Flags & MB_ICONINFORMATION)
      SetIcon(info_bits,info_width,info_height,BLUE,bg);
    if (Flags & MB_ICONEXCLAMATION)
      SetIcon(alert_bits,alert_width,alert_height,GREEN,bg);
    if (Flags & MB_ICONGMX)
      SetIcon(gromacs_bits,gromacs_width,gromacs_height,BLUE,bg);
  }
  
  dlg=CreateDlg(x11,Parent,title,0,0,0,0,3,x11->fg,bg,cb,data);
  x=2*OFFS_X;
  if (nicon > 0) {
    AddDlgItem(dlg,CreatePixmap
	       (x11,XCreatePixmapFromBitmapData
		(x11->disp,dlg->win.self,icon_bits,icon_width,icon_height,
		 icon_fg,icon_bg,x11->depth),
		ID_ICON,ID_BOX,2*OFFS_X,2*OFFS_Y,icon_width,icon_height,0));
    x+=QueryDlgItemW(dlg,ID_ICON)+2*OFFS_X;
  }
  
  AddDlgItem(dlg,CreateStaticText(x11,nlines,lines,ID_TEXT,ID_BOX,
				  x,2*OFFS_Y,0,0,0));

  y=QueryDlgItemY(dlg,ID_TEXT)+QueryDlgItemH(dlg,ID_TEXT);
  if (nicon > 0) {
    int yi;
    yi=QueryDlgItemY(dlg,ID_ICON)+QueryDlgItemH(dlg,ID_ICON);
    if (yi > y)
      SetDlgItemPos(dlg,ID_TEXT,x,2*OFFS_Y+(yi-y)/2);
    else
      SetDlgItemPos(dlg,ID_ICON,2*OFFS_X,2*OFFS_Y+(y-yi)/2);
    y=max(y,yi);
  }
  x+=QueryDlgItemW(dlg,ID_TEXT)+2*OFFS_X;
  y+=2*OFFS_Y;
  width=(x-8*OFFS_X)/2;
  
  if (((Flags & MB_OKCANCEL) == MB_OKCANCEL) ||
      ((Flags & MB_YESNO) == MB_YESNO))
    x0=2*OFFS_X;
  else
    x0=(x-width)/2;

#define CB(name,butx,id) AddDlgItem(dlg,CreateButton(x11,name,\
						     TRUE,id,ID_BOX,\
						     butx,y,width,0,0))
  if (Flags & MB_OK) CB("OK",x0,MB_OK);
  if (Flags & MB_CANCEL) CB("Cancel",x/2+2*OFFS_X,MB_CANCEL);
  if (Flags & MB_YES) CB("Yes",x0,MB_YES);
  if (Flags & MB_NO) CB("No",x/2+2*OFFS_X,MB_NO);

  SetDlgSize(dlg,x,y+2*OFFS_Y+
	     QueryDlgItemH(dlg,(Flags & MB_OK) ? MB_OK : MB_YES),TRUE);

  if (Flags & MB_SYSTEMMODAL)
    nFlag=DLG_SYSTEMMODAL;
  else if (Flags & MB_APPLMODAL)
    nFlag=DLG_APPLMODAL;
  else
    nFlag=0;
  nFlag=nFlag | DLG_FREEONBUTTON;
  dlg->flags=nFlag;

  if (!(Flags & MB_DONTSHOW))
    ShowDlg(dlg);

  return dlg;
}
예제 #10
0
int __stdcall srv_2d(ioctl_t *io)
{
    u32_t *inp;
    u32_t *outp;

    inp = io->input;
    outp = io->output;

    switch(io->io_code)
    {
        case SRV_GETVERSION:
            if(io->out_size==4)
            {
                *outp = API_VERSION;
                return 0;
            }
            break;

        case PX_CREATE:
            if(io->inp_size==7)
                return CreatePixmap((pixmap_t*)inp);
            break;

        case PX_DESTROY:
            if(io->inp_size==7)
                return DestroyPixmap((pixmap_t*)inp);
            break;

        case PX_CLEAR:
            if(io->inp_size==2)
                return ClearPixmap((io_clear_t*)inp);
            break;

        case PX_DRAW_RECT:
            if(io->inp_size==7)
                return DrawRect((io_draw_t*)inp);
            break;

        case PX_FILL_RECT:
            if(io->inp_size==10)
                return FillRect((io_fill_t*)inp);
            break;

        case PX_LINE:
            if(io->inp_size==6)
                return Line((io_draw_t*)inp);
            break;

        case PX_BLIT:
            if(io->inp_size==8)
                return Blit((io_blit_t*)inp);
            break;

        case  PX_BLIT_TRANSPARENT:
            if(io->inp_size==9)
                return BlitTransparent((io_blit_t*)inp);
            break;

        case PX_BLIT_ALPHA:
            if(io->inp_size==9)
                return RadeonComposite((io_blit_t*)inp);
            break;

        default:
            return ERR_PARAM;
  };

  return ERR_PARAM;
}