本文整理汇总了C#中Color.ToBgra方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToBgra方法的具体用法?C# Color.ToBgra怎么用?C# Color.ToBgra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color.ToBgra方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetMarker
/// <summary>
/// Mark an instantaneous event. PIX can use this event to trigger an action.
/// </summary>
/// <param name="color">The color.</param>
/// <param name="name">The name to format.</param>
/// <param name="parameters">The parameters to use to format the name.</param>
/// <unmanaged>D3DPERF_SetMarker</unmanaged>
public static void SetMarker(Color color, string name, params object[] parameters)
{
D3DPERF_SetMarker(color.ToBgra(), string.Format(name, parameters));
}
示例2: BeginEvent
/// <summary>
/// Marks the beginning of a user-defined event. PIX can use this event to trigger an action.
/// </summary>
/// <param name="color">The Event color.</param>
/// <param name="name">The Event formatted Name.</param>
/// <param name="parameters">The parameters to use for the formatted name.</param>
/// <returns>
/// The zero-based level of the hierarchy that this event is starting in. If an error occurs, the return value will be negative.
/// </returns>
/// <unmanaged>D3DPERF_BeginEvent</unmanaged>
public static int BeginEvent(Color color, string name, params object[] parameters)
{
return D3DPERF_BeginEvent(color.ToBgra(), string.Format(name, parameters));
}
示例3: StartRender
protected override bool StartRender(RenderContext renderContext, Color borderColor, Vector4 frameData)
{
if (_effect == null || _lastTexture == null)
return false;
// Apply effect parameters
_effect.Parameters[PARAM_OPACITY] = (float) renderContext.Opacity;
_effect.Parameters[PARAM_FRAME_DATA] = frameData;
_effect.Parameters[PARAM_RELATIVE_TRANSFORM] = _inverseRelativeTransformCache;
_effect.Parameters[PARAM_BRUSH_TRANSFORM] = _imageTransform;
if (_extraParameters != null)
foreach (KeyValuePair<string, object> pair in _extraParameters)
_effect.Parameters[pair.Key] = pair.Value;
// Disable antialiasing for image rendering.
GraphicsDevice.Device.SetRenderState(RenderState.MultisampleAntialias, false);
// Set border colour for area outside of texture boundaries
GraphicsDevice.Device.SetSamplerState(0, SamplerState.BorderColor, borderColor.ToBgra());
// Render
_effect.StartRender(_lastTexture, renderContext.Transform);
return true;
}
示例4: StartRenderTransition
/// <summary>
/// Starts a rendering operation where two images are mixed together using a transition effect.
/// </summary>
/// <param name="renderContext">The current rendering context.</param>
/// <param name="mixValue">A value between 0.0 and 1.0 that governs how much each image contributes to the final rendering.</param>
/// <param name="startContext">The <see cref="ImageContext"/> data for the starting position of the transition
/// (this context is the end point).</param>
/// <param name="targetEndImageSize">The size, the final end image should take within the frame. This size is given in the same
/// orientation as the <paramref name="endTexture"/>, i.e. it is not rotated.</param>
/// <param name="endTexture">A texture object containing the end image.</param>
/// <param name="endTextureClip">The section of the end texture that should be rendered. Values are between 0 and 1.</param>
/// <param name="borderColor">The color to use outside the image's boundaries.</param>
/// <param name="startFrameData">Additional data to be used by the starting image shaders.</param>
/// <param name="endFrameData">Additional data to be used by the ending image shaders.</param>
/// <returns><c>true</c> if the rendering operation was started.</returns>
public bool StartRenderTransition(RenderContext renderContext, float mixValue, ImageContext startContext,
SizeF targetEndImageSize, Texture endTexture, RectangleF endTextureClip, Color borderColor, Vector4 startFrameData, Vector4 endFrameData)
{
RefreshParameters(targetEndImageSize, endTexture, endTextureClip);
if (_effectTransition == null)
_effectTransition = ContentManager.Instance.GetEffect(GetTransitionEffectName());
if (_lastTexture == null || _effectTransition == null)
return false;
// Apply effect parameters
_effectTransition.Parameters[PARAM_OPACITY] = (float) renderContext.Opacity;
_effectTransition.Parameters[PARAM_RELATIVE_TRANSFORM] = _inverseRelativeTransformCache;
_effectTransition.Parameters[PARAM_BRUSH_TRANSFORM] = _imageTransform;
_effectTransition.Parameters[PARAM_FRAME_DATA] = endFrameData;
_effectTransition.Parameters[PARAM_MIX_AB] = mixValue;
startContext.ApplyTransitionParametersAsStartingSource(_effectTransition, startFrameData);
// Disable antialiasing for image rendering.
GraphicsDevice.Device.SetRenderState(RenderState.MultisampleAntialias, false);
// Set border colour for area outside of texture boundaries
GraphicsDevice.Device.SetSamplerState(0, SamplerState.BorderColor, borderColor.ToBgra());
GraphicsDevice.Device.SetSamplerState(1, SamplerState.BorderColor, borderColor.ToBgra());
// Render
_effectTransition.StartRender(_lastTexture, renderContext.Transform);
return true;
}