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


C# Format类代码示例

本文整理汇总了C#中Format的典型用法代码示例。如果您正苦于以下问题:C# Format类的具体用法?C# Format怎么用?C# Format使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Format类属于命名空间,在下文中一共展示了Format类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BlurComponent

        public BlurComponent(Device graphics, int size)
        {
            _graphics = graphics;

            Dims = size;
            Format = Format.A8R8G8B8;

            _sampleOffsetsHoriz = new Vector4D[SampleCount];
            _sampleOffsetsVert = new Vector4D[SampleCount];

            _sampleWeightsHoriz = new float[SampleCount];
            _sampleWeightsVert = new float[SampleCount];

            int width = Dims - 5;
            int height = Dims - 5;

            SetBlurEffectParameters(1.0f / width, 0, ref _sampleOffsetsHoriz, ref _sampleWeightsHoriz);
            SetBlurEffectParameters(0, 1.0f / height, ref _sampleOffsetsVert, ref _sampleWeightsVert);

            _effect = new GaussianBlurEffect(_graphics);

            OutputTexture = new Texture(_graphics, Dims, Dims, 1, Usage.RenderTarget, Format, Pool.Default);
            _intermediateTexture = new Texture(_graphics, Dims, Dims, 1, Usage.RenderTarget, Format, Pool.Default);

            _sprite = new Sprite(_graphics);
        }
开发者ID:tgjones,项目名称:meshellator,代码行数:26,代码来源:BlurComponent.cs

示例2: DisplayMode

 /// <summary>Initializes a new instance of the <see cref="DisplayMode"/> class.</summary>
 /// <param name="pixelFormat">The pixel format.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="refreshRate">The refresh rate.</param>
 public DisplayMode(Format pixelFormat, int width, int height, Rational refreshRate)
 {
     this.pixelFormat = pixelFormat;
     this.width = width;
     this.height = height;
     this.refreshRate = refreshRate;
 }
开发者ID:GrafSeismo,项目名称:SharpDX,代码行数:12,代码来源:DisplayMode.cs

示例3: D3DDevice

        public D3DDevice(IntPtr windowPtr, bool bWindowed, long Width, long Height)
        {
            m_bWindowed = bWindowed;
            m_Format = Find16BitMode();

            PresentParameters presentParameters		 = new PresentParameters();
            presentParameters.Windowed				 = m_bWindowed;
            presentParameters.SwapEffect			 = SwapEffect.Discard;
            presentParameters.BackBufferCount		 = 1;
            presentParameters.PresentationInterval	 = PresentInterval.Immediate;
            presentParameters.AutoDepthStencilFormat = DepthFormat.D16;
            presentParameters.EnableAutoDepthStencil = true;

            if(!bWindowed)
            {
                presentParameters.BackBufferFormat	= m_Format;
                presentParameters.BackBufferWidth	= (int)Width;
                presentParameters.BackBufferHeight	= (int)Height;
            }
            else
            {
                presentParameters.BackBufferFormat	= Format.Unknown;
                presentParameters.BackBufferWidth	= (int)Width;
                presentParameters.BackBufferHeight	= (int)Height;
            }

            m_D3DDevice = new Microsoft.DirectX.Direct3D.Device(0,
                DeviceType.Hardware, windowPtr,
                CreateFlags.SoftwareVertexProcessing, presentParameters);
        }
开发者ID:andrewgbliss,项目名称:CS_DXMAN,代码行数:30,代码来源:D3DDevice.cs

