コード例 #1
0
ファイル: CONVRGB.C プロジェクト: AnimatorPro/Animator-Pro
Errcode convrgb_read_image(Image_file *ifile, Rcel *screen, Anim_info *ai, int rgb_choice)
/*****************************************************************************
 *
 ****************************************************************************/
{
	Errcode err;
	Rgbctl	*ctl;

	if (NULL == (ctl = pj_zalloc(sizeof(Rgbctl))))
		return Err_no_memory;

	ctl->ifile	= ifile;
	ctl->width	= ai->width;
	ctl->height = ai->height;

	if ((err = pdr_rgb_seekstart(ifile)) < Success)
		goto OUT;
	else
		ctl->is_flipped = (err > 0) ? TRUE : FALSE;

	if (NULL == (ctl->rgb_bufs[0] = pj_malloc(ai->width)) ||
		NULL == (ctl->rgb_bufs[1] = pj_malloc(ai->width)) ||
		NULL == (ctl->rgb_bufs[2] = pj_malloc(ai->width)) ||
		NULL == (ctl->linebuf	  = pj_malloc(3*ai->width)))
		{
		err = Err_no_memory;
		goto OUT;
		}

	switch (rgb_choice)
		{
		case RGB_SCALED:
			err = rgb_read_scaled(ctl, screen);
			break;
		case RGB_COLOR:
			err = rgb_read_color(ctl, screen);
			break;
		case RGB_GREY:
			err = rgb_read_grey(ctl, screen);
			break;
		}

OUT:

	pj_gentle_free(ctl->rgb_bufs[0]);
	pj_gentle_free(ctl->rgb_bufs[1]);
	pj_gentle_free(ctl->rgb_bufs[2]);
	pj_gentle_free(ctl->linebuf);
	pj_free(ctl);

	cleanup_toptext();
	return err;
}
コード例 #2
0
ファイル: nad_init.c プロジェクト: naadsm/proj4_delphi
int nad_ctable_load( struct CTABLE *ct, FILE *fid )

{
    int  a_size;

    fseek( fid, sizeof(struct CTABLE), SEEK_SET );

    /* read all the actual shift values */
    a_size = ct->lim.lam * ct->lim.phi;
    ct->cvs = (FLP *) pj_malloc(sizeof(FLP) * a_size);
    if( ct->cvs == NULL 
        || fread(ct->cvs, sizeof(FLP), a_size, fid) != a_size )
    {
        pj_dalloc( ct->cvs );
        ct->cvs = NULL;

        if( getenv("PROJ_DEBUG") != NULL )
        {
            fprintf( stderr, 
            "ctable loading failed on fread() - binary incompatible?\n" );
        }

        pj_errno = -38;
        return 0;
    }

    return 1;
} 
コード例 #3
0
ファイル: fli.c プロジェクト: AnimatorPro/Animator-Pro
Errcode unfli(Rcel *f, /* screen to update */
		 int ix,	/* which frame of file to read */
		 int wait)	/* wait for vblank (and update hardward color registers)? */

/* allocate a buffer to read in a compressed delta frame from FLX (indexed
   FLI) file.  If can't allocate buffer go swap out everything we can 
   and try again.  Once got the buffer call above routine to read in 
   frame and eventually uncompress it. */
{
struct fli_frame *frame;	/* buffer area */
Errcode err;
long size;
int pushed = 0;

	size = flix.idx[ix].fsize;
	if((frame = pj_malloc(Max(size,sizeof(Fli_frame)))) == NULL)
	{
		pushed = 1;
		push_most();
		if ((frame = begmem(size)) == NULL)
		{
			err = Err_reported;
			goto OUT;
		}
	}
	err = gb_unfli_flx_frame(&flix,f, ix, wait, frame);

OUT:
	pj_gentle_free(frame);
	if (pushed)
		pop_most();
	return(err);
}
コード例 #4
0
ファイル: SEP.C プロジェクト: AnimatorPro/Animator-Pro
static Errcode get_abs_ctable(Sep_cb *sep)
{
UBYTE *s;
Rgb3 *d;
int i;

if (vs.sep_rgb == 1)
	{
	/* copy the absolute rgb values of cnums somewhere */
	get_color_rgb(vs.ccolor,vb.pencel->cmap,&sep->sep_rgb_dest);

	if ((sep->abs_ctable = pj_malloc(sep->p.ccount*3)) == NULL)
		return(Err_no_memory);

	s = sep->p.ctable;
	d = sep->abs_ctable;
	i = sep->p.ccount;
	while (--i >= 0)
		{
		get_color_rgb(*s++,vb.pencel->cmap,d);
		++d;
		}
	}
return(Success);
}
コード例 #5
0
ファイル: vsetting.c プロジェクト: AnimatorPro/Animator-Pro
Errcode reload_tsettings(Vsettings *pvs,Vset_flidef *fdef)
/* called whenever a tempflx is opened to reload ram settings state */
{
Errcode err;
Tsettings_file *buf;

	if((buf = pj_malloc(sizeof(*buf))) == NULL)
		return(Err_no_memory);
	if((err = read_gulp(tsettings_name, buf, (long)sizeof(*buf))) < Success)
		goto error;

	if (buf->vs.zoomscale == 0) {
		err = Err_corrupted;
		goto error;
	}

	if(pvs)
		*pvs = buf->vs;
	if(fdef)
		*fdef = buf->fdef;

	load_ink_strengths(buf->vslow.inkstrengths);

error:
	pj_freez(&buf);
	return(err);
}
コード例 #6
0
ファイル: nad_init.c プロジェクト: dyang02/SurrogateTools
struct CTABLE *nad_ctable_init( FILE * fid )
{
    struct CTABLE *ct;
    int		id_end;

