• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxPen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxPen的典型用法代码示例。如果您正苦于以下问题:C++ wxPen类的具体用法?C++ wxPen怎么用?C++ wxPen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxPen类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetPen

void wxGraphicsContext::SetPen( const wxPen& pen )
{
    if ( !pen.Ok() || pen.GetStyle() == wxTRANSPARENT )
        SetPen( wxNullGraphicsPen );
    else
        SetPen( CreatePen( pen ) );
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:7,代码来源:graphcmn.cpp


示例2: MakeColourGrey

wxPen &GetGreyPen(wxPen &pen)
{
	static wxPen p;
	wxColour c;
	p = pen;
	c = MakeColourGrey(pen.GetColour());
	p.SetColour(c);
	return p;
}
开发者ID:goretkin,项目名称:kwc-ros-pkg,代码行数:9,代码来源:pseudodc.cpp


示例3: setPen

/*****************************************************
**
**   PdfPainter   ---   setPen
**
******************************************************/
void PdfPainter:: setPen( const wxPen &p )
{
	//const double defaultWidth = 1;

	double width = p.GetWidth() * PDF_PEN_PENWIDTH_FACTOR;

	wxPdfLineStyle style;
	switch ( p.GetStyle() )
	{
		case wxDOT:
		{
			wxPdfArrayDouble dash1;
			dash1.Add( .5 );
			style = wxPdfLineStyle( width, wxPDF_LINECAP_NONE, wxPDF_LINEJOIN_MITER, dash1, 10.);
		}
		break;
		case wxLONG_DASH:
		{
			wxPdfArrayDouble dash2;
			dash2.Add( 3 );
			style  = wxPdfLineStyle( width, wxPDF_LINECAP_BUTT, wxPDF_LINEJOIN_MITER, dash2, 0.);
			break;
		}
		break;
		case wxSHORT_DASH:
		{
			wxPdfArrayDouble dash3;
			dash3.Add( 1.5 );
			style  = wxPdfLineStyle( width, wxPDF_LINECAP_BUTT, wxPDF_LINEJOIN_MITER, dash3, 0.);
		}
		case wxDOT_DASH:
		{
			wxPdfArrayDouble dash4;
			dash4.Add( 1.5 );
			dash4.Add( 3 );
			style  = wxPdfLineStyle( width, wxPDF_LINECAP_BUTT, wxPDF_LINEJOIN_MITER, dash4, 0.);
		}
		break;
		default:
		// Noting to do
		break;
	}

	style.SetWidth( width );
	if ( p.GetColour().IsOk() )
	{
		style.SetColour( p.GetColour() );
		pdf->SetDrawColour( p.GetColour());
	}
	pdf->SetLineStyle( style );
}
开发者ID:martin-pe,项目名称:maitreya8,代码行数:56,代码来源:PdfPainter.cpp


示例4: IsSameAs

bool wxGenericPen::IsSameAs(const wxPen &pen) const
{
    wxCHECK_MSG(Ok() && pen.Ok(), false, wxT("Invalid generic pen"));
    wxGenericPen gp(pen);
    gp.GetGenericColour().SetAlpha(M_GPENDATA->m_colour.GetAlpha());
    return IsSameAs(gp);
}
开发者ID:Jarlene,项目名称:mrpt,代码行数:7,代码来源:genergdi.cpp


示例5: SetPen

void wxQtDCImpl::SetPen(const wxPen& pen)
{
    m_pen = pen;

    m_qtPainter->setPen(pen.GetHandle());

    ApplyRasterColourOp();
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:8,代码来源:dc.cpp


示例6: setPen

/*****************************************************
**
**   DcPainter   ---   setPen
**
******************************************************/
void DcPainter::setPen( const wxPen &p )
{
	//printf( "DcPainter::setPen OK %d color OK %d\n", p.IsOk(), p.GetColour().IsOk());
	if ( ! p.IsOk() )
	{
		wxLogError( wxT( "pen not okay, using default pen" ));
		setDefaultPen();
	}
	else dc->SetPen( p );
}
开发者ID:martin-pe,项目名称:maitreya8,代码行数:15,代码来源:Painter.cpp


示例7: Set

void wxGenericPen::Set( const wxPen &pen )
{
    wxCHECK_RET(Ok() && pen.Ok(), wxT("Invalid generic pen"));
    SetColour(pen.GetColour());
    M_GPENDATA->m_width = pen.GetWidth();
    M_GPENDATA->m_style = pen.GetStyle();
    M_GPENDATA->m_cap   = pen.GetCap();
    M_GPENDATA->m_join  = pen.GetJoin();

    wxDash* dash;
    int n_dashes = pen.GetDashes(&dash);
    SetDashes(n_dashes, dash);

    // or SetDashes(pen.GetDashCount(), pen.GetDash()); not in msw 2.4
}
开发者ID:Jarlene,项目名称:mrpt,代码行数:15,代码来源:genergdi.cpp


示例8: DrawThickLine

// Draws a line between (x1,y1) - (x2,y2) with a start thickness of t1
void DrawThickLine( double x1, double y1, double x2, double y2, wxPen pen, bool b_hiqual )
{
    double angle = atan2( y2 - y1, x2 - x1 );
    double t1 = pen.GetWidth();
    double t2sina1 = t1 / 2 * sin( angle );
    double t2cosa1 = t1 / 2 * cos( angle );

    glPushAttrib( GL_COLOR_BUFFER_BIT | GL_HINT_BIT | GL_POLYGON_BIT );      //Save state
    ocpnDC::SetGLAttrs( b_hiqual );

    //    n.b.  The dwxDash interpretation for GL only allows for 2 elements in the dash table.
    //    The first is assumed drawn, second is assumed space
    wxDash *dashes;
    int n_dashes = pen.GetDashes( &dashes );
    if( n_dashes ) {
        double lpix = sqrt( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) );
        double lrun = 0.;
        double xa = x1;
        double ya = y1;
        double ldraw = t1 * dashes[0];
        double lspace = t1 * dashes[1];

        while( lrun < lpix ) {
            //    Dash
            double xb = xa + ldraw * cos( angle );
            double yb = ya + ldraw * sin( angle );

            if( ( lrun + ldraw ) >= lpix )         // last segment is partial draw
                    {
                xb = x2;
                yb = y2;
            }

            glBegin( GL_TRIANGLES );
            glVertex2f( xa + t2sina1, ya - t2cosa1 );
            glVertex2f( xb + t2sina1, yb - t2cosa1 );
            glVertex2f( xb - t2sina1, yb + t2cosa1 );

            glVertex2f( xb - t2sina1, yb + t2cosa1 );
            glVertex2f( xa - t2sina1, ya + t2cosa1 );
            glVertex2f( xa + t2sina1, ya - t2cosa1 );
            glEnd();

            xa = xb;
            ya = yb;
            lrun += ldraw;

            //    Space
            xb = xa + lspace * cos( angle );
            yb = ya + lspace * sin( angle );

            xa = xb;
            ya = yb;
            lrun += lspace;
        }
    } else {
        glBegin( GL_TRIANGLES );
        glVertex2f( x1 + t2sina1, y1 - t2cosa1 );
        glVertex2f( x2 + t2sina1, y2 - t2cosa1 );
        glVertex2f( x2 - t2sina1, y2 + t2cosa1 );
        glVertex2f( x2 - t2sina1, y2 + t2cosa1 );
        glVertex2f( x1 - t2sina1, y1 + t2cosa1 );
        glVertex2f( x1 + t2sina1, y1 - t2cosa1 );
        glEnd();
    }
    glPopAttrib();
}
开发者ID:JesperWe,项目名称:OpenCPN,代码行数:68,代码来源:ocpndc.cpp


示例9: SetPenColour

void ThemeBase::SetPenColour(   wxPen & Pen, int iIndex )
{
   wxASSERT( iIndex >= 0 );
   Pen.SetColour( Colour( iIndex ));
}
开发者ID:andreipaga,项目名称:audacity,代码行数:5,代码来源:Theme.cpp


示例10: Draw

bool SjOscStar::Draw(wxDC& dc, const wxSize& clientSize, double rot, wxPen& pen, wxBrush& brush)
{
	double  xfloat, yfloat;
	int     x, y, hh, vv;
	int     d, intensity;

	m_z -= 2;
	if( m_z < -63 )
	{
		m_z = STAR_DEPTH;
		m_doDraw = !m_exitRequest;
	}

	hh = (m_x*64)/(64+m_z);
	vv = (m_y*64)/(64+m_z);

	// check position
	x = hh + 500;
	y = vv + 500;
	if( x < -300 || x > 1300 || y < -300 || y > 1300 )
	{
		m_z = STAR_DEPTH;
		m_doDraw = !m_exitRequest;

		hh = (m_x*64)/(64+m_z);
		vv = (m_y*64)/(64+m_z);
	}

	// calculate position
	xfloat = (hh*cos(rot))-(vv*sin(rot));
	yfloat = (hh*sin(rot))+(vv*cos(rot));

	x = (int)xfloat + 500;
	y = (int)yfloat + 500;

	// use star?
	if( !m_doDraw )
	{
		if( m_exitRequest || x < 450 || x > 550 || y < 450 || y > 550 )
		{
			return FALSE;
		}
		else
		{
			m_doDraw = TRUE;
		}
	}

	// map star position to client size, keep aspect ratio
	d = clientSize.x;
	if( clientSize.y > d )
	{
		d = clientSize.y;
	}

	if( d == 0 )
	{
		d = 10;
	}

	x = (x * d) / 1000 - (d-clientSize.x)/2;
	y = (y * d) / 1000 - (d-clientSize.y)/2;

	// calculate size
	d = (STAR_DEPTH-m_z) / (38400/d);
	if( d == 0 ) d = 1;

	// calculate light intensity
	intensity = STAR_DEPTH-m_z;
	intensity = 55 + ((intensity * 200) / STAR_DEPTH);
	//if( intensity < light ) intensity = light + 10;
	if( intensity < 0   )   intensity = 0;
	if( intensity > 255 )   intensity = 255;

	// draw star
	if( d==1 )
	{
		pen.SetColour(intensity, intensity, intensity);
		dc.SetPen(pen);
		dc.DrawPoint(x, y);
	}
	else
	{
		dc.SetPen(*wxTRANSPARENT_PEN);

		brush.SetColour(intensity, intensity, intensity);
		dc.SetBrush(brush);

		dc.DrawRectangle(x, y, d, d);
	}

	return TRUE;
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:93,代码来源:vis_oscilloscope.cpp


示例11: DrawGLThickLine

// Draws a line between (x1,y1) - (x2,y2) with a start thickness of t1
void DrawGLThickLine( float x1, float y1, float x2, float y2, wxPen pen, bool b_hiqual )
{
#ifdef ocpnUSE_GL
    
    float angle = atan2f( y2 - y1, x2 - x1 );
    float t1 = pen.GetWidth();
    float t2sina1 = t1 / 2 * sinf( angle );
    float t2cosa1 = t1 / 2 * cosf( angle );

    glBegin( GL_TRIANGLES );

    //    n.b.  The dwxDash interpretation for GL only allows for 2 elements in the dash table.
    //    The first is assumed drawn, second is assumed space
    wxDash *dashes;
    int n_dashes = pen.GetDashes( &dashes );
    if( n_dashes ) {
        float lpix = sqrtf( powf( (float) (x1 - x2), 2) + powf( (float) (y1 - y2), 2) );
        float lrun = 0.;
        float xa = x1;
        float ya = y1;
        float ldraw = t1 * dashes[0];
        float lspace = t1 * dashes[1];

        while( lrun < lpix ) {
            //    Dash
            float xb = xa + ldraw * cosf( angle );
            float yb = ya + ldraw * sinf( angle );

            if( ( lrun + ldraw ) >= lpix )         // last segment is partial draw
            {
                xb = x2;
                yb = y2;
            }

            glVertex2f( xa + t2sina1, ya - t2cosa1 );
            glVertex2f( xb + t2sina1, yb - t2cosa1 );
            glVertex2f( xb - t2sina1, yb + t2cosa1 );

            glVertex2f( xb - t2sina1, yb + t2cosa1 );
            glVertex2f( xa - t2sina1, ya + t2cosa1 );
            glVertex2f( xa + t2sina1, ya - t2cosa1 );

            xa = xb;
            ya = yb;
            lrun += ldraw;

            //    Space
            xb = xa + lspace * cos( angle );
            yb = ya + lspace * sin( angle );

            xa = xb;
            ya = yb;
            lrun += lspace;
        }
    } else {
        glVertex2f( x1 + t2sina1, y1 - t2cosa1 );
        glVertex2f( x2 + t2sina1, y2 - t2cosa1 );
        glVertex2f( x2 - t2sina1, y2 + t2cosa1 );

        glVertex2f( x2 - t2sina1, y2 + t2cosa1 );
        glVertex2f( x1 - t2sina1, y1 + t2cosa1 );
        glVertex2f( x1 + t2sina1, y1 - t2cosa1 );

        /* wx draws a nice rounded end in dc mode, so replicate
           this for opengl mode, should this be done for the dashed mode case? */
        if(pen.GetCap() == wxCAP_ROUND) {
            DrawEndCap( x1, y1, t1, angle);
            DrawEndCap( x2, y2, t1, angle + M_PI);
        }

    }

    glEnd();
#endif    
}
开发者ID:libai245,项目名称:wht1,代码行数:76,代码来源:ocpndc.cpp


示例12: DrawGLThickLines

// Draws thick lines from triangles
void DrawGLThickLines( int n, wxPoint points[],wxCoord xoffset,
                       wxCoord yoffset, wxPen pen, bool b_hiqual )
{
#ifdef ocpnUSE_GL
    if(n < 2)
        return;

    /* for dashed case, for now just draw thick lines */
    wxDash *dashes;
    if( pen.GetDashes( &dashes ) )
    {
        wxPoint p0 = points[0];
        for( int i = 1; i < n; i++ ) {
            DrawGLThickLine( p0.x + xoffset, p0.y + yoffset, points[i].x + xoffset,
                             points[i].y + yoffset, pen, b_hiqual );
            p0 = points[i];
        }
        return;
    }

    /* cull zero segments */
    wxPoint *cpoints = new wxPoint[n];
    cpoints[0] = points[0];
    int c = 1;
    for( int i = 1; i < n; i++ ) {
        if(points[i].x != points[i-1].x || points[i].y != points[i-1].y)
            cpoints[c++] = points[i];
    }

    /* nicer than than rendering each segment separately, this is because thick
       line segments drawn as rectangles which have different angles have
       rectangles which overlap and also leave a gap.
       This code properly calculates vertexes for adjoining segments */
    float t1 = pen.GetWidth();

    float x0 = cpoints[0].x, y0 = cpoints[0].y, x1 = cpoints[1].x, y1 = cpoints[1].y;
    float a0 = atan2f( y1 - y0, x1 - x0 );

    // It is also possible to use triangle strip, (and triangle fan for endcap)
    // to reduce vertex count.. is it worth it?
    glBegin( GL_TRIANGLES );

    float t2sina0 = t1 / 2 * sinf( a0 );
    float t2cosa0 = t1 / 2 * cosf( a0 );

    for( int i = 1; i < c; i++ ) {
        float x2, y2;
        float a1;

        if(i < c - 1) {
            x2 = cpoints[i + 1].x, y2 = cpoints[i + 1].y;
            a1 = atan2f( y2 - y1, x2 - x1 );
        } else {
            x2 = x1, y2 = y1;
            a1 = a0;
        }

        float aa = (a0 + a1) / 2;
        float diff = fabsf(a0 - a1);
        if(diff > M_PI)
            diff -= 2 * (float)M_PI;
        float rad = t1 / 2 / wxMax(cosf(diff / 2), .4);

        float t2sina1 = rad * sinf( aa );
        float t2cosa1 = rad * cosf( aa );

        glVertex2f( x1 + t2sina1, y1 - t2cosa1 );
        glVertex2f( x1 - t2sina1, y1 + t2cosa1 );
        glVertex2f( x0 + t2sina0, y0 - t2cosa0 );

        glVertex2f( x0 - t2sina0, y0 + t2cosa0 );
        glVertex2f( x0 + t2sina0, y0 - t2cosa0 );

        float dot = t2sina0 * t2sina1 + t2cosa0 * t2cosa1;
        if(dot > 0)
            glVertex2f( x1 - t2sina1, y1 + t2cosa1 );
        else
            glVertex2f( x1 + t2sina1, y1 - t2cosa1 );

        x0 = x1, x1 = x2;
        y0 = y1, y1 = y2;
        a0 = a1;
        t2sina0 = t2sina1, t2cosa0 = t2cosa1;
    }
 
    if(pen.GetCap() == wxCAP_ROUND) {
        DrawEndCap( x0, y0, t1, a0);
        DrawEndCap( x0, y0, t1, a0 + M_PI);
     }

    glEnd();

    glPopAttrib();

    delete [] cpoints;

 #endif    
 }
开发者ID:libai245,项目名称:wht1,代码行数:99,代码来源:ocpndc.cpp


示例13: ToString

wxString xsPenPropIO::ToString(wxPen value)
{
    return wxString::Format(wxT("%s %d %d"), xsColourPropIO::ToString(value.GetColour()).c_str(), value.GetWidth(), value.GetStyle());
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:4,代码来源:PropertyIO.cpp


示例14: SetPen

void wxDC::SetPen(const wxPen& pen)
{
    m_pen = pen.Ok() ? pen : DEFAULT_PEN;

    SelectColour(m_pen.GetColour());
}
开发者ID:hgwells,项目名称:tive,代码行数:6,代码来源:dc.cpp


示例15: Show

void SjOscRocket::Show(wxDC& dc, long light)
{
	if(m_sleep)
	{
		return;
	}

	if( m_t<m_length )
	{
		int i, j, x, y, maxL;
		double s;

		#define VIEW 20
		maxL = VIEW;
		if( maxL > m_length-m_t )
		{
			maxL = m_length-m_t;
			long intensity = (255/VIEW)*(m_length-m_t);
			if( light > intensity ) intensity = light;
			m_pen.SetColour(intensity, intensity, intensity);
		}

		dc.SetPen(m_pen);

		wxPoint points[VIEW];
		for(i=0; i<m_patch; i++)
		{
			for( j = 0; j < maxL; j++ )
			{
				s=(double)(m_t+j)/100;
				x=(int)(m_vx[i]*s);
				y=(int)(m_vy[i]*s-ROCKET_GRAVITY*s*s);

				points[j].x = m_ox+x;
				points[j].y = m_oy-y;
			}

			dc.DrawLines(maxL, points);
		}

		m_t++;
	}
	else
	{
		m_sleep = TRUE;
	}
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:47,代码来源:vis_oscilloscope.cpp


示例16: Init

void SjOscRocket::Init(int energy, int patch, int length, long seed, int mx, int my)
{
	int i;

	m_mx        = mx;
	m_my        = my;

	m_energy    = energy;
	m_patch     = patch;
	m_length    = length;
	m_random    = seed;

	m_pen.SetColour(255, 255, 255);

	m_ox=(int)SjTools::Rand(m_mx/2)+m_mx/4;
	m_oy=(int)SjTools::Rand(m_my/2)+m_my/4;

	for(i=0; i<m_patch; i++)
	{
		m_vx[i]=(int)SjTools::Rand(m_energy)-m_energy/2;
		m_vy[i]=(int)SjTools::Rand(m_energy*7/8)-m_energy/8;
	}
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:23,代码来源:vis_oscilloscope.cpp



注:本文中的wxPen类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxPrintData类代码示例发布时间:2022-05-31
下一篇:
C++ wxPaintEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap