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


C++ Style::GetOpacity方法代码示例

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


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

示例1: OutputStyles


//.........这里部分代码省略.........
	if (witch & STYLE_STROKE_LINEJOIN )
	{
		JointType jt;
		if (style.IsStrokeLineJoinDefined()) {
			jt=style.GetStrokeLineJoin();

#if SVGDEBUG
			switch(jt)
			{
				case MitreJoin:
					svgtrace(DBGTRACE_STYLES, "stroke join mitre\n");
				break;
				case BevelledJoin:
					svgtrace(DBGTRACE_STYLES, "stroke join bevel\n");
				break;
				case RoundJoin:
					svgtrace(DBGTRACE_STYLES, "stroke join round\n");
				break;
			}
#endif
		} else {
			jt=MitreJoin;

#if SVGDEBUG
			svgtrace(DBGTRACE_STYLES, "no stroke specified, using mitre\n");
#endif

		}

		Rec.Reinit(TAG_JOINSTYLE, TAG_JOINSTYLE_SIZE);
		ok = Rec.WriteBYTE(BYTE(jt));
		ok = m_pExporter->WriteRecord(&Rec);

	}

	if (witch & STYLE_STROKE_LINECAP && style.IsStrokeLineCapDefined()) {
		LineCapType lct=style.GetStrokeLineCap();
		Rec.Reinit(TAG_STARTCAP, TAG_STARTCAP_SIZE);
		ok = Rec.WriteBYTE(BYTE(lct));
		ok = m_pExporter->WriteRecord(&Rec);

		Rec.Reinit(TAG_ENDCAP, TAG_ENDCAP_SIZE);
		ok = Rec.WriteBYTE(BYTE(lct));
		ok = m_pExporter->WriteRecord(&Rec);

#if SVGDEBUG
		switch(lct)
		{
			case LineCapButt:
				svgtrace(DBGTRACE_STYLES, "stroke cap butt\n");
			break;
			case LineCapRound:
				svgtrace(DBGTRACE_STYLES, "stroke cap round\n");
			break;
			case LineCapSquare:
				svgtrace(DBGTRACE_STYLES, "stroke cap square\n");
			break;
		}
#endif

	}

	if (witch & STYLE_STROKE_OPACITY && style.IsStrokeOpacityDefined()) {
		double opacity = style.GetStrokeOpacity();
		if (opacity < 1.0) {
			BYTE bOpacity = (BYTE)((1.0-opacity)*255.0);
			Rec.Reinit(TAG_LINETRANSPARENCY, TAG_LINETRANSPARENCY_SIZE);
			ok = Rec.WriteBYTE(bOpacity);
			ok = Rec.WriteBYTE(0x01); // mix
			ok = m_pExporter->WriteRecord(&Rec);
		}
	}

	if (witch & STYLE_OPACITY && style.IsOpacityDefined()) {
		double fOpacity = style.GetOpacity();
		if (fOpacity < 1.0) {
			double fFillOpacity = fOpacity;
			double fStrokeOpacity = fOpacity;

			if (style.IsFillOpacityDefined())
				fFillOpacity *= style.GetFillOpacity();
			if (style.IsStrokeOpacityDefined())
				fStrokeOpacity *= style.GetStrokeOpacity();

			BYTE bFillOpacity   = (BYTE)((1.0-fFillOpacity)*255.0);
			BYTE bStrokeOpacity = (BYTE)((1.0-fStrokeOpacity)*255.0);

			Rec.Reinit(TAG_FLATTRANSPARENTFILL, TAG_FLATTRANSPARENTFILL_SIZE);
			ok = Rec.WriteBYTE(bFillOpacity);
			ok = Rec.WriteBYTE(0x01); // mix
			ok = m_pExporter->WriteRecord(&Rec);
			Rec.Reinit(TAG_LINETRANSPARENCY, TAG_LINETRANSPARENCY_SIZE);
			ok = Rec.WriteBYTE(bStrokeOpacity);
			ok = Rec.WriteBYTE(0x01); // mix
			ok = m_pExporter->WriteRecord(&Rec);
		}
	}

	return ok;
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:101,代码来源:xargenerator.cpp


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