    /* read the table header */
    ct = (struct CTABLE *) pj_malloc(sizeof(struct CTABLE));
    if( ct == NULL 
        || fread( ct, sizeof(struct CTABLE), 1, fid ) != 1 )
    {
        pj_errno = -38;
        return NULL;
    }

    /* do some minimal validation to ensure the structure isn't corrupt */
    if( ct->lim.lam < 1 || ct->lim.lam > 100000 
        || ct->lim.phi < 1 || ct->lim.phi > 100000 )
    {
        pj_errno = -38;
        return NULL;
    }
    
    /* trim white space and newlines off id */
    for( id_end = strlen(ct->id)-1; id_end > 0; id_end-- )
    {
        if( ct->id[id_end] == '\n' || ct->id[id_end] == ' ' )
            ct->id[id_end] = '\0';
        else
            break;
    }

    ct->cvs = NULL;

    return ct;
}
コード例 #7
0
ファイル: nad_init.c プロジェクト: aleaf/swb
int nad_ctable2_load( projCtx ctx, struct CTABLE *ct, FILE *fid )

{
    int  a_size;

    fseek( fid, 160, SEEK_SET );

    /* read all the actual shift values */
    a_size = ct->lim.lam * ct->lim.phi;
    ct->cvs = (FLP *) pj_malloc(sizeof(FLP) * a_size);
    if( ct->cvs == NULL 
        || fread(ct->cvs, sizeof(FLP), a_size, fid) != a_size )
    {
        pj_dalloc( ct->cvs );
        ct->cvs = NULL;

        if( getenv("PROJ_DEBUG") != NULL )
        {
            fprintf( stderr,
            "ctable2 loading failed on fread() - binary incompatible?\n" );
        }

        pj_ctx_set_errno( ctx, -38 );
        return 0;
    }

    if( !IS_LSB )
    {
        swap_words( ct->cvs, 4, a_size * 2 );
    }

    return 1;
} 
コード例 #8
0
ファイル: CUTCURS.C プロジェクト: AnimatorPro/Animator-Pro
static Errcode get_cut(Pixel offc, Pixel onhi, Pixel onlo)

/* returns Err_abort if right click or key hit returns ZOOM_WNDOID if in zoom 
 * window FLI_WNDOID if in fli window leaves values in icb as of last click 
 * and iostate set to window click was in */
{
Wiostate ios;
Cutdata cd;
int ret;

	if(NULL == (cd.hline = pj_malloc(vb.pencel->width + vb.pencel->height)))
		return(Err_no_memory);

	save_wiostate(&ios);
	cd.vline = cd.hline + vb.pencel->width;
	cd.wndoid = -1;
	cd.doneonce = 0;
	cd.oncol = onhi;
	cd.offcol = offc;
	vinit_marqihdr(&cd.mh,1,1);

	ret = anim_wait_input(KEYHIT|MBRIGHT|MBPEN,KEYHIT|MBRIGHT|MBPEN|MMOVE,
						  cd.mh.waitcount,anim_cut,&cd);

	cleanup_toptext();
	restore_cut(&cd);
	pj_free(cd.hline);
	if(ret < 0)
		rest_wiostate(&ios);
	else 
		show_mouse();
	return(ret);
}
コード例 #9
0
ファイル: SVGAVDEV.C プロジェクト: AnimatorPro/Animator-Pro
static Errcode svga_open_graphics(Vdevice *dev, SVGARast *r,
		LONG width, LONG height, USHORT mode)
