Esempio n. 1
0
File: zipk.cpp Progetto: wangch/zipk
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;
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
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);
	}
}
Esempio n. 4
0
//-----------------------------------------------------------------------------
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;
	}
}
Esempio n. 5
0
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);
}
Esempio n. 6
0
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);
	}
}
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;
}
Esempio n. 8
0
/* 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;
}
Esempio n. 9
0
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);
}
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;
	}
}
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;
}
Esempio n. 12
0
//-----------------------------------------------------------------------------
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;
	}
}
Esempio n. 13
0
//-----------------------------------------------------------------------------
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);
	}
}
Esempio n. 14
0
/*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;
}
Esempio n. 15
0
	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);
	}
Esempio n. 16
0
//-----------------------------------------------------------------------------
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;
	}
}
Esempio n. 17
0
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();
}
Esempio n. 18
0
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);
}
Esempio n. 19
0
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);
}
Esempio n. 20
0
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);
}
Esempio n. 21
0
//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND  - process the application menu
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // Parse the menu selections:
            switch (wmId)
            {
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
	case WM_RBUTTONUP:
		DialogBox(hInst, MAKEINTRESOURCE(IDD_SETTINGS), hWnd, Settings);
		{
			Gdiplus::Graphics g(hWnd);
			Gdiplus::GraphicsPath path;
			path.AddString(config.text,
							-1,
							new Gdiplus::FontFamily(config.font),
							Gdiplus::FontStyleRegular,
							config.height,
							config.position,
							new Gdiplus::StringFormat());
			g.RotateTransform(config.angle);
			g.ScaleTransform(config.scale, config.scale);
			if (config.antialiasing)
			{
				g.SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
			}
			Gdiplus::Region r(&path);
			RECT rect, rect1;
			GetClientRect(hWnd, &rect);
			ClientToScreen(hWnd, (LPPOINT)&rect);
			GetWindowRect(hWnd, &rect1);
			HRGN h = r.GetHRGN(&g);
			OffsetRgn(h, (rect.left - rect1.left), (rect.top - rect1.top));
			SetWindowRgn(hWnd, config.defaultRegion ? oldRgn : h, TRUE);
			InvalidateRect(hWnd, NULL, TRUE);
		}
		break;
    case WM_PAINT:
        {
			HDC hdc = BeginPaint(hWnd, &ps);
			{
				Gdiplus::Graphics g(hdc);
				Gdiplus::GraphicsPath path;
				path.AddString(config.text,
								-1,
								new Gdiplus::FontFamily(config.font),
								Gdiplus::FontStyleRegular,
								config.height,
								config.position,
								new Gdiplus::StringFormat);
				g.Clear(config.backgroundColor);
				g.RotateTransform(config.angle);
				g.ScaleTransform(config.scale, config.scale);
				if (config.antialiasing)
				{
					g.SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
				}
				//g.SetSmoothingMode(config.antialiasing ? Gdiplus::SmoothingModeHighQuality : );
				g.DrawPath(new Gdiplus::Pen(config.outlineColor, 2.f), &path);
				g.FillPath(new Gdiplus::SolidBrush(config.fillColor), &path);
			}
			EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
Esempio n. 22
0
void IrisBitmap::IrisDrawText(const IrisFont* fontIris, int x, int y, int width, int height, wstring str, int align){
	this->needRefreshTexture = true;

	if (x > this->width || y > this->height || x < 0 || y < 0)
		return;

	//this->needRefreshTexture = true;

	int size = IrisFont::defaultSize;
	IrisColor *color;
	wstring name;
	bool bold, shadow, italic;

	if(fontIris == NULL){
		name = IrisFont::defaultName;
		bold = IrisFont::defaultBold;
		shadow = IrisFont::defaultShadow;
		italic = IrisFont::defaultItalic;
		color = IrisFont::defaultColor;
	}
	else
	{
		name = fontIris->name;
		bold = fontIris->bold;
		shadow = fontIris->shadow;
		italic = fontIris->italic;
		color = fontIris->color;
	}

	// release
	

	Gdiplus::Bitmap *tBitmap = this->bitmap->Clone(0, 0, this->bitmap->GetWidth(), this->bitmap->GetHeight(), PixelFormat32bppARGB);
	Graphics tg(tBitmap);

	Gdiplus::FontFamily fontFamily(name.c_str());
	int fs = FontStyleRegular;
	
	if(bold)
		fs |= FontStyleBold;

	if(italic)
		fs |= FontStyleItalic;

	//lfont.lfWeight = 1000;
	Gdiplus::Font font(&fontFamily, (REAL)size, fs, UnitPixel);

	StringFormat strFormat;

	switch(align){
	case 0:
		strFormat.SetAlignment(StringAlignmentNear);
		break;
	case 1:
		strFormat.SetAlignment(StringAlignmentCenter);
		break;
	}

	Brush *brush;

	if(shadow)
		brush = new HatchBrush(HatchStyle90Percent, Color(color->red, color->green, color->blue));
	else
		brush = new SolidBrush(Color(color->red, color->green, color->blue));

	strFormat.SetFormatFlags(StringFormatFlagsNoWrap);
	Gdiplus::RectF r((REAL)x, (REAL)y, (REAL)width, (REAL)height);
	tg.SetSmoothingMode(SmoothingModeAntiAlias);
	tg.SetInterpolationMode(InterpolationModeHighQualityBicubic);
	Gdiplus::GraphicsPath path;
	path.AddString(str.c_str(), str.size(), &fontFamily, FontStyleRegular, 20, r, &strFormat);
	Gdiplus::Pen pen(Color(color->red, color->green, color->blue), 2);
	tg.DrawPath(&pen, &path);
	tg.FillPath(brush, &path);

	if(this->bitmap != 0){
		delete this->bitmap;
		this->bitmap = 0;
	}

	this->bitmap = tBitmap->Clone(0, 0, tBitmap->GetWidth(), tBitmap->GetHeight(), PixelFormat32bppARGB);

	//CLSID encoderClsid;
	//ModuleIrisGraphics::GetEncoderClsid(L"image/png", &encoderClsid);
	//this->bitmap->Save(L"string.png", &encoderClsid, NULL);

	delete brush;
	delete tBitmap;
	
}
Esempio n. 23
0
void GraphicsPath::AddEllipse(const RectF& rc) {
    Gdiplus::GraphicsPath* gp = reinterpret_cast<Gdiplus::GraphicsPath*>(_private);
    gp->AddEllipse(ToGDIRect<RectF, Gdiplus::RectF>(rc));
}
Esempio n. 24
0
/* Function creates objects from script - first it take names and than it creates path for a region and afterwards the map of state changes. */
bool INTERACTIVE::CreateObjects() {
	// attributes
	std::wstring name;
	std::wstring caption;
	std::string sound_path;
	std::string caption_sound_path;
	bool finish_scene;

	// object's space
	Gdiplus::GraphicsPath boundaries;
	int verticle_count;
	Gdiplus::Point * verticles;
	int x, y;

	// caused changes
	std::string state_name;
	std::vector<state_changes> changes; 

	// control
	bool verticles_OK = true;

	// Tag is not necessary for the editor
	if(!script.FindElem(L"OBJECTS"))
		return true;
	script.IntoElem();

	// Tag is not necessary for the editor
	if(!script.FindElem(L"OBJECT")){
		script.OutOfElem();
		return true;
	}
	else do {
		// atributes reading
		name = script.GetAttrib(L"name");
		caption = script.GetAttrib(L"caption");
		sound_path = wstring2string(script.GetAttrib(L"sound_source"));
		caption_sound_path = wstring2string(script.GetAttrib(L"caption_sound")); 
		verticle_count = atoi((wstring2string(script.GetAttrib(L"v_count"))).c_str());
		if(verticle_count < 3){
			Log("Verticle count in one of the objects is too low");
			verticles_OK = false;
		} 
		finish_scene = (atoi((wstring2string(script.GetAttrib(L"finish_scene"))).c_str())) != 0 ? true : false;
		
		script.IntoElem(); // Jumps into the object

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

		// creates verticles for the object polygon
		verticles = new Gdiplus::Point [verticle_count];
		for(int i = 0; i < verticle_count; i++){
			if(!script.FindElem(L"VERTEX")){
				Log("There is not responding count of vertices in one object in script.");
				verticles_OK = false;
			}
			x = atoi((wstring2string(script.GetAttrib(L"x"))).c_str()); 
			y = atoi((wstring2string(script.GetAttrib(L"y"))).c_str()); 
			verticles[i] = Gdiplus::Point(x, y);
			
		}
		if(!verticles_OK){
			delete [] verticles;
			script.OutOfElem();
			continue;
		}
		else{
			boundaries.AddPolygon(verticles, verticle_count);
			delete [] verticles;
		}

		// creates the vector 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

		objects.push_back(SCENE_OBJECT(&boundaries, name, caption, sound_path, caption_sound_path, changes, finish_scene));
		boundaries.Reset();
		changes.clear();

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

	script.OutOfElem();
	return true;
}
Esempio n. 25
0
BOOL GdiplusUtilities::GetRoundRectGraphicsPath(Gdiplus::GraphicsPath& p, 
			int x, int y, int width, int height, int radius, RectangleCorners corners)
{
	int xw = x + width;
	int yh = y + height;
	int xwr = xw - radius;
	int yhr = yh - radius;
	int xr = x + radius;
	int yr = y + radius;
	int r2 = radius * 2;
	int xwr2 = xw - r2;
	int yhr2 = yh - r2;

	p.StartFigure();

	//Top Left Corner
	if ((TopLeft & corners)	== TopLeft)
	{
		p.AddArc(x, y, r2, r2, 180, 90);
	}
	else
	{
		p.AddLine(x, yr, x, y);
		p.AddLine(x, y, xr, y);
	}

	//Top Edge
	p.AddLine(xr, y, xwr, y);

	//Top Right Corner
	if ((TopRight & corners)
		== TopRight)
	{
		p.AddArc(xwr2, y, r2, r2, 270, 90);
	}
	else
	{
		p.AddLine(xwr, y, xw, y);
		p.AddLine(xw, y, xw, yr);
	}

	//Right Edge
	p.AddLine(xw, yr, xw, yhr);

	//Bottom Right Corner
	if ((BottomRight & corners)
		== BottomRight)
	{
		p.AddArc(xwr2, yhr2, r2, r2, 0, 90);
	}
	else
	{
		p.AddLine(xw, yhr, xw, yh);
		p.AddLine(xw, yh, xwr, yh);
	}

	//Bottom Edge
	p.AddLine(xwr, yh, xr, yh);

	//Bottom Left Corner
	if ((BottomLeft & corners)
		== BottomLeft)
	{
		p.AddArc(x, yhr2, r2, r2, 90, 90);
	}
	else
	{
		p.AddLine(xr, yh, x, yh);
		p.AddLine(x, yh, x, yhr);
	}

	//Left Edge
	p.AddLine(x, yhr, x, yr);

	p.CloseFigure();
	return TRUE;
}
Esempio n. 26
0
HRESULT CSwatchesList::OnDraw(ATL_DRAWINFO& di)
{
	RECT& rc = *(RECT*)di.prcBounds;
	HDC hDC = di.hdcDraw;

	if (m_swatches)
	{
		Draw3DRect(hDC, m_areaRect.left-1, m_areaRect.top-1, m_areaRect.Width()+2, m_areaRect.Height()+2, RGB(0,0,0), RGB(0,0,0));

		long scrollposY; m_vert->get_pos(&scrollposY);

		if (IntersectClipRect(hDC, m_areaRect.left, m_areaRect.top, m_areaRect.right, m_areaRect.bottom))
		{
			POINT oldOrg;
			SetViewportOrgEx(hDC, m_areaRect.left, m_areaRect.top - scrollposY, &oldOrg);
		// For CMYK conversion
			/*
			TCHAR colorDirectory[MAX_PATH];
			DWORD cbSize = sizeof(colorDirectory);
			GetColorDirectory(NULL, colorDirectory, &cbSize);

			HPROFILE hDestProfile = NULL;
			{
				TCHAR profilePath[MAX_PATH];
				_makepath(profilePath, NULL, colorDirectory, "sRGB Color Space Profile.ICM", NULL);

				PROFILE profile = {0};
				profile.dwType = PROFILE_FILENAME;
				profile.pProfileData = profilePath;
				profile.cbDataSize = (_tcslen(profilePath)+1)*sizeof(TCHAR);
				hDestProfile = OpenColorProfile(&profile, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING);
				ATLASSERT(hDestProfile);
			}

			HPROFILE hTargetProfile = NULL;
			{
				TCHAR profilePath[MAX_PATH];
				_makepath(profilePath, NULL, colorDirectory, targetProfile, NULL);

				PROFILE profile = {0};
				profile.dwType = PROFILE_FILENAME;
				profile.pProfileData = profilePath;
				profile.cbDataSize = (_tcslen(profilePath)+1)*sizeof(TCHAR);
				hTargetProfile = OpenColorProfile(&profile, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING);
				ATLASSERT(hTargetProfile);
			}

			LOGCOLORSPACE lcp = {0};
			lcp.lcsSignature = LCS_SIGNATURE;
			lcp.lcsVersion = 0x400;
			lcp.lcsSize = sizeof(lcp);
			lcp.lcsCSType = LCS_sRGB;
			lcp.lcsFilename;// = NULL; // ??

			HTRANSFORM hTransform = CreateColorTransform(&lcp, hDestProfile, hTargetProfile, BEST_MODE);
			ATLASSERT(hTransform);
			*/

		// Pattern for drawing ColorType symbols
			WORD bmdata[8] =
			{
				0xaaaa,
				0x5555,
				0xaaaa,
				0x5555,
				0xaaaa,
				0x5555,
				0xaaaa,
				0x5555,
			};

			HBITMAP hPatBitmap = CreateBitmap(8, 8, 1, 1, bmdata);
			ATLASSERT(hPatBitmap);

			HBRUSH hPatBrush = CreatePatternBrush(hPatBitmap);
			ATLASSERT(hPatBrush);
			DeleteObject(hPatBitmap);

		//
			HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);

			LOGFONT lf;
			GetObject(hFont, sizeof(lf), &lf);
			lf.lfWeight = FW_BOLD;

			HFONT hFontSelected = CreateFontIndirect(&lf);
			HFONT hOldFont = (HFONT)GetCurrentObject(hDC, OBJ_FONT);

			long nswatches;
			m_swatches->get_length(&nswatches);

			int y = 0;

			for (int i = 0; i < nswatches; i++)
			{
				CComPtr<IPDSwatch> swatch;
				m_swatches->item(i, &swatch);

				//Rectangle(hDC, itemrect.left, itemrect.top, itemrect.right+1, itemrect.bottom+1);
				MoveToEx(hDC, 0, y+m_itemHeight, NULL);
				LineTo(hDC, m_areaRect.Width()+1, y+m_itemHeight);

				CRect itemrect(0, y+1, m_areaRect.Width(), y+m_itemHeight-1);
	//			itemrect.top += 1;
	//			itemrect.bottom -= 1;

				bool bSelected = IsSwatchSelected(swatch);

				if (bSelected)
					FillSolidRect(hDC, itemrect.left, itemrect.top+1, itemrect.Width(), itemrect.Height()-1, (bSelected)? GetSysColor(COLOR_HIGHLIGHT): GetSysColor(COLOR_WINDOW));

				int swatchSize = m_itemHeight-4;
				int swatchTop = (m_itemHeight-swatchSize)/2;
		//		CRect swatchRect(itemrect.left + 4, itemrect.top+itemrect.Height()/2-8, itemrect.left + 4 + 16, itemrect.top+itemrect.Height()/2-8+16);
				CRect swatchRect(itemrect.left + 4, itemrect.top+swatchTop, itemrect.left + 4 + swatchSize, itemrect.top+swatchTop+swatchSize);

				if (bSelected)
				{
					SelectObject(hDC, hFontSelected);
					SetTextColor(hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
				}
				else
				{
					SelectObject(hDC, hFont);
					SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
				}

				SetBkMode(hDC, TRANSPARENT);

				BSTR bname;
				swatch->get_name(&bname);
				_bstr_t name = _bstr_t(bname, false);

				PDSwatchType swatchType;
				swatch->get_swatchType(&swatchType);

				CRect trect = itemrect;
				trect.left = swatchRect.right + 4;
				trect.right -= 30;

				if (swatchType == SWATCH_NONE)
				{
					FillSolidRect(hDC, &swatchRect, RGB(255, 255, 255));

					HPEN hPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
					HPEN hOldPen = (HPEN)SelectObject(hDC, hPen);

					MoveToEx(hDC, swatchRect.left+1, swatchRect.bottom-1, NULL);
					LineTo(hDC, swatchRect.right-1, swatchRect.top+1);

					SelectObject(hDC, hOldPen);
					DeleteObject(hPen);

					HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, GetStockObject(NULL_BRUSH));
					Rectangle(hDC, swatchRect.left, swatchRect.top, swatchRect.right, swatchRect.bottom);
					SelectObject(hDC, hOldBrush);
				}
				else if (swatchType == SWATCH_COLOR ||
							swatchType == SWATCH_TINT)
				{
					CComPtr<IPDColor> color;
					CComQIPtr<IPDSwatchColor> swatchColor;

					if (swatchType == SWATCH_COLOR)
					{
						swatchColor = swatch;
						swatchColor->get_color(&color);
					}
					else
					{
						CComQIPtr<IPDSwatchTint> swatchTint = swatch;
						swatchTint->get_swatchColor(&swatchColor);

						swatchTint->get_finalColor(&color);

						CRect trect2 = trect;
						trect.right -= 28;
						trect2.left = trect.right;

						double tint;
						swatchTint->get_tint(&tint);

						CUString str;
						str.Format("%d %%", (int)(tint*100));

						DrawText(hDC, str, str.GetLength(), &trect2, DT_SINGLELINE | DT_VCENTER);
					}

					PDColorMode colorMode;
					color->get_colorMode(&colorMode);

					COLORREF clr;

					if (colorMode == COLORMODE_RGB)
					{
						double red; color->getChannel(0, &red);
						double green; color->getChannel(1, &green);
						double blue; color->getChannel(2, &blue);

						clr = RGB(red, green, blue);
					}
					else if (colorMode == COLORMODE_CMYK)
					{
	/*					if (hTransform)
						{
							double cyan; color->getChannel(0, &cyan);
							double magenta; color->getChannel(1, &magenta);
							double yellow; color->getChannel(2, &yellow);
							double black; color->getChannel(3, &black);

							COLOR incolor;
							incolor.cmyk.cyan = cyan*65535/255;
							incolor.cmyk.magenta = magenta*65535/255;
							incolor.cmyk.yellow = yellow*65535/255;
							incolor.cmyk.black = black*65535/255;

							COLOR outcolor;
							BOOL bSuccess = TranslateColors(hTransform, &incolor, 1, COLOR_CMYK, &outcolor, COLOR_RGB);
							ATLASSERT(bSuccess);

							clr = RGB(
								outcolor.rgb.red*255.0/65535,
								outcolor.rgb.green*255.0/65535,
								outcolor.rgb.blue*255.0/65535);
						}
						else
						*/
							clr = -1;
					}

					if (clr != -1)
					{
						HBRUSH hBrush = CreateSolidBrush(clr);
						HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);

						Rectangle(hDC, swatchRect.left, swatchRect.top, swatchRect.right, swatchRect.bottom);

						SelectObject(hDC, hOldBrush);
						DeleteObject(hBrush);
					}

					{
						CRect rc(itemrect.right-15, itemrect.top+4, itemrect.right-15+10, itemrect.top+4+10);

						if (colorMode == COLORMODE_RGB)
						{
							Rectangle(hDC, rc.left, rc.top-1, rc.right+1, rc.bottom+1);

							FillSolidRect(hDC, rc.left+1, rc.top, 3, rc.Height(), RGB(255, 0, 0));
							FillSolidRect(hDC, rc.left+4, rc.top, 3, rc.Height(), RGB(0, 255, 0));
							FillSolidRect(hDC, rc.left+7, rc.top, 3, rc.Height(), RGB(0, 0, 255));
						}
						else if (colorMode == COLORMODE_CMYK)
						{
							//
							{
								HBRUSH hBrush = CreateSolidBrush(RGB(255, 0, 255));
								HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);

								POINT pts[3] =
								{
									rc.left, rc.top,
									rc.left+rc.Width(), rc.top,
									rc.left+rc.Width()/2, rc.top+rc.Height()/2,
								};

								Polygon(hDC, pts, 3);

								SelectObject(hDC, hOldBrush);
								DeleteObject(hBrush);
							}

							//
							{
								HBRUSH hBrush = CreateSolidBrush(RGB(255, 255, 0));
								HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);

								POINT pts[3] =
								{
									rc.right, rc.top,
									rc.right, rc.top+rc.Height(),
									rc.right-rc.Width()/2, rc.top+rc.Height()/2,
								};

								Polygon(hDC, pts, 3);

								SelectObject(hDC, hOldBrush);
								DeleteObject(hBrush);
							}

							//
							{
								HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0));
								HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);

								POINT pts[3] =
								{
									rc.left, rc.bottom,
									rc.left+rc.Width(), rc.bottom,
									rc.left+rc.Width()/2, rc.bottom-rc.Height()/2,
								};

								Polygon(hDC, pts, 3);

								SelectObject(hDC, hOldBrush);
								DeleteObject(hBrush);
							}

							//
							{
								HBRUSH hBrush = CreateSolidBrush(RGB(0, 255, 255));
								HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);

								POINT pts[3] =
								{
									rc.left, rc.top,
									rc.left, rc.top+rc.Height(),
									rc.left+rc.Width()/2, rc.top+rc.Height()/2,
								};

								Polygon(hDC, pts, 3);

								SelectObject(hDC, hOldBrush);
								DeleteObject(hBrush);
							}
						}
					}

					{
						CRect rc(m_areaRect.right-28, y+4, m_areaRect.right-28+10, y+4+10);

						PDColorType colorType;
						swatchColor->get_colorType(&colorType);

						int oldBkMode = SetBkMode(hDC, OPAQUE);
						COLORREF oldTextClr = SetTextColor(hDC, RGB(100,100,100));
						COLORREF oldBkClr = SetBkColor(hDC, RGB(255,255,255));

						if (colorType == COLORTYPE_PROCESS)
						{
							HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, hPatBrush);
							Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
							SelectObject(hDC, hOldBrush);
						}
						else if (colorType == COLORTYPE_SPOT)
						{
							Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);

							HPEN hPen = CreatePen(PS_SOLID, 1, RGB(120, 120, 120));
							HBRUSH hOldBrush = (HBRUSH)SelectObject(hDC, hPatBrush);
							HPEN hOldPen = (HPEN)SelectObject(hDC, hPen);

							Ellipse(hDC, rc.left+2, rc.top+2, rc.right-2, rc.bottom-2);

							SelectObject(hDC, hOldBrush);
							SelectObject(hDC, hOldPen);
							DeleteObject(hPen);
						}
						else
							ATLASSERT(0);

						SetBkMode(hDC, oldBkMode);
						SetTextColor(hDC, oldTextClr);
						SetBkColor(hDC, oldBkClr);
					}
				}
				else if (swatchType == SWATCH_GRADIENT)
				{
					Gdiplus::Graphics graphics(hDC);

					CComQIPtr<IPDSwatchGradient> swatchGradient = swatch;

					CComPtr<IPDGradient> gradient;
					swatchGradient->get_gradient(&gradient);

					PDGradientType gradientType;
					gradient->get_type(&gradientType);

					Gdiplus::Rect rc(swatchRect.left, swatchRect.top, swatchRect.Width(), swatchRect.Height());

					CArray<Gdiplus::REAL, Gdiplus::REAL> offsets;
					CArray<Gdiplus::Color,Gdiplus::Color&> colors;

					CreateGradient(offsets, colors, gradient);

					if (gradientType == GRADIENT_LINEAR)
					{
						Gdiplus::LinearGradientBrush brush(rc, Gdiplus::Color(0,0,0), Gdiplus::Color(0,0,0), Gdiplus::LinearGradientModeHorizontal);
						brush.SetInterpolationColors(colors.GetData(), offsets.GetData(), colors.GetSize());

						graphics.FillRectangle(&brush, rc);
					}
					else if (gradientType == GRADIENT_RADIAL)
					{
						Gdiplus::GraphicsPath path;
						path.AddEllipse(rc);

						Gdiplus::PathGradientBrush brush(&path);
						brush.SetInterpolationColors(colors.GetData(), offsets.GetData(), colors.GetSize());

						graphics.FillRectangle(&brush, rc);
					}
					else
						ATLASSERT(0);
				}
				else if (swatchType == SWATCH_PATTERN)
				{
					Gdiplus::Graphics graphics(hDC);

					CComQIPtr<IPDSwatchPattern> swatchPattern = swatch;

					CComPtr<IPDObjectGroup> objectGroup;
					swatchPattern->get_objectGroup(&objectGroup);

					RectD bbox;
					objectGroup->getExpandedBBox(&bbox);

					int width = swatchRect.Width();
					int height = (bbox.Height * width/bbox.Width);//+0.5;

					if (height > swatchRect.Height())
					{
						height = swatchRect.Height();
						width = (bbox.Width * height/bbox.Height);//+0.5;
					}
					ATLASSERT(width <= bbox.Width);

					double magnify = width/bbox.Width;

					int left = (swatchRect.Width()-width)/2;
					int top = (swatchRect.Height()-height)/2;

					CComPtr<IPDRenderer> renderer;
					renderer.CoCreateInstance(CLSID_PDRenderer);
					if (renderer)
					{
						Gdiplus::Bitmap bitmap(width, height);
						{
							Gdiplus::Graphics bmgraphics(&bitmap);
							bmgraphics.FillRectangle(&Gdiplus::SolidBrush(Gdiplus::Color(255, 255, 255)), 0, 0, width, height);

						//	Gdiplus::Graphics& bmgraphics = graphics;

						//	CComQIPtr<IPDObjectTransformable> transformable = objectGroup;
						//	RectD bounds;
						//	transformable->get_bounds(&bounds);

						//	bmgraphics.TranslateTransform(swatchRect.left+left, swatchRect.top+top);

							bmgraphics.ScaleTransform(magnify, magnify);
							bmgraphics.TranslateTransform(-bbox.X, -bbox.Y);
						//	bmgraphics.TranslateTransform(-bounds.X, -bounds.Y);

							renderer->put_magnify(magnify);
							renderer->put_targetHDC((HDC)&bmgraphics);

							renderer->RenderObject(objectGroup);
						}

						graphics.DrawImage(&bitmap, swatchRect.left+left, swatchRect.top+top);
					}
				}

				DrawText(hDC, name, name.length(), &trect, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS);

				y += m_itemHeight;
			}

			SelectObject(hDC, hOldFont);

			DeleteObject(hFontSelected);
			DeleteObject(hPatBrush);
	/*
			if (hTransform) DeleteColorTransform(hTransform);
			if (hDestProfile) CloseColorProfile(hDestProfile);
			*/

			SetViewportOrgEx(hDC, oldOrg.x, oldOrg.y, NULL);
		}
	}

	return S_OK;
}
Esempio n. 27
0
Gdiplus::Brush* GetGdiBrush(IPDBrush* brush, PDBrushType brushType = BRUSH_NONE)
{
	Gdiplus::Brush* pBrush = NULL;

	if (brushType == BRUSH_NONE)
	{
		if (brush) brush->get_brushType(&brushType);
	}

	if (brushType == (PDBrushType)tomUndefined)
	{
	}
	else if (brushType == BRUSH_COLOR)
	{
		CComPtr<IPDColor> color;
		brush->get_tintedRGBColor(&color);
		if (color)
		{
			double red; color->getChannel(0, &red);
			double green; color->getChannel(1, &green);
			double blue; color->getChannel(2, &blue);

			pBrush = new Gdiplus::SolidBrush(Gdiplus::Color(255, red, green, blue));
		}
	}
	else if (brushType == BRUSH_GRADIENT)
	{
		CComPtr<IPDGradient> gradient;
		brush->get_gradient(&gradient);

		if (gradient)
		{
			PDGradientType gradientType;
			gradient->get_type(&gradientType);

			double x1; brush->get_x1(&x1);
			double y1; brush->get_y1(&y1);
			double x2; brush->get_x2(&x2);
			double y2; brush->get_y2(&y2);

			CArray<Gdiplus::REAL, Gdiplus::REAL> offsets;
			CArray<Gdiplus::Color,Gdiplus::Color&> colors;

			CreateGradient(offsets, colors, gradient);

			if (gradientType == GRADIENT_LINEAR)
			{
				Gdiplus::LinearGradientBrush* pGradBrush = new Gdiplus::LinearGradientBrush(
						Gdiplus::Point(x1, y1),
						Gdiplus::Point(x2, y2),
						Gdiplus::Color(0,0,0,0), Gdiplus::Color(0,0,0,0));
				pGradBrush->SetInterpolationColors(colors.GetData(), offsets.GetData(), colors.GetSize());

				pBrush = pGradBrush;
			}
			else if (gradientType == GRADIENT_RADIAL)
			{
				double dx = x2-x1;
				double dy = y2-y1;
				double radius = sqrt(dx*dx+dy*dy);

				Gdiplus::GraphicsPath path;
				path.AddEllipse((float)(x1-radius), (float)(y1-radius), (float)(x1+radius), (float)(y1+radius));

				Gdiplus::PathGradientBrush* pGradBrush = new Gdiplus::PathGradientBrush(&path);
				pGradBrush->SetInterpolationColors(colors.GetData(), offsets.GetData(), colors.GetSize());

				pBrush = pGradBrush;
			}
			else
				ATLASSERT(0);
		}
	}
	else if (brushType == BRUSH_PATTERN)
	{
		CComPtr<IPDSwatch> swatch;
		brush->get_swatch(&swatch);

		CComQIPtr<IPDSwatchPattern> swatchPattern = swatch;

		CComPtr<IPDObjectGroup> objectGroup;
		swatchPattern->get_objectGroup(&objectGroup);

		if (objectGroup)
		{
			CPDObjectGroup* pGroup = static_cast<CPDObjectGroup*>(objectGroup.p);

			RectD bounds;
			pGroup->get_bounds(&bounds);

			Gdiplus::Bitmap bitmap(bounds.Width, bounds.Height);
			{
				Gdiplus::Graphics graphics(&bitmap);
				//graphics.ScaleTransform(swatchRect.Width()/bounds.Width, swatchRect.Height()/bounds.Height);
				graphics.TranslateTransform(-bounds.X, -bounds.Y);

				pGroup->Render(NULL, &graphics, 1, 1/*TODO*/);
			}

			Gdiplus::TextureBrush* pTexBrush = new Gdiplus::TextureBrush(&bitmap);

			pBrush = pTexBrush;
		}
	}

	return pBrush;
}
Esempio n. 28
0
void CSkinUnitODL::DrawImage(Gdiplus::Graphics& gcDrawer, Gdiplus::GraphicsPath& gcPath, Gdiplus::PointF& ptOffset, Gdiplus::REAL fScale)
{
	if (m_imgSkin)
	{
		if (m_nWrapMode>=4)
		{
			//居中模式
			Gdiplus::RectF rtArea;
			gcPath.GetBounds(&rtArea);
			Gdiplus::GraphicsPath gcDrawPath;
			//图片中间X:(width-imagewidth )/2 + left;
			//Y: (height - imageheight)/2 +top;

			Gdiplus::REAL fX0 = (rtArea.Width - m_fSkinWidth-m_nGroutX) /2.0f + rtArea.X;
			Gdiplus::REAL fY0 = (rtArea.Height - m_fSkinHeight-m_nGroutY) /2.0f + rtArea.Y;
			Gdiplus::REAL fX1 = m_fSkinWidth + m_nGroutX+ fX0;
			Gdiplus::REAL fY1 = m_fSkinHeight +m_nGroutY+ fY0;
			std::vector<Gdiplus::PointF> arrPt;
			arrPt.emplace_back(fX0, fY0);
			arrPt.emplace_back(fX1, fY0);
			arrPt.emplace_back(fX1, fY1);
			arrPt.emplace_back(fX0, fY1);
			Gdiplus::Matrix mx;
			Gdiplus::PointF ptCenter=Gdiplus::PointF((fX1+fX0)/2.0f, (fY1+fY0)/2.0f);
			mx.RotateAt(m_fRotate, ptCenter);
			mx.TransformPoints(arrPt.data(), arrPt.size());
			gcDrawPath.AddPolygon(arrPt.data(),arrPt.size());
			//如果图片的path大于当前区域Path,则居中操作在区域内
			{
				BRepBuilderAPI_MakePolygon ply1;
				for (auto& ptPos:arrPt)
				{
					ply1.Add(gp_Pnt(ptPos.X, 0.0f, ptPos.Y));
				}
				ply1.Close();
				TopoDS_Face face1 = BRepBuilderAPI_MakeFace(ply1.Wire()).Face();
				std::vector<Gdiplus::PointF> arrPic;
				arrPic.resize(gcDrawPath.GetPointCount());
				gcPath.GetPathPoints(arrPic.data(), arrPic.size());

				BRepBuilderAPI_MakePolygon ply2;
				for (auto& ptPos:arrPic)
				{
					ply2.Add(gp_Pnt(ptPos.X, 0.0f, ptPos.Y));
				}
				ply2.Close();
				TopoDS_Face face2 = BRepBuilderAPI_MakeFace(ply2.Wire()).Face();

				BRepAlgoAPI_Common bc(face1, face2);
				auto face = bc.Shape();
				TopExp_Explorer expWire(face, TopAbs_WIRE);
				std::vector<Gdiplus::PointF> arrDraw;
				for ( BRepTools_WireExplorer expVertex(TopoDS::Wire(expWire.Current())); expVertex.More(); expVertex.Next() )
				{
					auto pnt = BRep_Tool::Pnt(expVertex.CurrentVertex());
					arrDraw.emplace_back(static_cast<Gdiplus::REAL>(pnt.X()), static_cast<Gdiplus::REAL>(pnt.Z()));
				}
				gcDrawPath.Reset();
				gcDrawPath.AddPolygon(arrDraw.data(), arrDraw.size());
			}

			Gdiplus::WrapMode wmMode=(Gdiplus::WrapMode)m_nWrapMode;
			if (std::fabs(m_fRotate)<0.001f)
			{
				Gdiplus::TextureBrush brush(m_imgSkin, wmMode);
				mx.Translate(fX0, fY0);
				brush.SetTransform(&mx);
				gcDrawer.FillPath(&brush, &gcDrawPath);
			}
			else
			{
				Gdiplus::TextureBrush brush(m_imgSkin, wmMode);
				mx.Translate(fX0, fY0);
				brush.SetTransform(&mx);
				gcDrawer.FillPath(&brush, &gcDrawPath);
			}
		}
		else
		{
			//铺满模式
			Gdiplus::WrapMode wmMode=(Gdiplus::WrapMode)m_nWrapMode;
			if (std::fabs(m_fRotate)<0.001f)
			{
				Gdiplus::TextureBrush brush(m_imgSkin, wmMode);
				brush.TranslateTransform(ptOffset.X, ptOffset.Y);
				gcDrawer.FillPath(&brush, &gcPath);
			}
			else
			{
				Gdiplus::TextureBrush brush(m_imgSkin, wmMode);
				brush.TranslateTransform(ptOffset.X, ptOffset.Y);
				brush.RotateTransform(m_fRotate);
				gcDrawer.FillPath(&brush, &gcPath);
			}
		}
		
	}
}
void CControlArrowStyleSelector::Draw(CDC* pDC)
{
	CRect rc(m_rcControl);
	int nCount = sizeof(arrowStyles) / sizeof(arrowStyles[0]);
	
	for (int i = 0; i < nCount; i++)
	{
		CRect rcButton = GetRect(i);
		
		if (i == m_nSelected || arrowStyles[i].iArrowStyle == m_iArrowStyle)
		{
			BOOL bPressed = GetPressed() && i == m_nSelected;
			//GetPaintManager()->DrawControlEntry(pDC, &rcButton, m_bEnabled, i == m_nSelected, bPressed, arrowStyles[i].iArrowStyle == m_iArrowStyle, FALSE, GetParent()->GetPosition());
         GetPaintManager()->DrawRectangle(pDC, &rcButton, i == m_nSelected, bPressed, m_bEnabled, arrowStyles[i].iArrowStyle == m_iArrowStyle, FALSE, GetParent()->GetType(), GetParent()->GetPosition());
		}
			
		Gdiplus::Graphics gdipGraphics(pDC->m_hDC);
		Gdiplus::Pen pen(Gdiplus::Color(255, 0, 0, 0), 1);
      Gdiplus::SolidBrush brush(Gdiplus::Color(255, 0, 0, 0));
/*		if (arrowStyles[i].iArrowStyle == msoLineRoundDot)
			pen.SetDashCap(Gdiplus::DashCapTriangle);
		else
			pen.SetDashCap(Gdiplus::DashCapFlat);
		pen.SetDashPattern(arrowStyles[i].dashValues, arrowStyles[i].iDashValueCount);
		pen.SetDashStyle(Gdiplus::DashStyleCustom);*/
      
//      Gdiplus::Point points[3] = {Gdiplus::Point(0, 0), Gdiplus::Point(0, 0), Gdiplus::Point(0, 0)};
      Gdiplus::GraphicsPath startCapPath;
      Gdiplus::GraphicsPath endCapPath;

   // Create a CustomLineCap object with capPath as the stroke path.

      int yPos = rcButton.top + XTP_AS_SELECTOR_HEIGHT / 2;

      switch(arrowStyles[i].startCap)
      {
      case Gdiplus::LineCapArrowAnchor:
         {
            Gdiplus::AdjustableArrowCap capStart(9, 9, false);
            pen.SetCustomStartCap(&capStart);
            break;
         }

      case Gdiplus::LineCapTriangle:
         {
            Gdiplus::AdjustableArrowCap capStart(6, 5, true);
            pen.SetCustomStartCap(&capStart);
            break;
         }

      case Gdiplus::LineCapDiamondAnchor:
         {
            Gdiplus::Point points[4] = {Gdiplus::Point(rcButton.left , yPos ), Gdiplus::Point(rcButton.left + 5, yPos + 5), Gdiplus::Point(rcButton.left + 10, yPos), Gdiplus::Point(rcButton.left + 5, yPos - 5)};
            startCapPath.AddPolygon(points, 4);
            break;
         }
      case Gdiplus::LineCapRoundAnchor:
         {
            Gdiplus::Rect rect(rcButton.left, yPos - 5, 10, 10);
            startCapPath.AddEllipse(rect);
            break;
         }

      default:
         break;
      }

      switch(arrowStyles[i].endCap)
      {
      case Gdiplus::LineCapArrowAnchor:
         {
            Gdiplus::AdjustableArrowCap capEnd(9, 9, false);
            pen.SetCustomEndCap(&capEnd);
            break;
         }

      case Gdiplus::LineCapTriangle:
         {
            Gdiplus::AdjustableArrowCap capEnd(6, 5, true);
            pen.SetCustomEndCap(&capEnd);
            break;
         }

      case Gdiplus::LineCapDiamondAnchor:
         {
            Gdiplus::Point points[4] = {Gdiplus::Point(rcButton.right - 10 , yPos ), Gdiplus::Point(rcButton.right - 5, yPos + 5), Gdiplus::Point(rcButton.right, yPos), Gdiplus::Point(rcButton.right - 5, yPos - 5)};
            endCapPath.AddPolygon(points, 4);
            break;
         }
      case Gdiplus::LineCapRoundAnchor:
         {
            Gdiplus::Rect rect(rcButton.right - 10, yPos - 5, 10, 10);
            endCapPath.AddEllipse(rect);
            break;
         }

      default:
         break;
      }

			
		if (!m_bEnabled) 
		{
			pen.SetColor(Gdiplus::Color(255, 128, 128, 128));
         brush.SetColor(Gdiplus::Color(255, 128, 128, 128));
		}
		
		gdipGraphics.DrawLine(&pen, Gdiplus::Point(rcButton.left + 2, yPos), Gdiplus::Point(rcButton.right-2, yPos));
      
      gdipGraphics.FillPath(&brush,&startCapPath); 
      gdipGraphics.FillPath(&brush,&endCapPath); 

	}
}
void LayeredWindowBase::Render()
{
	wchar_t pszbuf[] = L"1.Text Designer中文字也可顯示\n2.Text Designer中文字也可顯示\n3.Text Designer中文字也可顯示\n4.Text Designer中文字也可顯示\n5.Text Designer中文字也可顯示\n6.Text Designer中文字也可顯示 Text Designer中文字也可顯示\n7.Text Designer中文字也可顯示\n8.Text Designer中文字也可顯示\n9.Text Designer中文字也可顯示\n10.Text Designer中文字也可顯示";
	int nStrLen = wcslen(pszbuf);

	if (m_techType & LayeredWindow_TechType_D2D)
	{
		//m_pWin.pD2D->BeginDraw();
		m_pWin.pD2D->m_pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::White,0.5));
		//m_pWin.pD2D->m_pRenderTarget->DrawText(pszbuf,nStrLen,
		//
		//	IFR(m_spDWriteFactory->CreateTextFormat(
		//	msc_fontName,
		//	NULL,
		//	DWRITE_FONT_WEIGHT_NORMAL,
		//	DWRITE_FONT_STYLE_NORMAL,
		//	DWRITE_FONT_STRETCH_NORMAL,
		//	msc_fontSize,
		//	L"", //locale
		//	&m_spTextFormat
		//	));

		//// Center the text both horizontally and vertically.
		//m_spTextFormat->SetTextAlignment(
		//	DWRITE_TEXT_ALIGNMENT_CENTER
		//	);

		//m_spTextFormat->SetParagraphAlignment(
		//	DWRITE_PARAGRAPH_ALIGNMENT_CENTER
		//	);

		//m_pWin.pD2D->m_pRenderTarget->DrawText(
		//	pszbuf,nStrLen,
		//	m_spTextFormat,
		//	D2D1::RectF(
		//	0,0,rtSize.width, rtSize.height
		//	),
		//	m_spBlackBrush
		//	);)
		//m_pWin.pD2D->EndDraw();
	}
	else if (m_techType & LayeredWindow_TechType_GDI)
	{
		//m_pWin.pGDI->BeginDraw();
		//Gdiplus::Graphics graphics( m_pBitmap->GetDC() ); //#MOD
		m_pWin.pGDI->m_pGraphics->Clear( Gdiplus::Color( 128, 255, 255, 255 ) );


		Gdiplus::FontFamily fontFamily(L"微軟正黑體");
		Gdiplus::Font oMS( &fontFamily, 32, Gdiplus::FontStyle::FontStyleRegular, Gdiplus::Unit::UnitPixel );
		Gdiplus::StringFormat strformat;


		Gdiplus::GraphicsPath *Path;
		Gdiplus::GraphicsPath path;
		//		Region *aRegion;
		Gdiplus::RectF rectf;
		
		rectf.X = 10;
		rectf.Y = 10;
		rectf.Width = 500;
		rectf.Height = 500;


		path.AddString(pszbuf, nStrLen, &fontFamily, 
			Gdiplus::FontStyleRegular, 32,rectf,&strformat );

		Gdiplus::SolidBrush brush(Gdiplus::Color(255,100,255));
		m_pWin.pGDI->m_pGraphics->FillPath(&brush, &path);

		//SelectObject(m_bitmap.m_hdc, m_bitmap.m_bitmap);
		//m_pWin.pGDI->EndDraw();
	}

}