Example #1
0
/* Resamples N input maps into 1 output map.
 * For every pixel in the output map all input maps are scanned.
 * The output value of the pixel is determined according to the
 * cells of the input maps at the pixel location. With an optional
 * percentage a minimum coverage area for a non MV can be given.
 * Returns 0 if no error occurs, 1 otherwise.
 */ 
int SampleCont(
	MAP *out,		/* write-only output map */
 	MAP **in,		/* read-only list input maps */
 	double percentage,	/* min. percentage for non-MV */
 	size_t nrMaps,		/* number of input maps */
 	size_t nrRows,		/* number of rows */
 	size_t nrCols,		/* number of columns */
 	BOOL aligned,		/* maps are aligned */
 	REAL8 angle)		/* angle of output map */
 {		
	double r, c;
	size_t nrCoverCells = (size_t)ceil((percentage / 100) * rasterSize
					* rasterSize);
	InitCache(out, in, nrMaps);
	for(r = 0; r < nrRows; r++) 	
	{

		if(nrMaps > 1 && percentage > 0)
	 		raster = NewRaster(nrCoverCells, rasterSize);

	 	/* Print progress information if wanted */
	 	AppRowProgress((int) r);

	 	for(c = 0; c < nrCols; c++) 	
	 	{   /* For every output cell */
		    if(CalcPixel(out, in, nrCoverCells, nrMaps, r, c, aligned, angle)) 
			return 1;	/* allocation failed */
	 	}
	}

	AppEndRowProgress();
	if(nrMaps > 1 && percentage > 0)
		FreeRaster(raster);
	FreeCache(nrMaps);
	return 0;			/* successfully terminated */
 }
Example #2
0
SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const SkSurfaceProps* props) {
    return NewRaster(info, 0, props);
}