/*****************************************************************************
 * open the driver in the requested mode.
 ****************************************************************************/
{
	Errcode err;
	SMInfo	*sminf;

	if (mode >= smodecount) 			// If init/detect failed or caller
		return Err_no_such_mode;		// asked for bad mode, this catches it.

	sminf = &pj_vdrv_modeinfo[mode];

	if (width  != sminf->width ||		// Docs say to do this; I wanna
		height != sminf->height)		// know how it could ever happen
		return Err_wrong_res;			// short of a totally buggy host!

	if (height > 1536)					// ytable size in drvcomn.asm is
		return Err_too_big; 			// hardcodes to this many entries.

	if (width+width+4 > LCLBUF_SIZE)	// blit code assumes it can fit 2 full
		return Err_too_big; 			// lines plus a dword in local buffer.

	if (NULL == (pj_vdrv_wcontrol.localbuf = pj_malloc(LCLBUF_SIZE))) // get blit buffer
		return Err_no_memory;

	r->lib	  = get_rlib(); 						// fill in details in
	r->type   = mode + dev->first_rtype;			// the caller's Raster
	r->width  = width;								// structure.  do it before
	r->height = height; 							// calling setmode() in
	r->pdepth = 8;									// case setmode wants to
	r->grclib = dev->grclib;						// change an rlib vector.

	if (Success > (err = pj_svga_setmode(sminf)))	// fire up requested mode,
		goto ERROR_EXIT;							// punt if error, else
	else											// save longword return val
		old_mode_data = err & 0xFFFFFF7F;			// for passing to clrmode().

	/*
	 * bogus aspect ratio calcs...these are wrong, but at least they don't
	 * break the PJ circle tool...
	 */

	if (r->height < 480) {
		r->aspect_dx = 6;
		r->aspect_dy = 5;
	} else {
		r->aspect_dx = 1;
		r->aspect_dy = 1;
	}

	device_is_open = TRUE;
	return Success;

ERROR_EXIT:

	svga_close_graphics(dev);
	return err;
}
コード例 #10
0
ファイル: flilo.c プロジェクト: AnimatorPro/Animator-Pro
static Errcode flow_save_frames(Image_file *ifile,
								Rcel *screen,
								ULONG num_frames,
								Errcode (*seek_frame)(int ix,void *seek_data),
								void *seek_data,
								Rcel *work_screen )
{
Errcode err = Success;
ULONG i;
Fli_frame *cbuf;
Flifile *flif = ((Flifile *)ifile);

	if(screen->width != 320 || screen->height != 200)
		return(Err_wrong_res);

	cbuf = NULL;
	for(i = 0;;++i)
	{
		if(NULL == (cbuf = pj_malloc(CBUF_SIZE)))
		{
			err = Err_no_memory;
			break;
		}
		if(i == 0)
		{
			if((err = flow_add_frame1(flif, cbuf, screen)) < Success)
				break;

			/* if only one frame terminate file and exit */

			if(num_frames <= 1)
			{
				err = flow_i_add_empty_ring(flif);
				break;
			}
		}
		else if(i < num_frames)
		{
			if((err = seek_frame(i,seek_data)) < Success)
				break;
			if((err = flow_add_next(flif,cbuf,work_screen,screen)) < Success)
				break;
		}
		else
		{
			/* if larger than one frame file re-seek to first frame */
			if((err = seek_frame(0,seek_data)) < Success)
				break;
			err = flow_add_ring(flif,cbuf,work_screen,screen);
			break; /* we are done ! */
		}
		pj_freez(&cbuf);
		pj_blitrect(screen,0,0,work_screen,0,0,320,200);
		pj_cmap_copy(screen->cmap, work_screen->cmap);
	}

	pj_freez(&cbuf);
	return(err);
}
コード例 #11
0
ファイル: STRCLONE.C プロジェクト: AnimatorPro/Animator-Pro
char *clone_string(char *s)
{
char *d;

if ((d = (char *)pj_malloc(strlen(s)+1)) != NULL)
	strcpy(d, s);
return(d);
}
コード例 #12
0
ファイル: MEMASK.C プロジェクト: AnimatorPro/Animator-Pro
void *pj_zalloc(long size)
/* same as laskmem bu returns it cleared "c" */
{
void *mem;

	if(NULL != (mem = pj_malloc(size)))
		zero_structure(mem,size);
	return(mem);
}
コード例 #13
0
	static Tseries * /* create power series structure */
