Exemplo n.º 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 );
}
Exemplo n.º 2
0
int
InitPhotofloDoneEvent(XParms xp, Parms p, int reps)
{
    XIEPhotomap = ( XiePhotomap ) NULL;
    flo = ( XiePhotoflo ) NULL;
    flograph = ( XiePhotoElement * ) NULL;

    if ( ( XIEPhotomap = GetXIEDitheredPhotomap( xp, p, 1,
                         (1 << xp->vinfo.depth ) ) ) == ( XiePhotomap ) NULL )
    {
        reps = 0;
    }
    else
    {
        flo_elements = 2;
        flograph = XieAllocatePhotofloGraph(flo_elements);
        if ( flograph == ( XiePhotoElement * ) NULL )
        {
            fprintf( stderr, "XieAllocatePhotofloGraph failed\n" );
            reps = 0;
        }
        else
        {
            XieFloImportPhotomap(&flograph[0], XIEPhotomap,
                                 False);

            XieFloExportDrawable(&flograph[1],
                                 1,              /* source phototag number */
                                 xp->w,
                                 xp->fggc,
                                 0,
                                 0
                                );

            flo = XieCreatePhotoflo( xp->d, flograph, flo_elements )
                  ;
        }
    }
    if ( !reps )
    {
        FreePhotofloDoneEventStuff( xp, p );
    }
    return( reps );
}
Exemplo n.º 3
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);
  */
}
Exemplo n.º 4
0
int 
InitExportClientHistogram(XParms xp, Parms p, int reps)
{
	XieProcessDomain domain;
	int	idx, src;
        XieRectangle    rect;
	ExportClParms	*parms;
	XIEimage *image;
	int constrainflag = 0;

	parms = ( ExportClParms * )p->ts;
	XIELut = ( XieLut ) NULL;
	XIERoi = ( XieRoi ) NULL;
	XIEPhotomap = ( XiePhotomap ) NULL;
	ControlPlane = ( XiePhotomap ) NULL;
	histos = ( XieHistogramData * ) NULL;
	flograph = ( XiePhotoElement * ) NULL;
	flo = ( XiePhotoflo ) NULL;

	if ( parms )	
        	useDomain = parms->useDomain;
	else
		useDomain = DomainNone;

	flo_elements = 3;

	image = p->finfo.image1;
	if ( !image )
	{
		reps = 0;
	}

	if ( reps && ( xp->screenDepth != image->depth[ 0 ] ) )
        {
		flo_elements+=2;
                constrainflag = 1;
                if ( ( XIELut = CreatePointLut( xp, p,
                        1 << image->depth[ 0 ], 
			1 << xp->screenDepth, False ) )
                        == ( XieLut ) NULL )
                {
                        reps = 0;
                }
        }

	if ( reps && useDomain == DomainROI )
	{
                rect.x = parms->x;
                rect.y = parms->y;
                rect.width = parms->width;
                rect.height = parms->height;

                if ( ( XIERoi = GetXIERoi( xp, p, &rect, 1 ) ) ==
                        ( XieRoi ) NULL )
                {
			reps = 0;
		}
		flo_elements+=1;
	}
	else if ( reps && useDomain == DomainCtlPlane )
	{
		ControlPlane = GetControlPlane( xp, 2 );
		if ( ControlPlane == ( XiePhotomap ) NULL )
			reps = 0;
		flo_elements+=1;
	}

	if ( reps )
	{
		histos = ( XieHistogramData * ) malloc( sizeof( XieHistogramData ) * ( 1 << image->depth[ 0 ] ) );
		if ( histos == ( XieHistogramData * ) NULL )
		{
			reps = 0;
		}
	}
	if ( reps )
	{
		flograph = XieAllocatePhotofloGraph(flo_elements);	
		if ( flograph == ( XiePhotoElement * ) NULL )
		{
			fprintf( stderr, "XieAllocatePhotofloGraph failed\n" );
			reps = 0;
		}
		else if ( ( XIEPhotomap = 
			GetXIEPhotomap( xp, p, 1 ) ) == ( XiePhotomap ) NULL )
		{
			reps = 0;
		}
		else
		{
			domain.offset_x = 0;
			domain.offset_y = 0;
			domain.phototag = 0;

			idx = 0;
			if ( useDomain == DomainROI )
			{
				XieFloImportROI(&flograph[idx], XIERoi);
				idx++;
				domain.phototag = idx;
			}
			else if ( useDomain == DomainCtlPlane )
			{
				XieFloImportPhotomap(&flograph[idx], 
					ControlPlane, False);
				idx++;
				domain.phototag = idx;
			}
			
			XieFloImportPhotomap(&flograph[idx], 
				XIEPhotomap, False );
			idx++;
			src = idx;

			XieFloExportClientHistogram(&flograph[idx],
				idx,              /* source phototag number */
				&domain,
				xieValNewData
			);
			idx++;
			histoSrc = idx;
	
			if ( constrainflag )
			{
				XieFloImportLUT(&flograph[idx], XIELut );
				idx++;

				domain.phototag = 0;
				domain.offset_x = 0;
				domain.offset_y = 0;
				XieFloPoint(&flograph[idx],
					src,
					&domain,
					idx,
					0x7
				);
				idx++;
				src = idx;
			}	

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

			flo = XieCreatePhotoflo( xp->d, flograph, flo_elements );
			flo_notify = True;
		}
	}
	if ( reps )
	{
		XMapRaised( xp->d, monitorWindow );
		XSync( xp->d, 0 );
	}
	else 
	{
		FreeExportClientHistogramStuff( xp, p );
	}
	return( reps );
}