• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ColorType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetBytes

 public static byte[] GetBytes(Color color, ColorType type)
 {
     switch (type)
     {
         case ColorType.ARGB8888_32:
             return ByteConverter.GetBytes(color.ToArgb());
         case ColorType.XRGB8888_32:
             color = Color.FromArgb(0, color);
             goto case ColorType.ARGB8888_32;
         case ColorType.ARGB8888_16:
         {
             byte[] result = new byte[4];
             int i = color.ToArgb();
             ByteConverter.GetBytes((ushort)(i & 0xFFFF)).CopyTo(result, 0);
             ByteConverter.GetBytes((ushort)((i >> 16) & 0xFFFF)).CopyTo(result, 2);
             return result;
         }
         case ColorType.XRGB8888_16:
             color = Color.FromArgb(0, color);
             goto case ColorType.ARGB8888_16;
         case ColorType.ARGB4444:
             return ByteConverter.GetBytes((ushort)(((color.A >> 4) << 12) | ((color.R >> 4) << 8) | ((color.G >> 4) << 4) | (color.B >> 4)));
         case ColorType.RGB565:
             return ByteConverter.GetBytes((ushort)(((color.R >> 3) << 11) | ((color.G >> 2) << 5) | (color.B >> 3)));
     }
     throw new ArgumentOutOfRangeException("type");
 }
开发者ID:Radfordhound,项目名称:sa_tools,代码行数:27,代码来源:VColor.cs


示例2: FlipTurn

 private void FlipTurn()
 {
     if (turn == ColorType.WHITE)
         turn = ColorType.BLACK;
     else
         turn = ColorType.WHITE;
 }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:7,代码来源:ChessGamePlayer.cs


示例3: OnTriggerEnter2D

    public void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.transform.CompareTag("Player"))
        {
            DestoryEvent();
            GameLogic.Instance.Hit(20);
        }
        if (collision.transform.CompareTag("Bullet"))
        {
            if (ColorManager.Instance.IsColorCollision(collision.GetComponent<Bullet>().myColor,enemyColor))
            {
                ColorType temp;
                temp = ColorManager.Instance.CheckMixColor(enemyColor,collision.GetComponent<Bullet>().myColor);
                GameLogic.Instance.AddScore(10);
                Debug.Log(temp);
                if (temp == enemyColor)
                {
                    DestoryEvent();
                }
                else
                {
                    enemyColor = temp;
                    ChangeColor(enemyColor);
                }
                
            }
            else
                GameLogic.Instance.Hit(10);


        }
    }
开发者ID:Youngchangoon,项目名称:ColorCannon,代码行数:32,代码来源:Enemy.cs


示例4: NumberSprite

 // if numDigits = 0, don't care how much space it takes up
 private NumberSprite(ContentManager Content, int number, int numDigits, ColorType color, OperatorType op)
 {
     this.Content = Content;
     this.number = number;
     this.numDigits = numDigits;
     this.color = color;
     this.op = op;
 }
开发者ID:coler706,项目名称:CaveStory,代码行数:9,代码来源:NumberSprite.cs