makeT(int nru, int nrv) {
	Tseries *Ts;
	int i;

	if ((Ts = (Tseries *)pj_malloc(sizeof(Tseries))) &&
		(Ts->cu = (struct PW_COEF *)pj_malloc(
			sizeof(struct PW_COEF) * nru)) &&
		(Ts->cv = (struct PW_COEF *)pj_malloc(
			sizeof(struct PW_COEF) * nrv))) {
		for (i = 0; i < nru; ++i)
			Ts->cu[i].c = 0;
		for (i = 0; i < nrv; ++i)
			Ts->cv[i].c = 0;
		return Ts;
	} else
		return 0;
}
コード例 #14
0
ファイル: MAIN.C プロジェクト: AnimatorPro/Animator-Pro
void *pj_zalloc(unsigned size)
/****************************************************************************
 *
 ***************************************************************************/
{
void *pt;
if ((pt = pj_malloc(size)) == NULL)
	return(NULL);
poco_zero_bytes(pt,(size_t)size);
return(pt);
}
コード例 #15
0
ファイル: CONVRGB.C プロジェクト: AnimatorPro/Animator-Pro
static Errcode rgb_scale_x(Rgbctl *ctl, Rcel *screen)
/*****************************************************************************
 * Read rgb file, break it into RGB components, scale the components
 * in the X dimension, and write them out to our RGB files.
 ****************************************************************************/
{
	Errcode err = Success;
	int 	height = ctl->height;
	int 	width  = ctl->width;
	int 	dwidth = screen->width;
	UBYTE	*scale_buf = NULL;
	Cmap	*cmap = screen->cmap;
	int 	j;
	int 	i;
	int 	sofar = 0;

	soft_status_line("ctop_xscale");
	if (NULL == (scale_buf = pj_malloc(dwidth)))
		{
		err = Err_no_memory;
		goto OUT;
		}

	if (Success > (err = open_rgb_files("wb",3)))
		goto OUT;

	if (Success > (err = pdr_rgb_seekstart(ctl->ifile)))
		goto OUT;

	for (i=0; i<height; ++i)
		{
		if (--sofar <= 0)
			{
			if ((err = soft_abort("rgb_abort")) < Success)
				goto OUT;
			soft_status_line("!%d%d", "ctop_scaleline", i, height);
			sofar = 25;
			}
		if ((err = pdr_rgb_readline(ctl->ifile, ctl->linebuf)) < Success)
			goto OUT;
		rgb3_to_buffers(ctl->linebuf, ctl->rgb_bufs, width);
		j = 3;
		while (--j >= 0)
			{
			pix_ave_scale(ctl->rgb_bufs[j], width, scale_buf, dwidth);
			if ((err = ffwrite(rgb_files[j], scale_buf, dwidth)) < Success)
				goto OUT;
			}
		}
OUT:
	pj_gentle_free(scale_buf);
	close_rgb_files();
	return err;
}
コード例 #16
0
ファイル: POCOGVAR.C プロジェクト: AnimatorPro/Animator-Pro
static char *new_value(char *value)
/*****************************************************************************
 * alloc memory for a string and copy the existing string into it.
 ****************************************************************************/
{
	char	*newvalue;

	if (NULL == (newvalue = pj_malloc(1+strlen(value))))
		return NULL;
	strcpy(newvalue, value);
	return newvalue;
}
コード例 #17
0
void pj_insert_initcache( const char *filekey, const paralist *list )

