Example #1
0
OSMAND_CORE_UTILS_API void OSMAND_CORE_UTILS_CALL OsmAnd::EyePiece::rasterizeToStdOut( const Configuration& cfg )
{
#if defined(_UNICODE) || defined(UNICODE)
    rasterize(std::wcout, cfg);
#else
    rasterize(std::cout, cfg);
#endif
}
Example #2
0
OSMAND_CORE_UTILS_API QString OSMAND_CORE_UTILS_CALL OsmAnd::EyePiece::rasterizeToString( const Configuration& cfg )
{
#if defined(_UNICODE) || defined(UNICODE)
    std::wostringstream output;
    rasterize(output, cfg);
    return QString::fromStdWString(output.str());
#else
    std::ostringstream output;
    rasterize(output, cfg);
    return QString::fromStdString(output.str());
#endif
}
mapnik::featureset_ptr rasterizer_datasource::features(const mapnik::query& q) const
{
	std::clog << "Rasterizer::features"
			<< ", resolution_type=(" << q.resolution().head << "," << q.resolution().tail.head << ")"
			<< ", scale_denominator=" << q.scale_denominator()
			<< ", bbox=[" << q.get_bbox().minx() << "," << q.get_bbox().miny() << "," << q.get_bbox().maxx() << "," << q.get_bbox().maxy() << "]"
			<< std::endl;

	double	resx=q.resolution().head,
			resy=q.resolution().tail.head,
			bbox_width=q.get_bbox().width(),
			bbox_height=q.get_bbox().height();

	int 	pixel_width=round(bbox_width * resx),
			pixel_height=round(bbox_height * resy);

	if (pixel_width<=0 || pixel_height<=0) {
		std::clog << "Illegal rasterizer display metrics" << std::endl;
		return mapnik::featureset_ptr();
	}

	std::clog << "Rasterizer generating image of size (" << pixel_width << "," << pixel_height << ")" << std::endl;

	// Setup for render
	mapnik::feature_ptr feature(mapnik::feature_factory::create(1));
	mapnik::image_data_32 image(pixel_width, pixel_height);
	rasterize_params params(q, image);

	rasterize(params);

	// Prepare and return the raster feature
	feature->set_raster(boost::make_shared<mapnik::raster>(q.get_bbox(), image));
	return boost::make_shared<singleton_featureset>(singleton_featureset(feature));
}
Example #4
0
// the basic triset/volume wrapper
triset::triset(unsigned int maxVoxExt, const geom::triset& tris, PROGRESSFN pfn) {
	aabb bounds(tris.minX(), tris.maxX(), tris.minY(), tris.maxY(), tris.minZ(), tris.maxZ());

	initVolume(maxVoxExt, bounds.width(), bounds.height(), bounds.depth());
	alloc();

	// allow triangle coordinates to be normalized to voxel space
	geom::point to = geom::point(bounds.x0, bounds.y0, bounds.z0);
	double      sx = double(width() - 1) / bounds.width();
	double      sy = double(height() - 1) / bounds.height();
	double      sz = double(depth() - 1) / bounds.depth();

	size_t n = tris.size();
	for (unsigned int i = 0; i < n; ++i) {
		if (pfn) {
			pfn("Voxelizing triangle", i, n);
		}

		// convert this triangle into voxel volume coordinates
		geom::triangle tri = tris[i] - to;
		tri.scale(sx, sy, sz);

		// put voxels on this surface into the voxel volume
		rasterize(tri);
	}
}
Example #5
0
void pCanvas::constructor() {
  qtWidget = qtCanvas = new QtCanvas(*this);
  qtCanvas->setMouseTracking(true);

  pWidget::synchronizeState();
  rasterize(), qtCanvas->update();
}
Example #6
0
void render_sample_triangle() {
  screen_init(&display, WIDTH, HEIGHT);
  bmp.w = WIDTH;
  bmp.h = HEIGHT;
  bmp.data = (color_t*)malloc(bmp.w*bmp.h*sizeof(int));
  int i;
  for(i=0; i<bmp.w*bmp.h; i++) {
    bmp.data[i] = 0xFF0000;
  }
  for(i=0; i<5; i++)
    screen_update(display, &bmp);

  triangle2d_t tri = triangle2d_init( 
      point2d_init(100, 100, 10, 0xFF0000), 
      point2d_init(500, 100, 100, 0x00FF00), 
      point2d_init(300, 500, 5, 0x0000FF) );

  ALLEGRO_EVENT_QUEUE *event_queue = NULL;
  event_queue = al_create_event_queue();
  al_register_event_source(event_queue, al_get_display_event_source(display));

  while(true) {
    rasterize(&bmp, &tri, 1);
    screen_update(display, &bmp);
    ALLEGRO_EVENT ev;
    al_wait_for_event(event_queue, &ev);
    if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
      break;
    }
  }
}
Example #7
0
void HalfEllipsoid::draw( Geovalue &gval, GsTLGridProperty *propTi )
{
	grid_->select_property( propTi->name() ); 
	
	double p = gen_();
	rmax_ = get_max_radius( p );
	rmed_ = get_med_radius( p );
	rmin_ = get_min_radius( p );
	
	//Convert angles to radian
	float strike = get_orientation( p );
	float deg_to_rad = -3.14159265/180; 
	if ( strike > 180 ) strike -= 360; 
	if ( strike < -180 ) strike += 360; 
    strike *= deg_to_rad;

	int node_id = gval.node_id();
	std::vector<float> facies_props;
	std::vector<Geovalue> gbRaster = rasterize( node_id, propTi, strike, facies_props );
	
	rasterizedVol_ = 0;
	if ( accept_location( facies_props ) ) {
		std::vector<Geovalue>::iterator gv_itr;	
		for ( gv_itr = gbRaster.begin(); gv_itr != gbRaster.end(); ++gv_itr ) {
			int cur_index = propTi->get_value( gv_itr->node_id() );
			gstl_assert( ( cur_index >= 0 ) && ( cur_index < erosion_rules_.size() ) );
			if ( cur_index != geobody_index_ ) {
				if ( erosion_rules_[cur_index] == 1 ) { //decrease proportion of eroded geobodies?
					propTi->set_value( geobody_index_, gv_itr->node_id() );
					rasterizedVol_++;
				}
			}
		}
	}
}
Example #8
0
/**
 * Merge point cloud in the internal model
 * with the sensor to world transformation,
 * and slide, save, load tiles.
 *
 * @param cloud: point cloud in the sensor frame
 * @param transformation: sensor to world transformation
 */
