当前位置: 首页>>代码示例>>C++>>正文


C++ Canvas::ResetTransform方法代码示例

本文整理汇总了C++中gfx::Canvas::ResetTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Canvas::ResetTransform方法的具体用法?C++ Canvas::ResetTransform怎么用?C++ Canvas::ResetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gfx::Canvas的用法示例。


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

示例1: DrawString


//.........这里部分代码省略.........
					else
					{
						w = rect->Width;
					}

					h = (REAL)meterRect.Height;
				}
			}
			else
			{
				if (m_ClipStringW == -1)
				{
					// Clip text if already larger than ClipStringH
					if (m_ClipStringH != -1 && rect->Height > (REAL)m_ClipStringH)
					{
						m_NeedsClipping = true;
						rect->Height = (REAL)m_ClipStringH;
					}

					updateSize = false;
				}
				else
				{
					if (rect->Width > (REAL)m_ClipStringW)
					{
						w = (REAL)m_ClipStringW;
						m_NeedsClipping = true;
					}
					else
					{
						w = rect->Width;
					}

					h = rect->Height;
				}
			}

			if (updateSize)
			{
				UINT lines = 0;
				RectF layout((REAL)meterRect.X, (REAL)meterRect.Y, w, h);
				if (canvas.MeasureTextLinesW(string, stringLen, *m_TextFormat, layout, lines) &&
					lines != 0)
				{
					rect->Width = w;
					rect->Height = layout.Height;

					if (m_HDefined || (m_ClipStringH != -1 && rect->Height > (REAL)m_ClipStringH))
					{
						rect->Height = m_HDefined ? (REAL)meterRect.Height : (REAL)m_ClipStringH;
					}
				}
			}
		}
	}
	else
	{
		RectF rcDest((REAL)meterRect.X, (REAL)meterRect.Y, (REAL)meterRect.Width, (REAL)meterRect.Height);
		m_Rect = rcDest;

		if (m_Angle != 0.0f)
		{
			const float baseX = (float)Meter::GetX();
			canvas.RotateTransform(CONVERT_TO_DEGREES(m_Angle), baseX, (REAL)meterRect.Y, -baseX, -(REAL)meterRect.Y);
		}

		if (m_Effect != EFFECT_NONE)
		{
			SolidBrush solidBrush(m_EffectColor);
			RectF rcEffect(rcDest);

			if (m_Effect == EFFECT_SHADOW)
			{
				rcEffect.Offset(1, 1);
				canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
			}
			else  //if (m_Effect == EFFECT_BORDER)
			{
				rcEffect.Offset(0, 1);
				canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
				rcEffect.Offset(1, -1);
				canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
				rcEffect.Offset(-1, -1);
				canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
				rcEffect.Offset(-1, 1);
				canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
			}
		}

		SolidBrush solidBrush(m_Color);
		canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcDest, solidBrush);

		if (m_Angle != 0.0f)
		{
			canvas.ResetTransform();
		}
	}

	return true;
}
开发者ID:AlonTzarafi,项目名称:rainmeter,代码行数:101,代码来源:MeterString.cpp


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