{
  pj_acquire_lock();

  /* 
  ** Grow list if required.
  */
  if( cache_count == cache_alloc )
    {
      char **cache_key_new;
      paralist **cache_paralist_new;

      cache_alloc = cache_alloc * 2 + 15;

      cache_key_new = (char **) pj_malloc(sizeof(char*) * cache_alloc);
      memcpy( cache_key, cache_key_new, sizeof(char*) * cache_count);
      pj_dalloc( cache_key );
      cache_key = cache_key_new;

      cache_paralist_new = (paralist **) 
	pj_malloc(sizeof(paralist*) * cache_alloc);
      memcpy( cache_paralist_new, cache_paralist, 
	      sizeof(paralist*) * cache_count );
      pj_dalloc( cache_paralist );
      cache_paralist = cache_paralist_new;
    }

  /*
  ** Duplicate the filekey and paralist, and insert in cache.
  */
  cache_key[cache_count] = (char *) pj_malloc(strlen(filekey)+1);
  strcpy( cache_key[cache_count], filekey );

  cache_paralist[cache_count] = pj_clone_paralist( list );

  cache_count++;

  pj_release_lock();
}
コード例 #18
0
ファイル: pj_mlfn.c プロジェクト: fb/jasper-xcsoar
	double *
pj_enfn(double es) {
	double t, *en;

	if (en = (double *)pj_malloc(EN_SIZE * sizeof(double))) {
		en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
		en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
		en[2] = (t = es * es) * (C44 - es * (C46 + es * C48));
		en[3] = (t *= es) * (C66 - es * C68);
		en[4] = t * es * C88;
	} /* else return NULL if unable to allocate memory */
	return en;
}
コード例 #19
0
ファイル: NEWNAME.C プロジェクト: AnimatorPro/Animator-Pro
Errcode new_name(Names **pname, char *s, Names **plist)
{
Names *n;
int len;

len = strlen(s)+1;
if ((*pname = n = pj_malloc(sizeof(*n)+len)) == NULL)
	return(Err_no_memory);
strcpy((n->name = (char *)(n+1)), s);
n->next = *plist;
*plist = n;
return(len);
}
コード例 #20
0
ファイル: pj_param.c プロジェクト: knubo/Naturvernomrader
	paralist * /* create parameter list entry */
pj_mkparam(char *str) {
	paralist *newitem;

	if ((newitem = (paralist *)pj_malloc(sizeof(paralist) + strlen(str)))) {
		newitem->used = 0;
		newitem->next = 0;
		if (*str == '+')
			++str;
		(void)strcpy(newitem->param, str);
	}
	return newitem;
}
コード例 #21
0
ファイル: pj_init.c プロジェクト: knubo/Naturvernomrader
PJ *
pj_init_plus( const char *definition )

{
#define MAX_ARG 200
    char	*argv[MAX_ARG];
    char	*defn_copy;
    int		argc = 0, i;
    PJ	        *result;
    
    /* make a copy that we can manipulate */
    defn_copy = (char *) pj_malloc( strlen(definition)+1 );
    strcpy( defn_copy, definition );

    /* split into arguments based on '+' and trim white space */

    for( i = 0; defn_copy[i] != '\0'; i++ )
    {
        switch( defn_copy[i] )
        {
          case '+':
            if( i == 0 || defn_copy[i-1] == '\0' )
            {
                if( argc+1 == MAX_ARG )
                {
                    pj_errno = -44;
                    return NULL;
                }
                
                argv[argc++] = defn_copy + i + 1;
            }
            break;

          case ' ':
          case '\t':
          case '\n':
            defn_copy[i] = '\0';
            break;

          default:
            /* do nothing */;
        }
    }

    /* perform actual initialization */
    result = pj_init( argc, argv );

    pj_dalloc( defn_copy );

    return result;
}
コード例 #22
0
ファイル: pj_pr_list.c プロジェクト: AlbertDeFusco/pyproj
char *pj_get_def( PJ *P, int options )

