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

C++ gdiplus::GraphicsPath类代码示例

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

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



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

示例1: getTxtSize

static Gdiplus::Size getTxtSize(std::wstring txt) {
   Gdiplus::GraphicsPath path;
   Gdiplus::FontFamily ff;
   Gdiplus::Font* font = g_lv.f;
   font->GetFamily(&ff);

   Gdiplus::Rect rc;
   Gdiplus::Size sz;
   int len = txt.length();
   if (len == 0) {
      return sz;
   }

   bool is_space = false;
   if (txt[len - 1] == L' ') {
      txt[len - 1] = L'M';
      is_space = true;
   }

   path.AddString(txt.c_str(), 
      len, &ff, 
      font->GetStyle(), 
      font->GetSize(), 
      Gdiplus::Point(1, 0), 
      NULL);
   path.GetBounds(&rc);

   int sd = (int)(font->GetSize() / 4);
   sz.Width = rc.Width + sd;
   if (is_space) {
      sz.Width -= sd;
   }
   sz.Height = rc.Height;
   return sz;
}
开发者ID:wangch,项目名称:zipk,代码行数:35,代码来源:zipk.cpp


示例2: DrawTextOutline

BOOL GdiplusUtilities::DrawTextOutline(Gdiplus::Graphics& graphics, 
					 LPCTSTR lpchText, int cchText, const Gdiplus::Rect& rc, const Gdiplus::StringFormat& format, 
					 const Gdiplus::Font& font, Gdiplus::Color fill, Gdiplus::Color outline, INT outlineWidth,
					 BOOL bCalcOnly/* = FALSE*/, Gdiplus::Rect* rcCalc/* = NULL*/)
{
	Gdiplus::FontFamily fontFamily;
	font.GetFamily(&fontFamily);
	Gdiplus::GraphicsPath path;
	path.AddString(lpchText, cchText, &fontFamily, font.GetStyle(), font.GetHeight(&graphics), rc, &format);

	if (rcCalc != NULL)
	{
		path.GetBounds(rcCalc);
		rcCalc->Inflate(outlineWidth, outlineWidth);
	}
	if (bCalcOnly)
		return TRUE;

	Gdiplus::Pen pen(outline, (Gdiplus::REAL) outlineWidth);
	if (graphics.DrawPath(&pen, &path) == Gdiplus::Ok)
	{
		Gdiplus::SolidBrush brush(fill);
		return graphics.FillPath(&brush, &path) == Gdiplus::Ok;
	}
	return FALSE;
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:26,代码来源:GdiplusUtilities.cpp


示例3: Draw

void SectionRenderer::Draw(Gdiplus::Graphics* g, MapViewport* viewport, const Component* component)
{
	const Section* section = static_cast<const Section*>(component);
	Vector2d last;
	bool haslast = false;
	
	const Properties& props = component->GetProperties();
	Gdiplus::Pen pen(Gdiplus::Color(props.Get<prop::Color>(Gdiplus::Color::Black)),
									props.Get<prop::LineWidth>(2));
	pen.SetDashStyle((Gdiplus::DashStyle)props.Get<prop::DashStyle>(Gdiplus::DashStyle::DashStyleSolid));
	pen.SetLineJoin(Gdiplus::LineJoin::LineJoinRound);
	bool dispEnd = props.Get<prop::DisplaySectionEnd>(false);

	Gdiplus::GraphicsPath path;

	const Section::LocationList& locations = section->GetLocations();
	for(const Location& location : locations)
	{
		Vector2d point = viewport->LocationToPixel(location);
		if(haslast)
			path.AddLine((float)last.GetX(), (float)last.GetY(), (float)point.GetX(), (float)point.GetY());
		last = point;
		haslast = true;
	}
	g->DrawPath(&pen, &path);

	if(dispEnd)
	{
		Vector2d point = viewport->LocationToPixel(locations.front());
		g->FillEllipse(pen.GetBrush(), point.GetX() - 3.f, point.GetY() - 3.f, 6.f, 6.f);
		point.Set(viewport->LocationToPixel(locations.back()));
		g->FillEllipse(pen.GetBrush(), point.GetX() - 3.f, point.GetY() - 3.f, 6.f, 6.f);
	}
}
开发者ID:Eisenheim9,项目名称:MultiTracks,代码行数:34,代码来源:EntityRenderer.cpp


示例4: drawGraphicsPath

//-----------------------------------------------------------------------------
void GdiplusDrawContext::drawGraphicsPath (CGraphicsPath* _path, PathDrawMode mode, CGraphicsTransform* t)
{
	GdiplusGraphicsPath* gdiPlusPath = dynamic_cast<GdiplusGraphicsPath*> (_path);
	if (gdiPlusPath && pGraphics)
	{
		GdiplusDrawScope drawScope (pGraphics, currentState.clipRect, getCurrentTransform ());

		Gdiplus::GraphicsPath* path = gdiPlusPath->getGraphicsPath ();

		if (t)
		{
			Gdiplus::Matrix matrix;
			convert (matrix, *t);
			path = path->Clone ();
			path->Transform (&matrix);
		}

		if (mode == kPathStroked)
		{
			pGraphics->DrawPath (getPen (), path);
		}
		else
		{
			path->SetFillMode (mode == kPathFilledEvenOdd ? Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding);
			pGraphics->FillPath (getBrush (), path);
		}
		if (path != gdiPlusPath->getGraphicsPath ())
			delete path;
	}
}
开发者ID:Piticfericit,项目名称:vstgui,代码行数:31,代码来源:gdiplusdrawcontext.cpp


示例5: DrawGradientFill

void CDisplayWindow::DrawGradientFill(HDC hdc,RECT *rc)
{
	if(m_hBitmapBackground)
	{
		DeleteObject(m_hBitmapBackground);
	}

	/* Create the (temporary) off-screen buffer used for drawing. */
	m_hBitmapBackground	= CreateCompatibleBitmap(hdc,rc->right - rc->left,rc->bottom - rc->top);
	SelectObject(m_hdcBackground,m_hBitmapBackground);

	Gdiplus::Graphics graphics(m_hdcBackground);

	Gdiplus::Rect DisplayRect(0,0,rc->right - rc->left,rc->bottom - rc->top);

	Gdiplus::GraphicsPath Path;
	Path.AddRectangle(DisplayRect);
	Gdiplus::PathGradientBrush pgb(&Path);
	pgb.SetCenterPoint(Gdiplus::Point(0,0));

	pgb.SetCenterColor(m_CentreColor);

	INT count = 1;
	pgb.SetSurroundColors(&m_SurroundColor,&count);
	graphics.FillRectangle(&pgb,DisplayRect);

	/* This draws a separator line across the top edge of the window,
	so that it is visually separated from other windows. */
	Gdiplus::Pen NewPen(BORDER_COLOUR,1);
	graphics.DrawLine(&NewPen,0,0,rc->right,0);
}
开发者ID:3scp8,项目名称:explorerplusplus,代码行数:31,代码来源:MsgHandler.cpp


示例6: DrawImage

void CSkinUnitODL::DrawImage(Gdiplus::Graphics& gcDrawer, Gdiplus::RectF rtDrawArea, Gdiplus::REAL fScale)
{
	if (m_imgSkin)
	{
		Gdiplus::GraphicsPath gcPath;
		gcPath.AddRectangle(rtDrawArea);
		DrawImage(gcDrawer, gcPath, Gdiplus::PointF(rtDrawArea.X,rtDrawArea.Y), fScale);
	}
}
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:9,代码来源:SkinUnitODL.cpp


示例7: AddPolygon

void GraphicsPath::AddPolygon(const PointF* points, unsigned int pointCount) {
    Gdiplus::GraphicsPath* gp = reinterpret_cast<Gdiplus::GraphicsPath*>(_private);
    Gdiplus::PointF* gdiPoints = new Gdiplus::PointF[pointCount];
    for(unsigned int a=0; a<pointCount; a++) {
        gdiPoints[a] = Gdiplus::PointF(points[a]._x, points[a]._y);
    }
    gp->AddPolygon(gdiPoints, pointCount);
    delete[] gdiPoints;
}
开发者ID:pixelspark,项目名称:corespark,代码行数:9,代码来源:tjgraphics-gdiplus.cpp


示例8: CreateOptions

/* Creating of the options from the script. */
bool DIALOGUE::CreateOptions(){

	// atributes
	std::wstring text;
	Gdiplus::GraphicsPath path;
	// caused changes which will be paired with the options
	std::string state_name;
	std::vector<state_changes> changes; 

	if(!script.FindElem(L"OPTIONS")){
		TermLog("Options tag not found in the Dialogue scene, script.xml file is probably damaged.");
		return false;
	}
	script.IntoElem();

	// Going through the options
	if(!script.FindElem(L"OPTION")){
		script.OutOfElem();
		TermLog("No option to choose found in the dialogue scene.");
		return false;
	}
	else do {
		text = script.GetAttrib(L"text");
		
		line_top -= line_height; // Put the line above the previous
		stat = path.AddString(text.c_str(), -1, fontFamily, Gdiplus::FontStyleBold, text_size, Gdiplus::PointF(0, Gdiplus::REAL(line_top)), &strformat);
			if (stat != 0) StatusLog("GraphicPath.AddString()", stat, false);

		script.IntoElem();

		if(!CheckTests()){
			script.OutOfElem();
			continue;
		}


		// creates the map of state changes
		while(script.FindElem(L"STATECHANGE")){
			state_changes current_changes;
			current_changes.name = wstring2string(script.GetData());
			current_changes.value = atoi((wstring2string(script.GetAttrib(L"value"))).c_str());
			current_changes.replace = atoi((wstring2string(script.GetAttrib(L"replace"))).c_str())  != 0 ? true : false;
			changes.push_back(current_changes);
		}
		
		script.OutOfElem(); // Jumps out of the object

		options.push_back(OPTION(text, &path, changes));
		changes.clear();
		StatusLog("GraphicPath.Reset()", path.Reset(), false);

	} while(script.FindElem(L"OPTION"));

	script.OutOfElem();
	return true;
}
开发者ID:xstreck1,项目名称:StoryWriter,代码行数:57,代码来源:dialogue.cpp


示例9: sb

void AirSpeed_Indicator::PT::DrawPointer(const PREADING pRading, Gdiplus::Graphics *pg)
{
	Gdiplus::GraphicsPath path;
	path.AddPath(&m_PT, FALSE);
	Gdiplus::Matrix m;
	float a = GetAngle(pRading);
	m.RotateAt(a, Gdiplus::PointF(m_ptRotatePoint.X, m_ptRotatePoint.Y));
	path.Transform(&m);
	Gdiplus::SolidBrush sb(Gdiplus::Color::White);
	pg->FillPath(&sb, &path);
}
开发者ID:zephyrer,项目名称:hxc-avionics-system,代码行数:11,代码来源:Meters.cpp


示例10: DrawConnection

void CXTPFlowGraphPaintManager::DrawConnection(CXTPFlowGraphDrawContext* pDC, CXTPFlowGraphConnection* pConnection)
{
	CRect rcConnectionBounds = pConnection->GetBoundingRect();
	CRect rcBounds = pDC->GetClipRect();
	CXTPFlowGraphControl* pControl = pConnection->GetControl();

	if (rcBounds.right < rcConnectionBounds.left || rcBounds.left > rcConnectionBounds.right ||
		rcBounds.top > rcConnectionBounds.bottom || rcBounds.bottom < rcConnectionBounds.top)
		return;

	if (pControl->GetZoomLevel() < m_dMinZoomLevelConnections)
		return;


	COLORREF clrConnection = pConnection->GetColor() != (COLORREF)-1 ? pConnection->GetColor() : m_clrConnection;
	if (pConnection->IsSelected())
		clrConnection = m_clrSelection;

	pDC->SetPen(clrConnection, 2);
	pDC->DrawCurve(pConnection->m_pPath);

	if (pConnection->IsSelected() && pConnection->GetControlPoint() != CPoint(-1, -1))
	{
		pDC->SetPen(0, 0);
		pDC->SetBrush(clrConnection);

		CPoint pt(pConnection->GetControlPoint());
		pDC->Ellipse(CRect(pt.x - 3, pt.y - 3, pt.x + 3, pt.y + 3));
	}

	if (m_bDrawArrow)
	{
		Gdiplus::GraphicsPath* path = pConnection->m_pPath->Clone();
		path->Flatten();

		const REAL rArrow = 10.0;
		PointF ptEnd = XTPGetPosition(path, REAL(-m_nEllipseSize / 2));
		PointF ptFrom = XTPGetPosition(path, REAL(- (m_nEllipseSize / 2 + rArrow)));

		Point ptArrow[3];

		PointF ptDiff = ptFrom - ptEnd;

		ptArrow[0] = Point((int)ptEnd.X, (int)ptEnd.Y);
		ptArrow[1] = Point(int(ptFrom.X - ptDiff.Y * (4.0) / rArrow), int(ptFrom.Y + ptDiff.X * (4.0) / rArrow));
		ptArrow[2] = Point(int(ptFrom.X + ptDiff.Y * (4.0) / rArrow), int(ptFrom.Y - ptDiff.X * (4.0) / rArrow));

		pDC->SetBrush(clrConnection);
		pDC->FillPolygon((POINT*)ptArrow, 3);

		delete path;
	}
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:53,代码来源:XTPFlowGraphPaintManager.cpp


示例11: GetFrame

PVideoFrame __stdcall AutoTraceFilter::GetFrame(int n, IScriptEnvironment* env) {
	// Grab the child frame
	PVideoFrame childFrame = child->GetFrame(n, env);
	// Create the bitmap - AutoTrace always wants a 24-bpp bitmap for some dumb reason
	at_bitmap_type *bitmap;
	bitmap = at_bitmap_new(srcWidth, srcHeight, 3);
	size_t bitmap_size = srcWidth * srcHeight * 3;
	// Pull the bitmap data
	// We can just blt lines
	const BYTE* srcBitmap = childFrame->GetReadPtr();
	int pitch = childFrame->GetPitch();
	int rowSize = childFrame->GetRowSize();
	for (int y = 0; y < srcHeight; y++) {
		// Note that R and B are swapped in this. It doesn't really matter.
		memcpy_s(bitmap->bitmap + ((srcHeight - y - 1) * rowSize), bitmap_size, srcBitmap + (y * pitch), rowSize);
	}
	// This does the actual tracing:
	at_splines_type* splines = at_splines_new(bitmap, fitting_opts, exception_handler, NULL);
	// Now create the new frame. First, blank out the old frame
	graphics->Clear(*backgroundColor);
	at_real tx = ((at_real)destWidth) / ((at_real)srcWidth);
	at_real ty = ((at_real)destHeight) / ((at_real)srcHeight);
	for (unsigned int i = 0; i < splines->length; i++) {
		at_spline_list_type spline_list = splines->data[i];
		Gdiplus::GraphicsPath path;
		for (unsigned int j = 0; j < spline_list.length; j++) {
			at_spline_type* spline = &(spline_list.data[j]);
			if (spline->degree == AT_LINEARTYPE) {
				path.AddLine((Gdiplus::REAL)(spline->v[0].x * tx), (Gdiplus::REAL)(spline->v[0].y * ty),
					(Gdiplus::REAL)(spline->v[3].x * tx), (Gdiplus::REAL)(spline->v[3].y * ty));
			} else {
				path.AddBezier(
					(Gdiplus::REAL)(spline->v[0].x * tx), (Gdiplus::REAL)(spline->v[0].y * ty),
					(Gdiplus::REAL)(spline->v[1].x * tx), (Gdiplus::REAL)(spline->v[1].y * ty),
					(Gdiplus::REAL)(spline->v[2].x * tx), (Gdiplus::REAL)(spline->v[2].y * ty),
					(Gdiplus::REAL)(spline->v[3].x * tx), (Gdiplus::REAL)(spline->v[3].y * ty));
			}
		}
		path.CloseFigure();
		// Red and blue are swapped here, so swap them back.
		Gdiplus::Color color(spline_list.color.b, spline_list.color.g, spline_list.color.r);
		Gdiplus::SolidBrush brush(color);
		graphics->FillPath(&brush, &path);
	}
	at_splines_free(splines);
	at_bitmap_free(bitmap);
	// Now we need to create our result frame
	PVideoFrame outputFrame = env->NewVideoFrame(vi);
	BYTE* outputData = outputFrame->GetWritePtr();
	env->BitBlt(outputData, outputFrame->GetPitch(), renderedFrameData, renderedFramePitch, destWidth*4, destHeight);
	return outputFrame;
}
开发者ID:Xenoveritas,项目名称:AviSynth-Stuff,代码行数:52,代码来源:AutoTraceFilter.cpp


示例12: fillLinearGradient

//-----------------------------------------------------------------------------
void GdiplusDrawContext::fillLinearGradient (CGraphicsPath* _path, const CGradient& gradient, const CPoint& startPoint, const CPoint& endPoint, bool evenOdd, CGraphicsTransform* t)
{
#if DEBUG
	DebugPrint ("WARNING: GdiplusDrawContext::fillLinearGradient is not working as expected ! FIXME");
#endif
	GdiplusGraphicsPath* gdiPlusPath = dynamic_cast<GdiplusGraphicsPath*> (_path);
	if (gdiPlusPath && pGraphics)
	{
		GdiplusDrawScope drawScope (pGraphics, currentState.clipRect, getCurrentTransform ());

		Gdiplus::GraphicsPath* path = gdiPlusPath->getGraphicsPath ();

		if (t)
		{
			Gdiplus::Matrix matrix;
			convert (matrix, *t);
			path = path->Clone ();
			path->Transform (&matrix);
		}

		Gdiplus::Color* colors = new Gdiplus::Color [gradient.getColorStops ().size ()];
		Gdiplus::REAL* positions = new Gdiplus::REAL [gradient.getColorStops ().size ()];
		uint32_t index = 0;
		for (CGradient::ColorStopMap::const_iterator it = gradient.getColorStops ().begin (); it != gradient.getColorStops ().end (); ++it, ++index)
		{
			CColor color = it->second;
			color.alpha = (int8_t)((float)color.alpha * currentState.globalAlpha);
			colors[index] = createGdiPlusColor (color);
			positions[index] = (Gdiplus::REAL)it->first;
		}

		Gdiplus::PointF c1p ((Gdiplus::REAL)(startPoint.x), (Gdiplus::REAL)(startPoint.y));
		Gdiplus::PointF c2p ((Gdiplus::REAL)(endPoint.x), (Gdiplus::REAL)(endPoint.y));
		Gdiplus::LinearGradientBrush brush (c1p, c2p, colors[0], colors[gradient.getColorStops ().size () - 1]);
		brush.SetInterpolationColors (colors, positions, static_cast<INT> (gradient.getColorStops ().size ()));
		path->SetFillMode (evenOdd ? Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding);

		pGraphics->FillPath (&brush, path);
		if (path != gdiPlusPath->getGraphicsPath ())
			delete path;
		delete [] colors;
		delete [] positions;
	}
}
开发者ID:Piticfericit,项目名称:vstgui,代码行数:45,代码来源:gdiplusdrawcontext.cpp


示例13: drawArc

//-----------------------------------------------------------------------------
void GdiplusDrawContext::drawArc (const CRect& rect, const float _startAngle, const float _endAngle, const CDrawStyle drawStyle)
{
	if (pGraphics)
	{
		GdiplusDrawScope drawScope (pGraphics, currentState.clipRect, getCurrentTransform ());

		float endAngle = _endAngle;
		if (endAngle < _startAngle)
			endAngle += 360.f;
		endAngle = fabs (endAngle - _startAngle);
		Gdiplus::RectF r ((Gdiplus::REAL)rect.left, (Gdiplus::REAL)rect.top, (Gdiplus::REAL)rect.getWidth (), (Gdiplus::REAL)rect.getHeight ());
		Gdiplus::GraphicsPath path;
		path.AddArc (r, _startAngle, endAngle);
		if (drawStyle == kDrawFilled || drawStyle == kDrawFilledAndStroked)
			pGraphics->FillPath (pBrush, &path);
		if (drawStyle == kDrawStroked || drawStyle == kDrawFilledAndStroked)
			pGraphics->DrawPath (pPen, &path);
	}
}
开发者ID:Piticfericit,项目名称:vstgui,代码行数:20,代码来源:gdiplusdrawcontext.cpp


示例14: FPressed

/*Fix current cursor point.*/
HRESULT INTERACTIVE::FPressed() {
	if(temp_points_count <= 2) {
		DisplayText(L"No polygon exists");
		return S_FALSE;	
	}
	Gdiplus::GraphicsPath boundaries;
	boundaries.AddPolygon(temp_points, temp_points_count);
	std::wstring name(L"Object ");
	name.append(boost::lexical_cast<std::wstring, std::size_t>(objects.size()));
	std::vector<state_changes> changes;
	state_changes change = {"No_change", 0, 0};
	changes.push_back(change);
	objects.push_back(SCENE_OBJECT(&boundaries, name, L"!caption!", "!sound_path!", "!caption_sound_path!", changes, false));
	temp_points_count = 0;
	name.append(L" saved.");
	BMP_mix->Clear(key_color);
	DrawOutlines();
	DisplayText(name);
	return S_OK;
}
开发者ID:xstreck1,项目名称:StoryWriter,代码行数:21,代码来源:interactive.cpp


示例15: DrawTextVector

	void TextElement::DrawTextVector(RenderContext& ctx)
	{
		Gdiplus::RectF textrect;
		if (!RectFFromStyle(GetStyle(), textrect) || !m_font || m_text.empty())
			return;

		ctx.pGraphics->SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);

		Gdiplus::FontFamily family(L"Tahoma");
		Gdiplus::StringFormat format;
		format.SetFormatFlags(Gdiplus::StringFormatFlagsLineLimit);
		format.SetTrimming(Gdiplus::StringTrimmingEllipsisCharacter);

		Gdiplus::GraphicsPath path;
		path.AddString(m_text.c_str(), -1, &family, Gdiplus::FontStyleBold, 12, textrect, &format);

		Gdiplus::Pen pen(Gdiplus::Color(192, 0, 0, 0), 0.0);
		Gdiplus::SolidBrush brush(Gdiplus::Color(255, 255, 255, 255));
		ctx.pGraphics->FillPath(&brush, &path);
		ctx.pGraphics->DrawPath(&pen, &path);
	}
开发者ID:rogerclark,项目名称:grumble,代码行数:21,代码来源:GrmlTextElement.cpp


示例16: fillRadialGradient

//-----------------------------------------------------------------------------
void GdiplusDrawContext::fillRadialGradient (CGraphicsPath* _path, const CGradient& gradient, const CPoint& center, CCoord radius, const CPoint& originOffset, bool evenOdd, CGraphicsTransform* t)
{
#if DEBUG
	DebugPrint ("WARNING: GdiplusDrawContext::fillRadialGradient is not working as expected ! FIXME\n");
#endif
	GdiplusGraphicsPath* gdiPlusPath = dynamic_cast<GdiplusGraphicsPath*> (_path);
	if (gdiPlusPath && pGraphics)
	{
		GdiplusDrawScope drawScope (pGraphics, currentState.clipRect, getCurrentTransform ());

		Gdiplus::GraphicsPath* path = gdiPlusPath->getGraphicsPath ();

		if (t)
		{
			Gdiplus::Matrix matrix;
			convert (matrix, *t);
			path = path->Clone ();
			path->Transform (&matrix);
		}

		path->SetFillMode (evenOdd ? Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding);
		Gdiplus::PointF c1p ((Gdiplus::REAL)(center.x + originOffset.x), (Gdiplus::REAL)(center.y + originOffset.y));

		CRect boundingBox = gdiPlusPath->getBoundingBox ();
		Gdiplus::GraphicsPath brushPath;
		brushPath.AddEllipse ((Gdiplus::REAL)boundingBox.left, (Gdiplus::REAL)boundingBox.top, (Gdiplus::REAL)boundingBox.getWidth (), (Gdiplus::REAL)boundingBox.getHeight ());
		Gdiplus::Matrix graphicsMatrix;
		pGraphics->GetTransform (&graphicsMatrix);
		brushPath.Transform (&graphicsMatrix);

		Gdiplus::PathGradientBrush brush (&brushPath);
		// set center
		brush.SetCenterPoint (c1p);
		// set the colors
		Gdiplus::Color* colors = new Gdiplus::Color [gradient.getColorStops ().size ()];
		Gdiplus::REAL* positions = new Gdiplus::REAL [gradient.getColorStops ().size ()];
		uint32_t index = 0;
		for (CGradient::ColorStopMap::const_iterator it = gradient.getColorStops ().begin (); it != gradient.getColorStops ().end (); ++it, ++index)
		{
			CColor color = it->second;
			color.alpha = (int8_t)((float)color.alpha * currentState.globalAlpha);
			colors[index] = createGdiPlusColor (color);
			positions[index] = (Gdiplus::REAL)it->first;
		}
		brush.SetCenterColor (colors[0]);
		INT count = static_cast<INT> (gradient.getColorStops ().size ()) - 1;
		brush.SetSurroundColors (colors+1, &count);

		pGraphics->FillPath (&brush, path);
		if (path != gdiPlusPath->getGraphicsPath ())
			delete path;
		delete [] colors;
		delete [] positions;
	}
}
开发者ID:Piticfericit,项目名称:vstgui,代码行数:56,代码来源:gdiplusdrawcontext.cpp


示例17: FromPolygon

void VRegion::FromPolygon (const VPolygon& inPolygon)
{
	_Release();
	
	VPolygon*	constPoly = (VPolygon*) &inPolygon;
	
#if !USE_GDIPLUS
	POINT*	firstPt = (POINT*) constPoly->WIN_LockPolygon();
	fRegion = ::CreatePolygonRgn(firstPt, constPoly->GetPointCount(), WINDING);
	constPoly->WIN_UnlockPolygon();
	
	// Note: polygon doesnt actually use fOffset. Use AdjustOrigin instead.
	fOffset.SetPosTo(0, 0);
	_AdjustOrigin();
#else
	Gdiplus::GraphicsPath path;
	path.AddPolygon((Gdiplus::PointF*)constPoly,constPoly->GetPointCount());
	fRegion = new Gdiplus::Region(&path);
#endif

	_ComputeBounds();
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:22,代码来源:XWinRegion.cpp


示例18: FillRoundRectangle

void Graphics::FillRoundRectangle(Brush* brush, const RectF& rc, float d) {
    Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
    Gdiplus::Brush* gdiBrush = reinterpret_cast<Gdiplus::Brush*>(brush->_private);

    Gdiplus::GraphicsPath gp;
    Gdiplus::RectF r(rc.GetLeft()-1.0f, rc.GetTop()-1.0f, rc.GetWidth(), rc.GetHeight());

    gp.AddArc(r.X, r.Y, d, d, 180.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y, d, d, 270.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y + r.Height - d, d, d, 0.0f, 90.0f);
    gp.AddArc(r.X, r.Y + r.Height - d, d, d, 90.0f, 90.0f);
    gp.AddLine(r.X, r.Y + r.Height - d, r.X, r.Y + d / 2.0f);

    g->FillPath(gdiBrush, &gp);
}
开发者ID:pixelspark,项目名称:corespark,代码行数:15,代码来源:tjgraphics-gdiplus.cpp


示例19: DrawRoundRectangle

void Graphics::DrawRoundRectangle(Pen* pen, const RectF& rc, float d) {
    Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
    Gdiplus::Pen* gdiPen = reinterpret_cast<Gdiplus::Pen*>(pen->_private);

    Gdiplus::GraphicsPath gp;
    Gdiplus::RectF r(rc.GetLeft()-1.0f, rc.GetTop()-1.0f, rc.GetWidth(), rc.GetHeight());

    gp.AddArc(r.X, r.Y, d, d, 180.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y, d, d, 270.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y + r.Height - d, d, d, 0.0f, 90.0f);
    gp.AddArc(r.X, r.Y + r.Height - d, d, d, 90.0f, 90.0f);
    gp.AddLine(r.X, r.Y + r.Height - d, r.X, r.Y + d / 2.0f);

    g->DrawPath(gdiPen, &gp);
}
开发者ID:pixelspark,项目名称:corespark,代码行数:15,代码来源:tjgraphics-gdiplus.cpp


示例20: Draw

void SelectionHandler::Draw(CDC& offscreenDC)
{
  if (m_selectionState == selstateNoSelection) return;

  COORD coordStart;
  COORD coordEnd;
  SHORT maxX = (m_consoleParams->dwBufferColumns > 0) ?
    static_cast<SHORT>(m_consoleParams->dwBufferColumns - 1) :
    static_cast<SHORT>(m_consoleParams->dwColumns - 1);

  GetSelectionCoordinates(coordStart, coordEnd);

  SMALL_RECT& srWindow = m_consoleInfo->csbi.srWindow;

  if(   coordEnd.Y < srWindow.Top    ||
      coordStart.Y > srWindow.Bottom ) return;

  INT nXStart = (static_cast<INT>(coordStart.X) - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;
  INT nYStart = (static_cast<INT>(coordStart.Y) - static_cast<INT>(srWindow.Top) ) * m_nCharHeight + m_nHInsideBorder;
  INT nXEnd   = (static_cast<INT>(  coordEnd.X) - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;
  INT nYEnd   = (static_cast<INT>(  coordEnd.Y) - static_cast<INT>(srWindow.Top) ) * m_nCharHeight + m_nHInsideBorder;
  INT nXmin   = (static_cast<INT>(0)            - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;
  INT nXmax   = (static_cast<INT>(maxX)         - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;

  Gdiplus::Graphics gr(offscreenDC);

  Gdiplus::Color selectionColor;
  selectionColor.SetFromCOLORREF(g_settingsHandler->GetAppearanceSettings().stylesSettings.crSelectionColor);
  Gdiplus::Pen        pen  (selectionColor);
  Gdiplus::SolidBrush brush(Gdiplus::Color(64,  selectionColor.GetR(), selectionColor.GetG(), selectionColor.GetB()));
  Gdiplus::GraphicsPath gp;

  if( nYStart == nYEnd )
  {
    Gdiplus::Rect rect(
      nXStart,
      nYStart,
      (nXEnd - nXStart) + m_nCharWidth,
      m_nCharHeight);
    gp.AddRectangle(rect);
  }
  else
  {
    /*
           2_________3
    0______|         |
    |      1     5___|
    |____________|   4
    7            6
    */

    Gdiplus::Point points[8];

    points[0].X = nXmin;
    points[0].Y = nYStart + m_nCharHeight;

    points[1].X = nXStart;
    points[1].Y = points[0].Y;

    points[2].X = points[1].X;
    points[2].Y = nYStart;

    points[3].X = nXmax + m_nCharWidth;
    points[3].Y = points[2].Y;

    points[4].X = points[3].X;
    points[4].Y = nYEnd;

    points[5].X = nXEnd + m_nCharWidth;
    points[5].Y = points[4].Y;

    points[6].X = points[5].X;
    points[6].Y = nYEnd + m_nCharHeight;

    points[7].X = points[0].X;
    points[7].Y = points[6].Y;

    gp.AddPolygon(points, 8);
  }

  gr.FillPath(&brush, &gp);
  gr.DrawPath(&pen, &gp);
}
开发者ID:GlassBil,项目名称:console,代码行数:83,代码来源:SelectionHandler.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ gdiplus::Image类代码示例发布时间:2022-05-31
下一篇:
C++ gdiplus::Graphics类代码示例发布时间: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