示例4: Clear

        internal void Clear()
        {
            m_deviceContext.ClearState();

            m_inputLayout = null;
            m_primitiveTopology = PrimitiveTopology.Undefined;
            m_indexBufferRef = null;
            m_indexBufferFormat = Format.Unknown;
            m_indexBufferOffset = 0;
            for (int i = 0; i < m_vertexBuffers.Length; i++)
                m_vertexBuffers[i] = null;
            for (int i = 0; i < m_vertexBuffersStrides.Length; i++)
                m_vertexBuffersStrides[i] = 0;

            m_blendState = null;
            m_stencilRef = 0;
            m_depthStencilState = null;
            m_rtvsCount = 0;
            for (int i = 0; i < m_rtvs.Length; i++)
                m_rtvs[i] = null;
            m_dsv = null;

            m_rasterizerState = null;
            m_scissorLeftTop = new Vector2I(-1, -1);
            m_scissorRightBottom = new Vector2I(-1, -1);
            m_viewport = default(RawViewportF);

            m_targetBuffer = null;
            m_targetOffsets = 0;

            m_statistics.ClearStates++;
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:32,代码来源:MyRenderContextState.cs

示例5: GetAlphaChannelBits

 /// <summary>
 /// Gets the number of alpha channel bits.
 /// </summary>
 public static int GetAlphaChannelBits(Format format)
 {
   switch (format)
   {
     case Format.R8G8B8:
       return 0;
     case Format.A8R8G8B8:
       return 8;
     case Format.X8R8G8B8:
       return 0;
     case Format.R5G6B5:
       return 0;
     case Format.X1R5G5B5:
       return 0;
     case Format.A1R5G5B5:
       return 1;
     case Format.A4R4G4B4:
       return 4;
     case Format.R3G3B2:
       return 0;
     case Format.A8R3G3B2:
       return 8;
     case Format.X4R4G4B4:
       return 0;
     case Format.A2B10G10R10:
       return 2;
     case Format.A2R10G10B10:
       return 2;
     default:
       return 0;
   }
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:35,代码来源:d3dutil.cs

示例6: EvaluateFormat

        public void EvaluateFormat(object current, Format format, ref bool handled, IOutput output, FormatDetails formatDetails)
        {
            if (format != null && format.HasNested) return;
            var formatText = format != null ? format.Text : "";
            TimeSpan fromTime;
            if (current is TimeSpan)
            {
                fromTime = (TimeSpan)current;
            }
            else if (current is DateTime && formatText.StartsWith("timestring"))
            {
                formatText = formatText.Substring(10);
                fromTime = DateTime.Now.Subtract((DateTime)current);
            }
            else
            {
                return;
            }
            var timeTextInfo = GetTimeTextInfo(formatDetails.Provider);
            if (timeTextInfo == null)
            {
                return;
            }
            var formattingOptions = TimeSpanFormatOptionsConverter.Parse(formatText);
            var timeString = TimeSpanUtility.ToTimeString(fromTime, formattingOptions, timeTextInfo);
            output.Write(timeString, formatDetails);
            handled = true;

        }
开发者ID:Avatarchik,项目名称:AnimatorAccess,代码行数:29,代码来源:TimeFormatter.cs

示例7: Inflate

 /// <summary>
 /// Inflate the data with the given format stored in a buffer
 /// </summary>
 /// <param name="buffer">A view with the encoded data</param>
 /// <param name="format">An inflated format object</param>
 /// <returns>Return null, an ArrayList or a single value (ulong, long, float, Token or string)</returns>
 internal static object Inflate(BufferView buffer, Format format)
 {
     ArrayList data = new ArrayList();
     if (InflateData.ReadElement(buffer, data, format.Root).Length != 0)
         throw new ArgumentException("Unable to read data in the given format");
     return data.Count == 0 ? null : (data.Count == 1 ? data[0] : data);
 }
开发者ID:sitegui,项目名称:asyncProtocol,代码行数:13,代码来源:InflateData.cs

示例8: FormattingInfo

		public FormattingInfo(FormattingInfo parent, FormatDetails formatDetails, Format format, object currentValue)
		{
			this.Parent = parent;
			CurrentValue = currentValue;
			Format = format;
			FormatDetails = formatDetails;
		}
开发者ID:WildGenie,项目名称:SmartFormat.NET,代码行数:7,代码来源:FormattingInfo.cs

示例9: Decompress

 public static byte[] Decompress(int width, int height, byte[] source, Format format)
 {
     using (var strm = new MemoryStream(source))
     {
         return Decompress(width, height, new BinaryReader(strm), format);
     }
 }
开发者ID:Linrasis,项目名称:WoWEditor,代码行数:7,代码来源:DxtHelper.cs

示例10: Consumer

        public Consumer(string host, string groupName, string instanceId, Format format, string offset = "smallest")
        {
            this.host = host;
            this.groupName = groupName;
            this.instanceId = instanceId;
            this.format = format;

            var contentType = "application/vnd.kafka.v1+json";
            var data = new Dictionary<string, string>
            {
                {"name", instanceId},
                {"format", format.ToString().ToLower()},
                {"auto.offset.reset", offset}
            };
            try
            {
                var responseString = WebRequestHelper.Post(host, $"consumers/{groupName}", JsonConvert.SerializeObject(data),
                    contentType);
                dynamic response = JsonConvert.DeserializeObject<dynamic>(responseString);
                this.instanceId = response.instance_id.ToObject<string>();
                baseUri = response.base_uri.ToObject<string>();
            }
            catch (Exception e)
            {
                // it means, that consumer with this name already exists
                log.Warn(e.Message);
                baseUri = $"{host}/consumers/{groupName}/instances/{instanceId}";
            }
        }
开发者ID:fakefeik,项目名称:KafkaClient,代码行数:29,代码来源:Consumer.cs

示例11: VertexElementAttribute

 /// <summary>
 /// Initializes a new instance of the <see cref="VertexElement" /> struct.
 /// </summary>
 /// <param name="semanticName">Name of the semantic.</param>
 /// <param name="semanticIndex">Index of the semantic.</param>
 /// <param name="format">The format.</param>
 /// <param name="alignedByteOffset">The aligned byte offset.</param>
 public VertexElementAttribute(string semanticName, int semanticIndex, Format format, int alignedByteOffset = VertexElement.AppendAligned)
 {
     this.semanticName = semanticName;
     this.semanticIndex = semanticIndex;
     this.format = format;
     this.alignedByteOffset = alignedByteOffset;
 }
开发者ID:chantsunman,项目名称:Toolkit,代码行数:14,代码来源:VertexElementAttribute.cs

示例12: GetContentType

        public static string GetContentType(Format formats)
        {
            switch (formats)
            {
                case Format.Soap11:
                case Format.Soap12:
                case Format.Xml:
                    return Xml;

                case Format.Json:
                    return Json;

                case Format.Jsv:
                    return JsvText;

                case Format.Csv:
                    return Csv;

                case Format.ProtoBuf:
                    return ProtoBuf;

                case Format.MsgPack:
                    return MsgPack;

                default:
                    return null;
            }
        }
开发者ID:namman,项目名称:ServiceStack,代码行数:28,代码来源:ContentType.cs

示例13: OnGUI

    void OnGUI()
    {
        GUILayout.BeginHorizontal();
            GUI.enabled = m_Format != Format.Pretty;
            if( GUILayout.Button ("PrettyFormat") )
            {
                m_Format = Format.Pretty;
            }

            GUI.enabled = m_Format != Format.Plain;
            if( GUILayout.Button ("Plain Format") )
            {
                m_Format = Format.Plain;
            }
        GUILayout.EndHorizontal();

        GUI.enabled = true;
        if( GUILayout.Button("Serialize", GUILayout.Height (100)) )
        {
            _TestSerialInfo();
        }

        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width (Screen.width-200));
        if( m_str1.Length > 0)
        {
            GUILayout.TextArea(m_str1);
        }
        GUILayout.EndScrollView();
    }
开发者ID:TMPxyz,项目名称:LitJSON-for-Unity,代码行数:29,代码来源:LitJSONTest.cs

示例14: CompressedImageSize

 public static int CompressedImageSize(Format format, int width, int height, int depth, int byteAlignment)
 {
     int rowPitch, slicePitch, totalSize;
     switch (format)
     {
         case Format.CompressedRgbaS3tcDxt1Ext:
         case Format.CompressedSrgbAlphaS3tcDxt1Ext:
         case Format.CompressedRedRgtc1: // bc4
         case Format.CompressedSignedRedRgtc1:
             TextureHelper.GetInfoForSetDataCompressed(4, width, height, depth, byteAlignment, out rowPitch, out slicePitch, out totalSize);
             return totalSize;
         case Format.CompressedRgbaS3tcDxt3Ext:
         case Format.CompressedSrgbAlphaS3tcDxt3Ext:
         case Format.CompressedRgbaS3tcDxt5Ext:
         case Format.CompressedSrgbAlphaS3tcDxt5Ext:
         case Format.CompressedRgRgtc2:
         case Format.CompressedSignedRgRgtc2:
         case Format.CompressedRgbaBptcUf:
         case Format.CompressedRgbaBptcSf:
         case Format.CompressedRgbaBptc:
         case Format.CompressedSrgbAlphaBptc:
             TextureHelper.GetInfoForSetDataCompressed(8, width, height, depth, byteAlignment, out rowPitch, out slicePitch, out totalSize);
             return totalSize;
         default:
             throw new InvalidOperationException(string.Format("Format '{0}' is not a known compressed format", format));
     }
 }
开发者ID:Zulkir,项目名称:Beholder,代码行数:27,代码来源:LocalHelpers.cs

示例15: SqlUserDefinedTypeAttribute

		public SqlUserDefinedTypeAttribute (Format f)
		{
			Format = f;
			IsByteOrdered = false;
			IsFixedLength = false;
			MaxByteSize = MaxByteSizeValue;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SqlUserDefinedTypeAttribute.cs


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