Exemple #1
0
void wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2)
{
    wxGraphicsPath path = CreatePath();
    path.MoveToPoint(x1, y1);
    path.AddLineToPoint( x2, y2 );
    StrokePath( path );
}
    void GdiContext2D::Check()
    {
        //because GDI closes the path after Fill or stroke
        //we need a state to do both at the same time
        if (this->flags == 0)
        {
            //not using path
            return;
        }

        if (this->flags == 1)
        {
            COLORREF color = ColorToColorRef(strokeStyle.m_Color);
            HPEN hpen = CreatePen(PS_SOLID, (int)lineWidth, color); //TODO
            HPEN oldPen = (HPEN) SelectObject(m_hDC, hpen);
            StrokePath(m_hDC);
            SelectObject(m_hDC, oldPen);
            //
            DeleteObject(hpen);
        }
        else if (this->flags == 2)
        {
            COLORREF color = ColorToColorRef(fillStyle.m_Color);
            LOGBRUSH logbrush;
            logbrush.lbColor = color;
            logbrush.lbStyle = BS_SOLID;
            logbrush.lbHatch = 0;
            HBRUSH hBrush = CreateBrushIndirect(&logbrush);
            HBRUSH oldBrush = (HBRUSH)SelectObject(m_hDC, hBrush);
            //
            FillPath(m_hDC);
            //
            SelectObject(m_hDC, oldBrush);
            DeleteObject(hBrush);
        }
        else if (this->flags == 3)
        {
            COLORREF color2 = ColorToColorRef(strokeStyle.m_Color);
            HPEN hpen = CreatePen(PS_SOLID, (int) lineWidth, color2); //TODO
            HPEN oldPen = (HPEN) SelectObject(m_hDC, hpen);
            COLORREF color = ColorToColorRef(fillStyle.m_Color);
            LOGBRUSH logbrush;
            logbrush.lbColor = color;
            logbrush.lbStyle = BS_SOLID;
            logbrush.lbHatch = 0;
            HBRUSH hBrush = CreateBrushIndirect(&logbrush);
            HBRUSH oldBrush = (HBRUSH)SelectObject(m_hDC, hBrush);
            //
            StrokeAndFillPath(m_hDC);
            //
            SelectObject(m_hDC, oldPen);
            SelectObject(m_hDC, oldBrush);
            //
            DeleteObject(hBrush);
            DeleteObject(hpen);
        }

        this->flags = 0;
    }
