Пример #1
0
int
InitImportObscuredEvent(XParms xp, Parms p, int reps)
{
    flo = ( XiePhotoflo ) NULL;
    flograph = ( XiePhotoElement * ) NULL;

    flo_elements = 2;
    flograph = XieAllocatePhotofloGraph(flo_elements);
    if ( flograph == ( XiePhotoElement * ) NULL )
    {
        fprintf( stderr, "XieAllocatePhotofloGraph failed\n" );
        reps = 0;
    }
    else
    {

        XieFloImportDrawable(&flograph[0],
                             xp->w,
                             0,
                             0,
                             WIDTH,
                             HEIGHT,
                             0,
                             True
                            );

        XieFloExportDrawable(&flograph[1],
                             1,              /* source phototag number */
                             drawableWindow,
                             xp->fggc,
                             0,       /* x offset in window */
                             0        /* y offset in window */
                            );

        XMoveWindow( xp->d, drawableWindow, 100, 100 );
        XMapRaised( xp->d, drawableWindow );

        XSync( xp->d, 0 );
        GetXIEWindow( xp, p, xp->w, 1 );
        dontClear = True;

        flo = XieCreatePhotoflo( xp->d, flograph, 2 );
    }

    if ( !reps )
    {
        XUnmapWindow( xp->d, drawableWindow );
        FreeImportObscuredEventStuff( xp, p );
    }

    return( reps );
}
Пример #2
0
static void
DoFlo(Display *display,
      Drawable aDest,
      GC aGC,
      Drawable aSrc,
      PRInt32 aSrcWidth,
      PRInt32 aSrcHeight,
      PRInt32 aSX,
      PRInt32 aSY,
      PRInt32 aSWidth,
      PRInt32 aSHeight,
      PRInt32 aDX,
      PRInt32 aDY,
      PRInt32 aDWidth,
      PRInt32 aDHeight)
{
  XieExtensionInfo *info;
  float coeffs[6];
  XieConstant constant;
  XiePhototag idx = 0, src;

  /* create the pretty flo graph */


  /* import */
  XieFloImportDrawable(&photoElement[idx], aSrc,
                       aSX, aSY, aSWidth, aSHeight,
                       0, PR_FALSE);
  ++idx;
  src = idx;

  /* do the scaling stuff */
  coeffs[0] = (float)aSrcWidth / (float)aDWidth;
  coeffs[1] = 0.0;
  coeffs[2] = 0.0;
  coeffs[3] = (float)aSrcHeight / (float)aDHeight;
  coeffs[4] = 0.0;
  coeffs[5] = 0.0;

  constant[0] = 128.0;
  constant[1] = 128.0;
  constant[2] = 128.0;

  XieFloGeometry(&photoElement[idx], src, aDWidth, aDHeight,
                 coeffs,
                 constant,
                 0x07,
                 xieValGeomNearestNeighbor,
                 NULL);
  ++idx;

  /* export */
  XieFloExportDrawable(&photoElement[idx], idx, aDest, aGC,
                       (aDX - aSX),
                       (aDY - aSY));
#ifdef DEBUG_XIE
  printf("export to %d, %d (%dx%d)\n", (aDX - aSX), (aDY - aSY),
      aDWidth, aDHeight);
#endif
  ++idx;

  /* do the scale thing baby */
  XieExecuteImmediate(display, gPhotospace, 1, PR_FALSE, photoElement, idx);

  /*
    XieFreePhotofloGraph(photoElement, 3);
  */
}