void atlaas::merge(points& cloud, const matrix& transformation,
        const covmat& covariance, bool dump) {
    if (cloud.size() < 1)
        return; // pcl writeBinaryCompressed crash with empty cloud
    if (dump) {
        save_inc(cloud, transformation);
        if (reprocess_in_progress)
            return;
    }

    sensor_xy = matrix_to_point(transformation);
    // slide map while needed
    do_slide();
    // use dynamic merge
    // clear the dynamic map (zeros)
    cell_info_t zeros{}; // value-initialization w/empty initializer
    std::fill(dyninter.begin(), dyninter.end(), zeros);
    // transform the cloud from sensor to custom frame
    transform(cloud, transformation);
    // merge the point-cloud
    rasterize(cloud, dyninter);

    // merge the dynamic atlaas with internal data
    merge();
}
Example #9
0
void Sinusoid::draw( Geovalue &gval, GsTLGridProperty *propTi )
{
	grid_->select_property( propTi->name() ); 

	double p = gen_();
	get_length( p );
	get_width( p );
	depth_ = cdf_depth_->inverse( p );

	//Convert angle to radian & do checks
	float strike = get_orientation( p );
	float deg_to_rad = 3.14159265/180;
	if ( strike > 180 ) strike -= 360;  
	if ( strike < -180 ) strike += 360; 
    strike *= deg_to_rad;

	amp_ = get_amplitude( p );
	wvlength_ = get_wavelength( p );

	// Channel cross-section is defined by a lower half ellipsoid
	// whose max radius equals channel width, med_radius = 1,
	// and min radius equals channel depth
	cdfType* cdf_hellipRot = new Dirac_cdf( 0.0 );
	cdfType* cdf_hellipMaxr = new Dirac_cdf( half_width_ ); 
	cdfType* cdf_hellipMedr = new Dirac_cdf( 1 );
	cdfType* cdf_hellipMinr = new Dirac_cdf( depth_ );

	int lower_half = 1;
	hellip_ = new HalfEllipsoid(
		grid_, geobody_index_, lower_half,
		cdf_hellipRot, cdf_hellipMaxr, cdf_hellipMedr, 
		cdf_hellipMinr, objErosion_, objOverlap_
	);

	int node_id = gval.node_id();
	Matrix_2D rot = get_rot_matrix( strike );
	std::vector<std::vector<Geovalue> > gbRaster = rasterize( node_id, propTi, strike, rot );

	rasterizedVol_ = 0;
	if ( accept_location( gbRaster, propTi ) ) {
		std::vector< std::vector<Geovalue> >::iterator sup_itr;
		std::vector<Geovalue>::iterator gv_itr;
		for ( sup_itr = gbRaster.begin(); sup_itr != gbRaster.end(); ++sup_itr ) {
			gv_itr = sup_itr->begin();
			for ( ; gv_itr != sup_itr->end(); ++gv_itr ) {
				int cur_index = propTi->get_value( gv_itr->node_id() );
				gstl_assert( ( cur_index >= 0 ) && ( cur_index < erosion_rules_.size() ) );
				if ( cur_index != geobody_index_ ) {
					if ( erosion_rules_[cur_index] == 1 ) { // Decrease proportion of eroded index?
						propTi->set_value( geobody_index_, gv_itr->node_id() );
						rasterizedVol_++;
					}
				}
			}
		}
	} 
	delete hellip_;
}
Example #10
0
int
readgifimage(char* mode)
{
    unsigned char buf[9];
    int local, interleaved;
    unsigned char localmap[256][3];
    int localbits;
    int status;
    size_t raster_size;

    if (fread(buf, 1, 9, infile) != 9) {
        fprintf(stderr, "short read from file %s (%s)\n",
                filename, strerror(errno));
	return (0);
    }
    width = (buf[4] + (buf[5] << 8)) & 0xffff; /* 16 bit */
    height = (buf[6] + (buf[7] << 8)) & 0xffff;  /* 16 bit */
    local = buf[8] & 0x80;
    interleaved = buf[8] & 0x40;
    if (width == 0UL || height == 0UL || (width > 2000000000UL / height)) {
        fprintf(stderr, "Invalid value of width or height\n");
        return(0);
    }
    if (local == 0 && global == 0) {
        fprintf(stderr, "no colormap present for image\n");
        return (0);
    }
    raster_size=width*height;
    if ((raster_size/width) == height) {
        raster_size += EXTRAFUDGE;  /* Add elbow room */
    } else {
        raster_size=0;
    }
    if ((raster = (unsigned char*) _TIFFmalloc(raster_size)) == NULL) {
        fprintf(stderr, "not enough memory for image\n");
        return (0);
    }
    if (local) {
        localbits = (buf[8] & 0x7) + 1;

        fprintf(stderr, "   local colors: %d\n", 1<<localbits);

        if (fread(localmap, 3, ((size_t)1)<<localbits, infile) !=
            ((size_t)1)<<localbits) {
            fprintf(stderr, "short read from file %s (%s)\n",
                    filename, strerror(errno));
            return (0);
        }
        initcolors(localmap, 1<<localbits);
    } else if (global) {
        initcolors(globalmap, 1<<globalbits);
    }
    if ((status = readraster()))
	rasterize(interleaved, mode);
    _TIFFfree(raster);
    return status;
}
Example #11
0
//-------------------------------
//---------RUNTIME STUFF---------
//-------------------------------
void runCuda() {
    // Map OpenGL buffer object for writing from CUDA on a single GPU
    // No data is moved (Win & Linux). When mapped to CUDA, OpenGL should not use this buffer
    dptr = NULL;

    cudaGLMapBufferObject((void **)&dptr, pbo);
    rasterize(dptr);
    cudaGLUnmapBufferObject(pbo);

    frame++;
    fpstracker++;
}
Example #12
0
DLLEXPORT void rasterize_bezigon(double * alpha_arr,
                                 const double * data, const int n, const int w, const int h)
{
    //-- filter
    typedef FilterBox<1> FilterType;
    FilterType filter;

    //-- curves
    Array<Curve<2,2> > lines;
    Array<Curve<3,2> > quads;
    Array<Curve<4,2> > cubics;
    Array<Curve<3,3> > rquads;

    for (int i = 0; i < n; i += 6) {
        Curve<4,2> cubic;
        cubic.p[0].set(data[i],			data[i+1]);
        cubic.p[1].set(data[i+2],		data[i+3]);
        cubic.p[2].set(data[i+4],		data[i+5]);
        cubic.p[3].set(data[(i+6)%n],	data[(i+7)%n]);
        cubics.push_back(cubic);
    }

    //-- image
    Array2D<vect1d> img;
    int extra = (filter.W >> 1) << 1;
    img.resize(w + extra, h + extra);
    vect1d zero;
    zero = 0;
    img = zero;

    //-- color
    ColorFunction<1,1> color;
    color.comp[0].c[0] = 1;

    //-- rasterize
    RasterizerInstance<FilterType::W, 1, 1> inst(
        img, lines.s, quads.s, cubics.s, rquads.s);
    rasterize(inst, color, &lines, &filter.filter22[0],
              &quads, &filter.filter32[0], &cubics, &filter.filter42[0],
              &rquads, &filter.filter33[0]);

    //-- output
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int idx = i*w + j;
            alpha_arr[idx] = img.data[idx].getitem(0);
        }
    }
}
Example #13
0
void Renderer::render(Model &model, int *shadow_buffer) {
	std::vector<Vec3i> verts(model.nverts());
	for (int i=0; i<model.nverts(); i++) {
		verts[i] = vertex_shader(model, i);
	}
	clear();
	_zbuffer = std::vector<int>(get_width()*get_height(), -1);
	for (int i=0; i<model.nfaces(); i++) {
		std::vector<Vec3i> f = model.face(i);
		ScreenVertex triangle[3];
		for (int t=0; t<3; t++) {
			triangle[t] = ScreenVertex(verts[f[t].ivert], model.uv(f[t].iuv));
		}
		rasterize(triangle, model, shadow_buffer);
	}
}
Example #14
0
int main(int argc, char **argv) {
    printf("\n");
    printf("Welcome to Rasterizer 3000.\n");
    printf("===========================\n\n");

    Config config;

    int rows, //9175,
        cols, //6814,
        i,
        j;

    calcImageSize(&config, &rows, &cols);

    Index index;
    index.nodes = malloc(rows*cols*sizeof(PointNode *));
    index.config = &config;
    index.rows = rows;
    index.cols = cols;

    Image image;
    image.pixels = malloc(rows*cols*sizeof(float));
    image.rows = rows;
    image.cols = cols;
    image.config = &config;

    // Initialize arrays
    for (j=0; j<rows; j++) {
        for (i=0; i<cols; i++) {
            *(index.nodes+(j*cols)+i) = 0;
            *(image.pixels+(j*cols)+i) = EMPTY_VAL;
        }
    }

    // data
    readPointsFromFile("sample.txt", &index);

    printIndexBins(&index);

    rasterize(&index, &image);

    printImage(&image);

    free(image.pixels);
    free(index.nodes);
    return 0;
}
Example #15
0
Voxel::Voxel(Mesh & m, int res):
gridsize(res)
{
  real_t mn[VOXEL_DIM], mx[VOXEL_DIM];
  real_t msize=0; //size of the longest axis of the bounding box of the mesh

  for(int jj=0; jj<VOXEL_DIM; jj++) {
    mn[jj]=m.v[0][jj];
    mx[jj]=m.v[0][jj];
  }

  for(size_t ii=0; ii<m.v.size(); ii++) {
    for(int jj=0; jj<VOXEL_DIM; jj++) {
      if(m.v[ii][jj]<mn[jj]) {
        mn[jj]=m.v[ii][jj];
      }
      if(m.v[ii][jj]>mx[jj]) {
        mx[jj]=m.v[ii][jj];
      }
    }
  }

  msize=mx[0]-mn[0];
  for(size_t jj=0; jj<VOXEL_DIM; jj++) {
    real_t len=mx[jj]-mn[jj];
    if(msize<len) {
      msize=len;
    }
  }

  for(size_t jj=0; jj<VOXEL_DIM; jj++) {
    mn[jj]=(mn[jj]+mx[jj]-msize)/2;
  }

  real_t gridlen=msize/res;

  for(size_t ii=0; ii<m.t.size(); ii++) {
    rasterize(ii,m,mn,gridlen,gridset);
  }

  if(cube.v.size()==0){
    Voxel::cube.load_mesh("cube.ply2");
  }
  for(size_t ii=0;ii<cube.v.size();ii++){
    cube.v[ii]/=gridsize;
  }
}
Example #16
0
bool TextBuffer::addLabel(const std::string& _text, Label::Transform _transform, Label::Type _type) {

    auto fontContext = FontContext::GetInstance();

    fontContext->lock();

    auto& quads = fontContext->rasterize(_text, m_fontID, m_fontSize, m_fontBlurSpread);
    size_t numGlyphs = quads.size();

    if (numGlyphs == 0) {
        fontContext->unlock();
        return false;
    }

    auto& vertices = m_vertices[0];
    int vertexOffset = vertices.size();
    int numVertices = numGlyphs * 4;
    vertices.reserve(vertices.size() + numVertices);

    float inf = std::numeric_limits<float>::infinity();
    float x0 = inf, x1 = -inf, y0 = inf, y1 = -inf;

    for (auto& q : quads) {
        x0 = std::min(x0, std::min(q.x0, q.x1));
        x1 = std::max(x1, std::max(q.x0, q.x1));
        y0 = std::min(y0, std::min(q.y0, q.y1));
        y1 = std::max(y1, std::max(q.y0, q.y1));

        vertices.push_back({{q.x0, q.y0}, {q.s0, q.t0}});
        vertices.push_back({{q.x0, q.y1}, {q.s0, q.t1}});
        vertices.push_back({{q.x1, q.y0}, {q.s1, q.t0}});
        vertices.push_back({{q.x1, q.y1}, {q.s1, q.t1}});
    }

    fontContext->unlock();

    glm::vec2 size((x1 - x0), (y1 - y0));

    m_labels.emplace_back(new TextLabel(_text, _transform, _type, size,
                                        *this, { vertexOffset, numVertices }));

    // TODO: change this in TypeMesh::adVertices()
    m_nVertices = vertices.size();

    return true;
}
bool OsmAnd::MapRasterLayerProvider_P::obtainData(
    const TileId tileId,
    const ZoomLevel zoom,
    std::shared_ptr<MapRasterLayerProvider::Data>& outTiledData,
    MapRasterLayerProvider_Metrics::Metric_obtainData* const metric_,
    const IQueryController* const queryController)
{
#if OSMAND_PERFORMANCE_METRICS
    MapRasterLayerProvider_Metrics::Metric_obtainData localMetric;
    const auto metric = metric_ ? metric_ : &localMetric;
#else
    const auto metric = metric_;
#endif

    // Obtain offline map primitives tile
    std::shared_ptr<MapPrimitivesProvider::Data> primitivesTile;
    owner->primitivesProvider->obtainData(
        tileId,
        zoom,
        primitivesTile,
        metric ? metric->findOrAddSubmetricOfType<MapPrimitivesProvider_Metrics::Metric_obtainData>().get() : nullptr,
        nullptr);
    if (!primitivesTile || primitivesTile->primitivisedObjects->isEmpty())
    {
        outTiledData.reset();
        return true;
    }

    // Perform actual rasterization
    const auto bitmap = rasterize(tileId, zoom, primitivesTile, metric, queryController);
    if (!bitmap)
        return false;

    // Or supply newly rasterized tile
    outTiledData.reset(new MapRasterLayerProvider::Data(
        tileId,
        zoom,
        AlphaChannelPresence::NotPresent,
        owner->getTileDensityFactor(),
        bitmap,
        primitivesTile,
        new RetainableCacheMetadata(primitivesTile->retainableCacheMetadata)));

    return true;
}
Example #18
0
int
readgifimage(char* mode)
{
    unsigned char buf[9];
    int local, interleaved;
    unsigned char localmap[256][3];
    int localbits;
    int status;

    if (fread(buf, 1, 9, infile) == 0) {
        perror(filename);
	return (0);
    }
    width = buf[4] + (buf[5] << 8);
    height = buf[6] + (buf[7] << 8);
    local = buf[8] & 0x80;
    interleaved = buf[8] & 0x40;
    if (width == 0 || height == 0 || width > 2000000000 / height) {
        fprintf(stderr, "Invalid value of width or height\n");
        return(0);
    }
    if (local == 0 && global == 0) {
        fprintf(stderr, "no colormap present for image\n");
        return (0);
    }

    if ((raster = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {
        fprintf(stderr, "not enough memory for image\n");
        return (0);
    }
    if (local) {
        localbits = (buf[8] & 0x7) + 1;

        fprintf(stderr, "   local colors: %d\n", 1<<localbits);

        fread(localmap, 3, ((size_t)1)<<localbits, infile);
        initcolors(localmap, 1<<localbits);
    } else if (global) {
        initcolors(globalmap, 1<<globalbits);
    }
    if ((status = readraster()))
	rasterize(interleaved, mode);
    _TIFFfree(raster);
    return status;
}
Example #19
0
void FontRenderer::on_fontSizeChanged() {
    if (!m_ft_face) return;
    bool fixedsize = (FT_FACE_FLAG_SCALABLE & m_ft_face->face_flags ) == 0;
    int size = m_config->size();
    if (fixedsize) {
        qDebug() << "fixed size not impemented";
    } else {
        int size_x = static_cast<int>(m_config->width()*size*64.0f/100.0f);
        int size_y = static_cast<int>(m_config->height()*size*64.0f/100.0f);
        int error = FT_Set_Char_Size(m_ft_face,
                                     FT_F26Dot6(size_x),
                                     FT_F26Dot6(size_y),m_config->DPI(),m_config->DPI());
        //int error = FT_Set_Pixel_Sizes(m_ft_face,size_x/64,size_y/64);
        if (error) {
            qDebug() << "FT_Set_Char_Size error " << error;
        }
    }
    rasterize();
}
Example #20
0
void pCanvas::setGeometry(Geometry geometry) {
  if(canvas.state.width == 0 || canvas.state.height == 0) rasterize();
  unsigned width = canvas.state.width;
  unsigned height = canvas.state.height;
  if(width == 0) width = widget.state.geometry.width;
  if(height == 0) height = widget.state.geometry.height;

  if(width < geometry.width) {
    geometry.x += (geometry.width - width) / 2;
    geometry.width = width;
  }

  if(height < geometry.height) {
    geometry.y += (geometry.height - height) / 2;
    geometry.height = height;
  }

  pWidget::setGeometry(geometry);
}
Example #21
0
void util::CubicBezierCurve::draw() {
    if (!m_rasterized) {
        rasterize();
    }

    glPointSize(3.0);
    glBegin(GL_POINTS);
    for (unsigned i = 0; i < m_controlPoints.size(); i++) {
        glVertex2f(m_controlPoints[i].x, m_controlPoints[i].y);
    }
    glEnd();

    glPointSize(0.3);
    glBegin(GL_POINTS);
    for (unsigned i = 0; i < m_rasterizedPoints.size(); i++) {
        glVertex2f(m_rasterizedPoints[i].x, m_rasterizedPoints[i].y);
    }
    glEnd();
}
Example #22
0
std::shared_ptr<SkBitmap> OsmAnd::TextRasterizer_P::rasterize(
    const QString& text,
    const Style& style,
    QVector<SkScalar>* const outGlyphWidths,
    float* const outExtraTopSpace,
    float* const outExtraBottomSpace,
    float* const outLineSpacing) const
{
    std::shared_ptr<SkBitmap> bitmap(new SkBitmap());
    const bool ok = rasterize(
                        *bitmap,
                        text,
                        style,
                        outGlyphWidths,
                        outExtraTopSpace,
                        outExtraBottomSpace,
                        outLineSpacing);
    if (!ok)
        return nullptr;
    return bitmap;
}
Example #23
0
/*************************************************************************
    Return a pointer to the glyphDat struct for the given codepoint,
    or 0 if the codepoint does not have a glyph defined.
*************************************************************************/
const FontGlyph *Font::getGlyphData (utf32 codepoint)
{
    if (codepoint > d_maxCodepoint)
        return 0;

    if (d_glyphPageLoaded)
    {
        // Check if glyph page has been rasterized
        uint page = codepoint / GLYPHS_PER_PAGE;
        uint mask = 1 << (page & (BITS_PER_UINT - 1));
        if (!(d_glyphPageLoaded [page / BITS_PER_UINT] & mask))
        {
            d_glyphPageLoaded [page / BITS_PER_UINT] |= mask;
            rasterize (codepoint & ~(GLYPHS_PER_PAGE - 1),
                       codepoint | (GLYPHS_PER_PAGE - 1));
        }
    }

    CodepointMap::const_iterator pos = d_cp_map.find (codepoint);
    return (pos != d_cp_map.end()) ? &pos->second : 0;
}
Example #24
0
 void BlockPhysicsComponent::create()
 {
     Vector2 centroid = polygon_.getCentroid();
     float angle = -M_PI + 2.0f * M_PI * actor_->getGame()->getRandomFloat();
     
     b2BodyDef bodyDef;
     bodyDef.position.Set(centroid.x, centroid.y);
     bodyDef.angle = angle;
     bodyDef.userData = actor_;
     body_ = physicsManager_->getWorld()->CreateBody(&bodyDef);
     
     b2Vec2 vertices[b2_maxPolygonVertices];
     int32 vertexCount = std::min(int32(polygon_.vertices.size()),
                                  b2_maxPolygonVertices);
     
     for (int32 i = 0; i < vertexCount; ++i) {
         b2Vec2 vertex(polygon_.vertices[i].x, polygon_.vertices[i].y);
         vertices[i] = body_->GetLocalPoint(vertex);
         localPolygon_.vertices.push_back(Vector2(vertices[i].x, vertices[i].y));
     }
     b2PolygonShape shape;
     shape.Set(vertices, vertexCount);
     b2FixtureDef fixtureDef;
     fixtureDef.shape = &shape;
     fixtureDef.density = 2.5f;
     fixtureDef.filter.groupIndex = -1;
     body_->CreateFixture(&fixtureDef);
     
     Polygon2 innerPolygon = polygon_;
     innerPolygon.pad(-0.15f);
     for (int32 i = 0; i < vertexCount; ++i) {
         b2Vec2 vertex(innerPolygon.vertices[i].x, innerPolygon.vertices[i].y);
         vertices[i] = body_->GetLocalPoint(vertex);
     }
     b2PolygonShape innerShape;
     innerShape.Set(vertices, vertexCount);
     body_->CreateFixture(&innerShape, 0.0f);
     
     rasterize(polygon_);
 }
Example #25
0
bool VoxelsIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask,const RichParameterSet & par, vcg::CallBackPos *cb, QWidget *parent)
{
  // TODO Add error messages

  vcg::tri::UpdatePosition< CMeshO >::Scale
    ( m.cm,
      static_cast< CMeshO::ScalarType >( rasterization_scale ) );

  vcg::tri::UpdateBounding< CMeshO >::Box( m.cm );

  init_voxmap_size( m );

  QScopedArrayPointer< unsigned char > voxels( rasterize( this, m ) );

  QString nrrd;

  if( !voxels ||
      (nrrd = write_nrrd( voxels.data() )).isEmpty() ||
      !(voxels.reset( resample( nrrd )), voxels) ||
      !write_tiles( voxels.data(), fileName ) )
    return false;

  QFile header( fileName.endsWith( ".voxels" ) ?
                fileName.left( fileName.length() -
                               QString( ".voxels" ).length() ) :
                fileName + ".header" );
  if( !header.open( QIODevice::WriteOnly ) )
    return false;

  QTextStream str( &header );
  str <<
    ";;; -*- lisp -*-\n(size " <<
    voxmap_size.X() << " " << voxmap_size.Y() << " " << voxmap_size.Z() <<
    ")\n(voxels . \"" << fileName << "\")\n";

  return true;
}
Example #26
0
void FontRenderer::on_fontColorChanged() {
    rasterize();
}
Example #27
0
 raster *rasterize1(unsigned long code) { return rasterize(code); }
Example #28
0
void rasterize_AS3()
{
	rasterize();
}
Example #29
0
void FontRenderer::on_fontCharactersChanged() {
    rasterize();
}
Example #30
0
void FontRenderer::on_fontOptionsChanged() {

    rasterize();
}