Exemple #3
0
void wxGraphicsContext::StrokeLines( size_t n, const wxPoint2DDouble *points)
{
    wxASSERT(n > 1);
    wxGraphicsPath path = CreatePath();
    path.MoveToPoint(points[0].m_x, points[0].m_y);
    for ( size_t i = 1; i < n; ++i)
        path.AddLineToPoint( points[i].m_x, points[i].m_y );
    StrokePath( path );
}
Exemple #4
0
int client_StrokePath(const int pdcID) {
    HDC pdc = printerDCs[pdcID];
    if (pdc != NULL) {
        if (StrokePath(pdc)) {
            return JNI_TRUE;
        }
    }
    return JNI_FALSE;
}
Exemple #5
0
void wxGraphicsContext::StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints)
{
    wxASSERT(n > 0);
    wxGraphicsPath path = CreatePath();
    for ( size_t i = 0; i < n; ++i)
    {
        path.MoveToPoint(beginPoints[i].m_x, beginPoints[i].m_y);
        path.AddLineToPoint( endPoints[i].m_x, endPoints[i].m_y );
    }
    StrokePath( path );
}
Exemple #6
0
QPainterPath CCJKShapeElipse::GetShape() const
{
	CJK_D(const CCJKShapeElipse);
	QPainterPath path = GetPath();
	if(d->tracker == TTEdit)
		path.addRect(d->boundRect);
	path = StrokePath(path);
	if (d->brush != Qt::NoBrush)
		path.addEllipse(d->boundRect);

	return path;
}
Exemple #7
0
PHP_METHOD(WinGdiPath, stroke)
{
    wingdi_devicecontext_object *dc_obj;
    wingdi_path_object *path_obj;

    WINGDI_ERROR_HANDLING();
    if (zend_parse_parameters_none() == FAILURE)
        return;
    WINGDI_RESTORE_ERRORS();

    path_obj = zend_object_store_get_object(getThis() TSRMLS_CC);
    dc_obj = zend_object_store_get_object(path_obj->device_context TSRMLS_CC);
    RETURN_BOOL(StrokePath(dc_obj->hdc));
}
bool CCJKShapeRect::Intersect( const QRect &rect )
{
	CJK_D(const CCJKShapeRect);
	if (d->brush.style() != Qt::NoBrush)
	{
		return d->boundRect.intersects(rect);
	}
	else
	{
		QPainterPath path = StrokePath(GetPath());
		return path.intersects(rect);
	}
	return false;
}
QPainterPath CCJKShapeRect::GetShape() const
{
	CJK_D(const CCJKShapeRect);
	QPainterPath path = StrokePath(GetPath());
	if (d->brush.style() != Qt::NoBrush)
	{
		QPainterPath tmpPath;
		tmpPath.addRect(BoundingRect());
		path += tmpPath;
	}
	else if (!d->sText.isEmpty())
	{
		QFontMetrics fontMetrics(d->font);
		QRect txtRect = fontMetrics.boundingRect(d->boundRect.toRect(), d->textAlign, d->sText);
		path.addRect(txtRect);
	}
	return path;
}
Exemple #10
0
void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
{
     static TCHAR szString [] = TEXT ("Outline") ;
     HFONT        hFont ;
     SIZE         size ;

     hFont = EzCreateFont (hdc, TEXT ("Times New Roman"), 1440, 0, 0, TRUE) ;

     SelectObject (hdc, hFont) ;

     GetTextExtentPoint32 (hdc, szString, lstrlen (szString), &size) ;

     BeginPath (hdc) ;
     TextOut (hdc, (cxArea - size.cx) / 2, (cyArea - size.cy) / 2,
                    szString, lstrlen (szString)) ;
     EndPath (hdc) ;

     StrokePath (hdc) ;

     SelectObject (hdc, GetStockObject (SYSTEM_FONT)) ;
     DeleteObject (hFont) ;
}
Exemple #11
0
void __fastcall TExtPolyline::DrawTo(void *dc,void *pen,void *brush)
{
CreatePath(dc);
if (brush)
    {
    void* oldbrush=SelectObject(dc,brush);
    if (pen)
        {
        void *oldpen=SelectObject(dc,pen);
        StrokeAndFillPath(dc);
        SelectObject(dc,oldpen);
        }
    else
        FillPath(dc);
    SelectObject(dc,oldbrush);
    }
else if (pen)
    {
    void *oldpen=SelectObject(dc,pen);
    StrokePath(dc);
    SelectObject(dc,oldpen);
    }
}
Exemple #12
0
void deleteObjetLine (HGDIOBJ orig, HDC hdc, HPEN& hPen){
	SelectObject (hdc, orig);
	StrokePath (hdc);
	DeleteObject (hPen);
}
Exemple #13
0
void deleteNormalObjetFigure (HGDIOBJ orig, HDC hdc, HPEN& hPen) {
	StrokePath (hdc);
	SelectObject (hdc, orig);
	DeleteObject (hPen);
}
Exemple #14
0
void EmfPaintEngine::drawPath ( const QPainterPath & path )
{
	setClipping();

	int points = path.elementCount();
	POINT *pts = new POINT[points];
	BYTE *types = new BYTE[points];

	POINT *bzs = new POINT[3];
	int bez = 0;

	BeginPath(metaDC);

	QMatrix m = painter()->worldMatrix();
	for (int i = 0; i < points; i++){
		QPainterPath::Element el = path.elementAt(i);
		QPointF p = m.map(QPointF(el.x, el.y));
		int x = qRound(p.x());
		int y = qRound(p.y());
		pts[i].x = x;
		pts[i].y = y;

		switch(el.type){
			case QPainterPath::MoveToElement:
				types[i] = PT_MOVETO;
			#ifndef Q_WS_WIN
				MoveToEx (metaDC, x, y, 0);
			#endif
			break;

			case QPainterPath::LineToElement:
				types[i] = PT_LINETO;
			#ifndef Q_WS_WIN
				LineTo(metaDC, x, y);
			#endif
			break;

			case QPainterPath::CurveToElement:
				types[i] = PT_BEZIERTO;
			#ifndef Q_WS_WIN
				bzs[bez] = pts[i];
				bez++;
			#endif
			break;

			case QPainterPath::CurveToDataElement:
				types[i] = PT_BEZIERTO;
			#ifndef Q_WS_WIN
				bzs[bez] = pts[i];
				if (bez == 2){
					PolyBezierTo(metaDC, bzs, 3);
					bez = 0;
				} else
					bez++;
			#endif
			break;
		}
	}

	HPEN wpen = convertPen(painter()->pen());
	SelectObject(metaDC, wpen);
#ifdef Q_WS_WIN
	PolyDraw(metaDC, pts, types, points);
#else
	StrokePath(metaDC);
#endif

	HBRUSH wbrush = convertBrush(painter()->brush());
	SelectObject(metaDC, wbrush);

	EndPath(metaDC);

	if(QPoint(pts[0].x, pts[0].y) == QPoint(pts[points - 1].x, pts[points - 1].y))
		StrokeAndFillPath(metaDC);
	else {
		FillPath(metaDC);
	#ifdef Q_WS_WIN
		PolyDraw(metaDC, pts, types, points);
	#else
		StrokePath(metaDC);
	#endif
	}

	resetClipping();
	DeleteObject(wbrush);
	DeleteObject(wpen);
	delete [] pts;
	delete [] types;
}
Exemple #15
0
QPainterPath CCJKShapeLine::GetShape() const
{
	return StrokePath(GetPath());
}
Exemple #16
0
void wxGraphicsContext::DrawPath( const wxGraphicsPath& path, int fillStyle )
{
    FillPath( path , fillStyle );
    StrokePath( path );
}
Exemple #17
0
void wxGraphicsContext::DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle )
{
    FillPath( path , fillStyle );
    StrokePath( path );
}
static void dw_gt_stroke(vd_trace_interface *I)
{   get_window(); 
    if (host.tw == NULL) 
        return;
    StrokePath(I->host->hdc);
}