{
    paralist *t;
    int l;
    char *definition;
    size_t def_max = 10;
    (void) options;

    definition = (char *) pj_malloc(def_max);
    definition[0] = '\0';

    for (t = P->params; t; t = t->next)
    {
        /* skip unused parameters ... mostly appended defaults and stuff */
        if (!t->used)
            continue;

        /* grow the resulting string if needed */
        l = strlen(t->param) + 1;
        if( strlen(definition) + l + 5 > def_max )
        {
            char *def2;

            def_max = def_max * 2 + l + 5;
            def2 = (char *) pj_malloc(def_max);
            strcpy( def2, definition );
            pj_dalloc( definition );
            definition = def2;
        }

        /* append this parameter */
        strcat( definition, " +" );
        strcat( definition, t->param );
    }

    return definition;
}
コード例 #23
0
ファイル: tweenhi.c プロジェクト: AnimatorPro/Animator-Pro
static Errcode
tween1(void *tween1_data, int ix, int intween, int scale, Autoarg *aa)
{
Tween1_data *twd = tween1_data;
Poly dpoly;
Short_xyz *v;
int vcount;
LLpoint *d;
Errcode err;
int ocurve;
Boolean closed;
Tw_tlist tlist;
int i;
(void)ix;
(void)intween;
(void)aa;

closed = vs.fillp || vs.closed_curve;
ocurve = curveflag;
curveflag = twd->is_spline;
if ((err = ts_to_tw_list(twd->ts, closed, &tlist)) < Success)
	goto OUT;
calc_tween_points(&tlist, closed, scale, &v, &vcount);
dpoly.pt_count = vcount;
if ((dpoly.clipped_list = d = 
	 pj_malloc(dpoly.pt_count*sizeof(LLpoint))) == NULL)
	{
	err = Err_no_memory;
	goto OUT;
	}
linkup_poly(&dpoly);
i = vcount;
while (--i>=0)
	{
	d->x = v->x;
	d->y = v->y;
	d->z = v->z;
	d = d->next;
	v += 1;
	}
err = render_poly(&dpoly, vs.fillp,vs.closed_curve);
pj_free(dpoly.clipped_list);
if (vs.cycle_draw) 
	cycle_ccolor();
OUT:
trash_tw_list(&tlist);
curveflag = ocurve;
return(err);
}
コード例 #24
0
ファイル: SEP.C プロジェクト: AnimatorPro/Animator-Pro
static Errcode sep1(Sep_cb *sep)
{
Errcode err;
int i,j;
Rgb3 *absc, *pt;
UBYTE *rgb_cnums;
int rgb_ccount;
int threshold;
int occolor;
int cscale;

	if (vs.sep_rgb == 1)	/* case NEAR */
	{
		cscale = sqr_root((long)RGB_MAX*RGB_MAX*3)+1;
		threshold = vs.sep_threshold * cscale/100;
		if ((rgb_cnums = pj_malloc(COLORS)) == NULL)
			return(Err_no_memory);
		occolor = vs.ccolor;
		vs.ccolor = closestc(&sep->sep_rgb_dest,vb.pencel->cmap->ctab, COLORS);
		rgb_ccount = 0;
		absc = sep->abs_ctable;
		i = sep->p.ccount;
		while (--i >= 0)
		{
			pt = vb.pencel->cmap->ctab;
			for (j=0; j<COLORS; j++)
			{
				if (rgb_close_enough(pt, absc, threshold) )
				{
				if (!in_cnums(j, rgb_cnums, rgb_ccount))
					rgb_cnums[rgb_ccount++] = j;
				}
				++pt;
			}
			++absc;
		}
		err = render_separate(rgb_cnums,rgb_ccount,&sep->p.rect);
		pj_free(rgb_cnums);
		vs.ccolor = occolor;
	}
	else
	{
		err = render_separate(sep->p.ctable,sep->p.ccount,&sep->p.rect);
	}
	if(vs.cycle_draw && err >= Success)
		cycle_ccolor();
	return(err);
}
コード例 #25
0
ファイル: pocoflic.c プロジェクト: kodybrown/Animator-Pro
static Errcode build_playback_raster(Flic *pflic, Rcel *root, int x, int y)
/*****************************************************************************
 * make a playback raster.	vb.pencel is used unless the flic is a different
 * size, in which case a virtual raster is built over vb.pencel.
 ****************************************************************************/
{
    Flifile 	*flifile;
    Rectangle	therect;

    if (NULL == pflic)
        return Err_null_ref;

    if (NULL == (flifile = pflic->flifile))
        return Err_file_not_open;

    free_playback_raster(pflic);	/* free current raster, if any */

    if (NULL == root) {
        if (NULL == pflic->root_raster)
            pflic->root_raster = vb.pencel;
        root = pflic->root_raster;
    } else {
        pflic->root_raster = root;
    }

    if (root->width == flifile->hdr.width
            && root->height == flifile->hdr.height
            && x == 0
            && y == 0) {
        pflic->playback_raster = root;
    } else {
        if (x == 0 && y == 0) {
            therect.x = (root->width  - flifile->hdr.width)  / 2;
            therect.y = (root->height - flifile->hdr.height) / 2;
        } else {
            therect.x = x;
            therect.y = y;
        }
        therect.width  = flifile->hdr.width;
        therect.height = flifile->hdr.height;
        if (NULL == (pflic->playback_raster = pj_malloc(sizeof(Rcel)))) {
            return Err_no_memory;
        }
        pj_rcel_make_virtual(pflic->playback_raster, root, &therect);
    }

    return Success;
}
コード例 #26
0
	double *