示例5: TextDecoration

 private TextDecoration(ColorType ctbg, Color bg, ColorType cttxt, Color txt, bool underline, bool bold) {
     _bgColor = bg;
     _bgColorType = ctbg;
     _textColor = txt;
     _textColorType = cttxt;
     _underline = underline;
     _bold = bold;
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:8,代码来源:TextDecoration.cs


示例6: SetColorPalette

 public static void SetColorPalette(Entity entity, ColorType color)
 {
     if (entity.HasComponent<Sprite>())
     {
         ColorTypeAttribute attr = color.GetAttributeOfType<ColorTypeAttribute>();
         entity.GetComponent<Sprite>().SetColorOverride(attr.Red, attr.Green, attr.Blue, attr.Alpha);
     }
 }
开发者ID:zunath,项目名称:MMXEngine,代码行数:8,代码来源:SpriteMethods.cs


示例7: ColorComboBox

 public ColorComboBox()
 {
   SetComboBoxProperties(this);
   _contextStrip = new ContextMenuStrip();
   FillMenu();
   this.ContextMenuStrip = _contextStrip;
   _colorType = ColorType.KnownAndSystemColor;
 }
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:ColorComboBox.cs


示例8: PngHeader

 /// <summary>
 /// Creates a new instance of PngHeader
 /// </summary>
 public PngHeader(int width, int height)
 {
     _width = width;
     _height = height;
     _bitdepth = BitDepth.Eight;
     _colortype = ColorType.TruecolorAlpha;
     _interlaceMethod = InterlaceMethod.NoInterlacing;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:11,代码来源:PngHeader.cs


示例9: Field

 /// <summary>
 /// Field constructor that takes an IPosition object as argument
 /// </summary>
 /// <param name="position">The position for the current IField object</param>
 /// <param name="color">The color for the current IField object</param>
 /// <param name="chessBoard">The chess board for the current IField object</param>
 protected Field(IPosition position, ColorType color, IChessBoard chessBoard)
 {
     this.ChessBoard = chessBoard;
     this.Position = position;
     this.Color = color;
     this.HasChessPiece = false;
     this.IsDrawable = true;
 }
开发者ID:BadassGamingCrew,项目名称:Chess-Might-and-Magic,代码行数:14,代码来源:Field.cs


示例10: ToIndex

		static int ToIndex(ColorType colorType) {
			if (ColorType.FirstNR <= colorType && colorType < ColorType.LastNR)
				return (int)(colorType - ColorType.FirstNR);
			if (ColorType.FirstUI <= colorType && colorType < ColorType.LastUI)
				return (int)(colorType - ColorType.FirstUI + ColorType.LastNR - ColorType.FirstNR);
			Debug.Fail(string.Format("Invalid color: {0}", colorType));
			return 0;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:Theme.cs


示例11: Rook

            public Rook(ColorType color, int rank, int file,
				     ChessSide myside,
				     ChessSide oppside)
                : base(PieceType.ROOK,
							      color, rank,
							      file, myside,
							      oppside)
            {
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:9,代码来源:Rook.cs


示例12: Pawn

            public Pawn(ColorType color, int rank, int file,
				     ChessSide myside,
				     ChessSide oppside)
                : base(PieceType.PAWN,
							      color, rank,
							      file, myside,
							      oppside)
            {
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:9,代码来源:Pawn.cs


示例13: Block

 public Block(int x1, int y1, int x2, int y2, ColorType color)
 {
     this.x1 = x1;
     this.x2 = x2;
     this.y1 = y1;
     this.y2 = y2;
     this.color = color;
     this.ID = null;
 }
开发者ID:marce155,项目名称:Tetris-Csharp,代码行数:9,代码来源:Block.cs


示例14: Coloration

 //    : this(colorType, pallet.ToList())
 //{
 //}
 //public Coloration(ColorType colorType, IEnumerable<Color> pallet)
 public Coloration(ColorType colorType, params Color[] pallet)
 {
     if (pallet == null || pallet.Length == 0)
     {
         throw new InvalidOperationException("The pallet cannot be empty.");
     }
     this._ColorType = colorType;
     this.SetSourcePallet(pallet);
 }
开发者ID:alexsharoff,项目名称:wpf-office-theme,代码行数:13,代码来源:Coloration.cs


示例15: King

            public King(ColorType color, int rank, int file,
				     ChessSide myside,
				     ChessSide oppside)
                : base(PieceType.KING,
							      color, rank,
							      file, myside,
							      oppside)
            {
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:9,代码来源:King.cs


示例16: Queen

            public Queen(ColorType color, int rank, int file,
				      ChessSide myside,
				      ChessSide oppside)
                : base(PieceType.
							       QUEEN, color,
							       rank, file,
							       myside,
							       oppside)
            {
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:10,代码来源:Queen.cs


示例17: read

 internal void read(BigEndianBinaryReader reader)
 {
     width = reader.ReadInt32();
     height = reader.ReadInt32();
     bitdepth = reader.ReadByte();
     colortype = (ColorType)reader.ReadByte();
     method = reader.ReadByte();
     filter = reader.ReadByte();
     interlace = reader.ReadByte();
 }
开发者ID:Gayo,项目名称:Gayo-CAROT,代码行数:10,代码来源:png.cs


示例18: Bishop

            public Bishop(ColorType color, int rank, int file,
				       ChessSide myside,
				       ChessSide oppside)
                : base(PieceType.
								BISHOP, color,
								rank, file,
								myside,
								oppside)
            {
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:10,代码来源:Bishop.cs


示例19: Knight

            public Knight(ColorType color, int rank, int file,
				       ChessSide myside,
				       ChessSide oppside)
                : base(PieceType.
								KNIGHT, color,
								rank, file,
								myside,
								oppside)
            {
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:10,代码来源:Knight.cs


示例20: Ihdr

        public Ihdr(UInt32 width, UInt32 height, BitDepth bitDepth, ColorType colorType, CompressionMethod compressionMethod = CompressionMethod.Default, FilterMethod filterMethod = FilterMethod.Default, InterlaceMethod interlaceMethod = InterlaceMethod.None)
            : base(ChunkType.IHDR)
        {
            #region Sanity
            if(width == 0 || width > Int32.MaxValue)
                throw new ArgumentOutOfRangeException("width", "width must be greater than 0 and smaller than In32.MaxValue(2^31-1)");
            if(height == 0 || height > Int32.MaxValue)
                throw new ArgumentOutOfRangeException("height", "height must be greater than 0 and smaller than In32.MaxValue(2^31-1)");

            BitDepth[] allowedBitDepths;
            switch (colorType)
                {
                case ColorType.Grayscale:
                    if(!(allowedBitDepths = new[] { BitDepth._1, BitDepth._2, BitDepth._4, BitDepth._8, BitDepth._16 }).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.Rgb:
                    if(!(allowedBitDepths = new[]{BitDepth._8, BitDepth._16}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.Palette:
                    if(!(allowedBitDepths = new[] { BitDepth._1, BitDepth._2, BitDepth._4, BitDepth._8}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.GrayscaleWithAlpha:
                    if(!(allowedBitDepths = new[] { BitDepth._8, BitDepth._16}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.Rgba:
                    if(!(allowedBitDepths = new[] { BitDepth._8, BitDepth._16}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                default:
                    throw new ArgumentOutOfRangeException("colorType", String.Format("Unknown colorType: {0}", colorType));
                }

            if(compressionMethod != CompressionMethod.Default)
                throw new ArgumentOutOfRangeException("compressionMethod", String.Format("Unknown compressionMethod: {0}", compressionMethod));
            if(filterMethod != FilterMethod.Default)
                throw new ArgumentOutOfRangeException("filterMethod", String.Format("Unknown filterMethod: {0}", filterMethod));

            var allowedInterlaceMethods = new[] {InterlaceMethod.None, InterlaceMethod.Adam7};
            if(!allowedInterlaceMethods.Contains(interlaceMethod))
                throw new ArgumentOutOfRangeException("interlaceMethod", String.Format("interlaceMethod must be one of {0}", allowedInterlaceMethods.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2))));

            #endregion

            Width = width;
            Height = height;
            BitDepth = bitDepth;
            ColorType = colorType;
            CompressionMethod = compressionMethod;
            FilterMethod = filterMethod;
            InterlaceMethod = interlaceMethod;
        }
开发者ID:Darcara,项目名称:LibApng,代码行数:55,代码来源:Ihdr.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ColorValue类代码示例发布时间:2022-05-24
下一篇:
C# ColorSetWindow类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap