Example #1
0
/* an n-step average filter, reducing output size by factor skip. scales output according to scale */
void NAME(average_filter)(data_out_t * out, const data_in_t * in, size_t len, size_t n, size_t skip, double scale, int issigned) {
	double avg = 0;
	size_t i, offset;
	for(i = 0; i < n-1; i++)
		avg += in[i];
	for(i = n-1, offset=0; i < len; i++, offset++) {
		avg += in[i];
		if(offset % skip == 0)
			out[offset/skip] = SSCALE((double) avg / n, issigned, scale);
		avg -= in[offset];
	}
}
Example #2
0
/*
 *	PUTSYMB( <character> )
 */
void putsymb(int c)	/* Draw character of the current font, point size at current position */
{  
	register struct charstr *datap;
	double scale;
	struct TIGvec vecsave;

	vecsave = ppmap;	/* Save current mapped position */

	c &= 0377;
	if((c < 0) || (c >= 0200)) {
		fprintf(stderr,"0%o: Illegal character\n",c);
		return;
	}

	scale = 10.0 * ppfsize / FNT_REF;

	if((datap = _getfc(c)) == (struct charstr*)NULL) {
		fprintf(stderr,"getfc fails\n");  
		return;
	}

	_drawc(datap->fdata, datap->chinfo.ftinfo.nvecs,
		scale, datap->chinfo.ftinfo.width);

	if( ppxskew || ppyskew ) {	/* Want skewed double print */
		struct TIGvec jvec;

		jvec.Xpos = vecsave.Xpos + SSCALE(ppxskew);
		jvec.Ypos = vecsave.Ypos + SSCALE(ppyskew);
		jvec.Zpos = vecsave.Zpos;
		move2pt(jvec.Xpos, jvec.Ypos, jvec.Zpos);
		_drawc(datap->fdata, datap->chinfo.ftinfo.nvecs,
			scale, datap->chinfo.ftinfo.width);
	}
	/* Return to start location */
	move2pt(vecsave.Xpos, vecsave.Ypos, vecsave.Zpos);
}