當前位置: 首頁>>代碼示例>>C#>>正文


C# Color.ToBgra方法代碼示例

本文整理匯總了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));
 }
開發者ID:QuantumDeveloper,項目名稱:SharpDX,代碼行數:11,代碼來源:PixHelper.cs

示例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));
 }
開發者ID:QuantumDeveloper,項目名稱:SharpDX,代碼行數:14,代碼來源:PixHelper.cs

示例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;
    }
開發者ID:BigGranu,項目名稱:MediaPortal-2,代碼行數:25,代碼來源:ImageContext.cs

示例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;
    }
開發者ID:BigGranu,項目名稱:MediaPortal-2,代碼行數:44,代碼來源:ImageContext.cs


注:本文中的Color.ToBgra方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。