pj_authset(double es) {
	double t, *APA;

	if ((APA = (double *)pj_malloc(APA_SIZE * sizeof(double))) != NULL) {
		APA[0] = es * P00;
		t = es * es;
		APA[0] += t * P01;
		APA[1] = t * P10;
		t *= es;
		APA[0] += t * P02;
		APA[1] += t * P11;
		APA[2] = t * P20;
	}
	return APA;
}
コード例 #27
0
ファイル: SEP.C プロジェクト: AnimatorPro/Animator-Pro
static Errcode get_sep_source_colors(Sep_cb *sep)
{
int color;
Errcode err;
SHORT ogrid;

	if ((sep->p.ctable = pj_malloc(COLORS)) == NULL)
		return(Err_no_memory);
	save_undo();
	if (vs.sep_box)
	{
		if((err = get_rub_rect(&sep->p.rect)) < 0)
			goto error;
		if((err = rub_rect_in_place(&sep->p.rect)) < 0)
			goto error;
	}
	else
	{
		sep->p.rect.x = sep->p.rect.y = 0;
		sep->p.rect.width = vb.pencel->width;
		sep->p.rect.height = vb.pencel->height;
	}

	if (vs.sep_rgb	== 2)	/* range */
	{
		sep->p.ccount = cluster_count();
		pj_copy_bytes(cluster_bundle(), sep->p.ctable, sep->p.ccount);
		return(Success);
	}

	ogrid = vs.use_grid;
	vs.use_grid = FALSE;

	for (;;)	/* gather up a table while pen down of colors under cursor */
	{
		color = pj_get_dot(vb.pencel,icb.mx,icb.my);
		if (!in_cnums(color, sep->p.ctable, sep->p.ccount) )
			sep->p.ctable[sep->p.ccount++] = color;
		wait_any_input();
		if (!ISDOWN(MBPEN))
			break;
	}
	vs.use_grid = ogrid;
	err = Success;
error:
	return(err);
}
コード例 #28
0
ファイル: nad_init.c プロジェクト: dyang02/SurrogateTools
int nad_ctable_load( struct CTABLE *ct, FILE *fid )

{
    int  a_size;

    fseek( fid, sizeof(struct CTABLE), SEEK_SET );

    /* read all the actual shift values */
    a_size = ct->lim.lam * ct->lim.phi;
    ct->cvs = (FLP *) pj_malloc(sizeof(FLP) * a_size);
    if( ct->cvs == NULL 
        || fread(ct->cvs, sizeof(FLP), a_size, fid) != a_size )
    {
        pj_errno = -38;
        return 0;
    }

    return 1;
} 
コード例 #29
0
ファイル: POCOGVAR.C プロジェクト: AnimatorPro/Animator-Pro
static Globalv *new_global_var(char *name, char *value)
/*****************************************************************************
 * alloc a new global var, copy the name and value into it.
 ****************************************************************************/
{
	Globalv *newvar;

	if (NULL == (newvar = pj_malloc(sizeof(Globalv)+strlen(name))))
		return NULL;
	strcpy(newvar->name, name);

	if (NULL == (newvar->value = new_value(value))) {
		pj_free(newvar);
		return NULL;
	}

	newvar->next = varlist;
	varlist = newvar;
	return newvar;
}
コード例 #30
0
ファイル: FLIPATH.C プロジェクト: AnimatorPro/Animator-Pro
Errcode alloc_flipath(char *fliname, Flifile *flif, Flipath **pfpath)

/* allocate and make up a flipath chunk to represent a fli will free before
 * allocating so the input must be initialized if FLIF is null the id will
 * be 0s */
{
Errcode err;
Flipath fp;
Fli_id zid;

	clear_struct(&zid); /* a fudge but if it's not a fli we zero out id */
	if((err = set_flipath(fliname, flif?&flif->hdr.id:&zid, &fp)) < Success)
		return(err);
	fp.id.size = err;
	free_flipath(pfpath);
	if((*pfpath = pj_malloc(fp.id.size)) == NULL)
		return(Err_no_memory);
	copy_flipath(&fp,*pfpath);
	return(Success);
}