Changeset 173 in Sophya for trunk/SophyaPI/PI/piwdgx.cc


Ignore:
Timestamp:
Dec 22, 1998, 5:19:22 PM (27 years ago)
Author:
ercodmgr
Message:

Ajout classe PIGraphicBuffer Reza 22/12/98

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/piwdgx.cc

    r170 r173  
    2525static SysDWdg  top = NULL;
    2626static Display * dpy = NULL;
     27static GC defgc;
    2728// static char appname[64];
    2829static char appclass[64];
     
    560561top = XtVaAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, (String*)(fallback_res), NULL);
    561562#endif
     563if (top == NULL) {
     564  fprintf(stderr, "PIWdgX::InitXt()/ Error XtVaAppInitialize() -> Exit \n");
     565  exit(9);
     566  }
    562567dpy = XtDisplay(top);
     568if (dpy == NULL)  {
     569  fprintf(stderr, "PIWdgX::InitXt()/ Error XtVaAppInitialize()/DisplayConnection -> Exit \n");
     570  exit(9);
     571  }
     572
     573/*  le GC pour les XCopyArea */
     574XGCValues  xgv;
     575xgv.function = GXcopy;
     576xgv.plane_mask = ~0;
     577defgc = XCreateGC (dpy, DefaultRootWindow(dpy), GCFunction | GCPlaneMask, &xgv);
    563578
    564579// On va recuperer la fonte par defaut des composantes Motif
     
    736751#endif
    737752return;
     753}
     754
     755//  Copie depuis un PIWdgGen
     756void PIWdgX::CopyFrom(PIWdgGen* wdg, int ox, int oy, int dx, int dy, int x, int y)
     757{
     758PIWdgX* wx = (PIWdgX*)wdg;
     759XCopyArea(XtDisplay(XtWdg()), XtWindow(wx->XtWdg()), XtWindow(XtWdg()), defgc, ox, oy,
     760          (unsigned int)dx, (unsigned int)dy, x, y);
    738761}
    739762
     
    974997return;
    975998}
     999
     1000
     1001// -------- La classe PIGraphicBuffer ----------
     1002/* --Methode-- */
     1003PIGraphicBuffer::PIGraphicBuffer(int sx, int sy)
     1004{
     1005if (sx < 1) sx = 1;
     1006if (sy < 1) sy = 1;
     1007mSx = sx;  mSy = sy;
     1008Display * dsx = PIXDisplay();
     1009Window rw = DefaultRootWindow(dsx);
     1010xGrbuff = XCreatePixmap(dsx, rw, sx, sy, DefaultDepth(dsx, DefaultScreen(dsx)) );
     1011}
     1012/* --Methode-- */
     1013PIGraphicBuffer::~PIGraphicBuffer()
     1014{
     1015XFreePixmap(PIXDisplay(),xGrbuff);
     1016}
     1017
     1018/* --Methode-- */
     1019int PIGraphicBuffer::XSize()
     1020{
     1021return(mSx);
     1022}
     1023
     1024/* --Methode-- */
     1025int PIGraphicBuffer::YSize()
     1026{
     1027return(mSx);
     1028}
     1029
     1030/* --Methode-- */
     1031void PIGraphicBuffer::CopyFromWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y)
     1032{
     1033XCopyArea(XtDisplay(wdg->XtWdg()), XtWindow(wdg->XtWdg()), XGrBuffer(), defgc, ox, oy,
     1034          (unsigned int)dx, (unsigned int)dy, x, y);
     1035}
     1036
     1037/* --Methode-- */
     1038void PIGraphicBuffer::CopyToWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y)
     1039{
     1040XCopyArea(XtDisplay(wdg->XtWdg()), XGrBuffer(), XtWindow(wdg->XtWdg()), defgc, ox, oy,
     1041          (unsigned int)dx, (unsigned int)dy, x, y);
     1042}
     1043
     1044/* --Methode-- */
     1045void PIGraphicBuffer::CopyFrom(PIGraphicBuffer* grb, int ox, int oy, int dx, int dy, int x, int y)
     1046{
     1047
     1048XCopyArea(PIXDisplay(), grb->XGrBuffer(), XGrBuffer(), defgc, ox, oy,
     1049          (unsigned int)dx, (unsigned int)dy, x, y);
     1050}
Note: See TracChangeset for help on using the changeset viewer.