Пример #1
0
void 
SVG::draw_outline(const ExPolygon &expolygon, std::string stroke_outer, std::string stroke_holes, coordf_t stroke_width)
{
    draw_outline(expolygon.contour, stroke_outer, stroke_width);
    for (Polygons::const_iterator it = expolygon.holes.begin(); it != expolygon.holes.end(); ++ it) {
        draw_outline(*it, stroke_holes, stroke_width);
    }
}
Пример #2
0
void Chunk::Draw( Vec2i offset, sf::IntRect visible )
{
    // Draw stars
    for( size_t i = 0; i < stars.size(); ++i ) {
        const Vec2i &pos = stars[i].GetPos();
        if( visible.Contains( pos.x, pos.y ) ) {
            stars[i].Draw( offset );
        }
    }

    // Draw items
    for( size_t i = 0; i < items.size(); ++i ) {
        const Vec2i &pos = items[i]->GetPos();
        if( visible.Contains( pos.x, pos.y ) ) {
            items[i]->Draw( offset );
        }
    }

    // Draw outlines
    if( SETTINGS->GetValue<bool>( "bounding_box_show" ) ) {
        for( Items::iterator it = items.begin(); it != items.end(); ++it ) {
            const Vec2i &pos = (*it)->GetPos();
            if( visible.Contains( pos.x, pos.y ) ) {
                draw_outline( (*it)->BoundingBox(), offset );
            }
        }
    }
}
Пример #3
0
// callback function that tells OpenGL how to redraw window
void display( void )
{
    glClear( GL_COLOR_BUFFER_BIT );
    // clear the display
    switch(GAMESTATE)
    {
    //Game not yet started
    case 0:
        showStartScreen();
        LEFT_SCORE = 0;
        RIGHT_SCORE = 0;
        BALL_WARP = 1;
        PADDLE_WARP = 1;
        //Display Name
        //Display Controls
        break;

    }
    if(PAUSED)
    {
        showPausedStr();
    }
    draw_scores();
    left_paddle.draw();
    right_paddle.draw();
    draw_outline();
    ball.draw();
    glFlush();
    glutSwapBuffers();
}
Пример #4
0
void sweep(Client *c) {
    XEvent ev;
    int old_cx = c->x;
    int old_cy = c->y;

    if (!grab_pointer(c->screen->root, MouseMask, resize_curs)) return;

    client_raise(c);
#ifdef INFOBANNER_MOVERESIZE
    create_info_window(c);
#endif
    XGrabServer(dpy);
    draw_outline(c);

    setmouse(c->window, c->width, c->height);
    for (;;) {
        XMaskEvent(dpy, MouseMask, &ev);
        switch (ev.type) {
        case MotionNotify:
            if (ev.xmotion.root != c->screen->root)
                break;
            draw_outline(c); /* clear */
            XUngrabServer(dpy);
            recalculate_sweep(c, old_cx, old_cy, ev.xmotion.x, ev.xmotion.y, ev.xmotion.state & altmask);
#ifdef INFOBANNER_MOVERESIZE
            update_info_window(c);
#endif
            XSync(dpy, False);
            XGrabServer(dpy);
            draw_outline(c);
            break;
        case ButtonRelease:
            draw_outline(c); /* clear */
            XUngrabServer(dpy);
#ifdef INFOBANNER_MOVERESIZE
            remove_info_window();
#endif
            XUngrabPointer(dpy, CurrentTime);
            moveresize(c);
            /* In case maximise state has changed: */
            ewmh_set_net_wm_state(c);
            return;
        default:
            break;
        }
    }
}
Пример #5
0
void draw_window(BITMAP *bmp, int x, int y, int w, int h, int col)
{
	for(int yy=2; yy < h-2; yy++)
	{
		float bri = 1 - ((float)yy / (float)(h)) + 0.3f;
		int ccol = makecol( getr(col)*bri, getg(col)*bri, getb(col)*bri );

		for(int xx=2; xx < w-2; xx++)
		{
			if(xx % 2 == yy % 2 && xx+yy > 7)
			{
				putpixel(bmp, x+xx,y+yy, ccol);
			}
		}
	}

	draw_outline(bmp, x-1,y-1, w,h, makecol(230,230,230));
	draw_outline(bmp, x,y, w,h, makecol(200,200,200));
	draw_outline(bmp, x+1,y+1, w,h, makecol(128,128,128));
}
Пример #6
0
void SVGOut::draw(std::ostream& out) {
	out << "<?xml version=\"1.0\" standalone=\"no\"?>\n";
	out << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
	out << "<svg width=\"3.00in\" height=\"3.00in\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n";
	out << "<desc>Sudoku</desc>\n";
	
	for(int i=0; i < highlighted_boxes.size(); i++) {
		Out_Highlight n = highlighted_boxes[i];
		draw_highlight_box(out, n.val, n.r, n.g, n.b);
	}
	
	for(int i=0; i < highlighted_cols.size(); i++) {
		Out_Highlight n = highlighted_cols[i];
		draw_highlight_col(out, n.val, n.r, n.g, n.b);
	}
	
	for(int i=0; i < highlighted_rows.size(); i++) {
		Out_Highlight n = highlighted_rows[i];
		draw_highlight_row(out, n.val, n.r, n.g, n.b);
	}
	
	for(int i=0; i < highlighted_cells.size(); i++) {
		Out_Highlight n = highlighted_cells[i];
		draw_highlight_cell(out, n.p, n.r, n.g, n.b);
	}
	
	for(int i=0; i < highlighted_candidates.size(); i++) {
		Out_Highlight n = highlighted_candidates[i];
		draw_highlight_candidate(out, n.p, n.val, n.r, n.g, n.b);
	}
	
	for(int i=0; i < outlined_cells.size(); i++) {
		Out_Outline n = outlined_cells[i];
		draw_outline(out, n.p, n.r, n.g, n.b);
	}
	
	for(int i=0; i < fullnumbers.size(); i++) {
		Out_Number n = fullnumbers[i];
		draw_fullnumber(out, n.p, n.val);
	}
	
	for(int i=0; i < candidates.size(); i++) {
		Out_Number n = candidates[i];
		draw_candidate(out, n.p, n.val);
	}
	
	draw_grid(out);
	
	out << "</svg>\n";
}
Пример #7
0
int ps_outline(void)
{
    /* let user know what's happenning */
    G_message(_("Outlining areas in raster map <%s in %s> ..."),
	      PS.cell_name, PS.cell_mapset);

    /* set the outline color and width */
    set_ps_color(&PS.outline_color);
    set_line_width(PS.outline_width);

    /* create temporary vector map containing outlines */
    o_io_init();
    map_type = o_open_file(PS.cell_name);
    draw_outline();
    o_close_file();

    return 0;
}
Пример #8
0
void KeyboardLayoutWidget::drawKey(QPainter* painter, DrawingKey* key)
{
    XkbShapeRec *shape;
    QColor color;
    XkbOutlineRec *outline;
    int origin_offset_x;
    /* gint i; */

    if (!xkb)
        return;

    shape = xkb->geom->shapes + key->xkbkey->shape_ndx;

    if (key->pressed)
        color = qApp->palette().color(QPalette::Active, QPalette::Highlight);
    else
        color = colors[key->xkbkey->color_ndx];

    /* draw the primary outline */
    outline = shape->primary ? shape->primary : shape->outlines;
    drawOutline (painter, outline, color, key->angle, key->originX, key->originY);
#if 0
    /* don't draw other outlines for now, since
     * the text placement does not take them into account
     */
    for (i = 0; i < shape->num_outlines; i++) {
        if (shape->outlines + i == shape->approx ||
            shape->outlines + i == shape->primary)
            continue;
        draw_outline (context, shape->outlines + i, NULL,
                  key->angle, key->origin_x, key->origin_y);
    }
#endif
    origin_offset_x = calcShapeOriginOffsetX (outline);
    drawKeyLabel (painter, key->keycode, key->angle,
            key->originX + origin_offset_x, key->originY,
            shape->bounds.x2, shape->bounds.y2, key->pressed);
}
Пример #9
0
void 
SVG::draw_outline(const Polygons &polygons, std::string stroke, coordf_t stroke_width)
{
    for (Polygons::const_iterator it = polygons.begin(); it != polygons.end(); ++ it)
        draw_outline(*it, stroke, stroke_width);
}
Пример #10
0
void 
SVG::draw_outline(const SurfacesPtr &surfaces, std::string stroke_outer, std::string stroke_holes, coordf_t stroke_width)
{
    for (SurfacesPtr::const_iterator it = surfaces.begin(); it != surfaces.end(); ++ it)
        draw_outline(*(*it), stroke_outer, stroke_holes, stroke_width);
}
Пример #11
0
void 
SVG::draw_outline(const Surface &surface, std::string stroke_outer, std::string stroke_holes, coordf_t stroke_width)
{
    draw_outline(surface.expolygon, stroke_outer, stroke_holes, stroke_width);
}
Пример #12
0
void 
SVG::draw_outline(const ExPolygons &expolygons, std::string stroke_outer, std::string stroke_holes, coordf_t stroke_width)
{
    for (ExPolygons::const_iterator it = expolygons.begin(); it != expolygons.end(); ++ it)
        draw_outline(*it, stroke_outer, stroke_holes, stroke_width);
}
Пример #13
0
void Space::Draw()
{
    Vec2i offset = -cam;
    Tree::ClearWindow( Tree::Color( 0xFF000000 ) );

    Vec2i chunk = CurrentChunkIndex();

    DrawChunk( chunk, offset );

    // Draw surrounding chunks
    DrawChunk( chunk.x - 1, chunk.y, offset );
    DrawChunk( chunk.x + 1, chunk.y, offset );
    DrawChunk( chunk.x, chunk.y - 1, offset );
    DrawChunk( chunk.x, chunk.y + 1, offset );

    DrawChunk( chunk.x - 1, chunk.y - 1, offset );
    DrawChunk( chunk.x - 1, chunk.y + 1, offset );
    DrawChunk( chunk.x + 1, chunk.y - 1, offset );
    DrawChunk( chunk.x + 1, chunk.y + 1, offset );

    box.Draw( offset );

    // Draw satellite
    satellite.Draw( offset );

    if( satellite.SeesWayHome() ) {
        arrow_home_spr.Move( offset );
        Tree::Draw( arrow_home_spr );
    }

    if( SETTINGS->GetValue<bool>( "bounding_box_show" ) ) {
        draw_outline( satellite.BoundingBox(), -cam );
    }

    // Draw GUI elements
    DrawCollected();
    DrawLife();
    DrawFuel();

    if( victory ) {
        Vec2i pos = satellite.GetPos() + offset;

        friend_spr.SetPosition( pos.x + 15, pos.y - 10 );
        Tree::Draw( friend_spr );

        talk_str.SetPosition( pos.x + 5, pos.y - 35 );
        talk_str.SetColor( Tree::Color( 0xffeeeeee ) );
        Tree::Draw( talk_str );

        sf::Shape black = sf::Shape::Rectangle( 0, 0, Tree::GetWindowWidth(), Tree::GetWindowHeight(),
            sf::Color( 0, 0, 0, fade ) );
        Tree::Draw( black );
    }
    else if( game_over ) {
        sf::Shape black = sf::Shape::Rectangle( 0, 0, Tree::GetWindowWidth(), Tree::GetWindowHeight(),
            sf::Color( 0, 0, 0, fade ) );
        Tree::Draw( black );
    }

    // Draw docking on top, if we can ofc
    if( dock.IsActive() ) { dock.Draw(); }
}