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


C# System.Image类代码示例

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


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

示例1: GetUploadedImages

        public IEnumerable<Image> GetUploadedImages(HttpRequestBase request, params string[] imageDefinitionKeys)
        {
            List<Image> images = new List<Image>();

            foreach (string inputTagName in request.Files)
            {
                HttpPostedFileBase file = request.Files[inputTagName];
                if (file.ContentLength > 0)
                {
                    // upload the image to filesystem
                    if (IsNotImage(file))
                    {
                        throw new ValidationException(string.Format("File '{0}' is not an image file (*.jpg)", file.FileName));
                    }

                    Image image = new Image
                    {
                        FileName = Guid.NewGuid(),
                        Description = Path.GetFileName(file.FileName)
                    };

                    file.SaveAs(imageFileService.GetFullPath(image.FileNameAsString));

                    // convert the image to main and thumb sizes
                    imageService.CreateSizedImages(image, imageDefinitionKeys);

                    File.Delete(imageFileService.GetFullPath(image.FileNameAsString));

                    images.Add(image);
                }
            }

            return images;
        }
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:34,代码来源:HttpFileService.cs

示例2: ClubMemberViewCell

        public ClubMemberViewCell()
        {

            nameTGR = new TapGestureRecognizer();
            nameTGR.Tapped += NameTGR_Tapped;

            ch = new ColorHandler();
            iEmoji = new Image
            {
                Aspect = Aspect.AspectFit,
                WidthRequest = 75,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.Center
            };
            iEmoji.SetBinding(Image.SourceProperty, "Emoji");
            lUsername = new Label
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                VerticalOptions = LayoutOptions.Center
            };
            lUsername.SetBinding(Label.TextProperty, "Username");
            lUsername.SetBinding(Label.TextColorProperty, "UserColor", converter: new ColorConverter());
            lUsername.GestureRecognizers.Add(nameTGR);
            updateView();
        }
开发者ID:bpeck81,项目名称:Cloudclub_v1,代码行数:26,代码来源:ClubMemberViewCell.cs

示例3: Arrow

        public Arrow(Keys lastKey, object obj)
        {
            Image = new Image();
            switch (lastKey)
            {
                case Keys.W:
                    Image.Path = "Gameplay/Projectiles/arrow_up";
                    break;
                case Keys.S:
                    Image.Path = "Gameplay/Projectiles/arrow_down";
                    break;
                case Keys.A:
                    Image.Path = "Gameplay/Projectiles/arrow_left";
                    break;
                case Keys.D:
                    Image.Path = "Gameplay/Projectiles/arrow_right";
                    break;
            }

            DirectionKey = lastKey;

            if (obj.GetType() == typeof(Player))
            {
                Player p = (Player)obj;
                Image.Position = p.Image.Position;
            }
            MoveSpeed = 250f;
            Image.Scale = new Vector2(1, 2);
            Image.LoadContent();
        }
开发者ID:tmen13,项目名称:Avalon,代码行数:30,代码来源:Arrow.cs

示例4: InitializeComponents

        private void InitializeComponents()
        {
            StackLayout layout = new StackLayout ();

            nameLabel = new Label () {
                Text = client.Name,
                FontSize = 18,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( nameLabel );

            profileImage = new Image () {
                Source = client.PictureUrl,
                Aspect = Aspect.AspectFit
            };

            layout.Children.Add ( profileImage );

            phoneLabel = new Label () {
                Text = client.Phone,
                FontSize = 14,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( phoneLabel );

            Content = layout;
        }
开发者ID:nchicas,项目名称:Combinado,代码行数:29,代码来源:ClientDetailPage.UI.cs

示例5: LoadContent

        public override void LoadContent()
        {
            base.LoadContent();

            Image = new Image();
            Image.Path = "Gameplay/UI/loadingscreenanimation";
            //Image.SourceRect = new Rectangle(0, 0, 400, 100);
            //Image.Position = new Vector2 ((ScreenManager.Instance.GraphicsDevice.Viewport.Width / 2) - 100,
            //	(ScreenManager.Instance.GraphicsDevice.Viewport.Height / 2) - 100);
            Image.LoadContent();

            Image.SourceRect = new Rectangle(0, 0, 100, 100);
            //Image.Position = new Vector2 ((ScreenManager.Instance.GraphicsDevice.Viewport.Width / 2) - 100,
            //	(ScreenManager.Instance.GraphicsDevice.Viewport.Height / 2) - 100);

            Image.IsActive = true;
            Image.ActivateEffect ("SpriteSheetEffect");
            Image.SpriteSheetEffect.IsActive = true;
            /* Turn the fade effect off */
            Image.FadeEffect.IsActive = false;
            /* Make the player face the camera */
            Image.SpriteSheetEffect.SwitchFrame = 250;
            Image.SpriteSheetEffect.AmountOfFrames = new Vector2(4, 1);
            Image.SpriteSheetEffect.DefaultFrame = Vector2.Zero;
            Image.SpriteSheetEffect.CurrentFrame = Image.SpriteSheetEffect.DefaultFrame;

            Image.Position = new Vector2 (Image.Position.X - 50, Image.Position.Y - 50);
        }
开发者ID:nkruger311,项目名称:SongAdventureAndroid,代码行数:28,代码来源:LoadingScreen.cs

示例6: Cursor

 public Cursor(Image regular, Image clicked)
     : base(new Vector2(Mouse.GetState().X, Mouse.GetState().Y), regular)
 {
     Layer = int.MaxValue;
     Regular = regular; Clicked = clicked;
     Regular.Parallax = new Vector2(); Clicked.Parallax = new Vector2();
 }
开发者ID:Gnoll,项目名称:XNAPunk,代码行数:7,代码来源:Cursor.cs

示例7: TodoItemCell

		public TodoItemCell ()
		{
			StyleId = "Cell";

			var label = new Label {
				StyleId = "CellLabel",
				YAlign = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.StartAndExpand
			};
			label.SetBinding (Label.TextProperty, "Name");

			var tick = new Image {
				StyleId = "CellTick",
				Source = FileImageSource.FromFile ("check"),
				HorizontalOptions = LayoutOptions.End
			};
			tick.SetBinding (Image.IsVisibleProperty, "Done");

			var layout = new StackLayout {
				Padding = new Thickness(20, 0, 20, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Children = {label, tick}
			};
			View = layout;
		}
开发者ID:crcossey,项目名称:xamarin-forms-samples,代码行数:26,代码来源:TodoItemCell.cs

示例8: SessionCell

		public SessionCell ()
		{
			title = new Label {
				YAlign = TextAlignment.Center
			};
			title.SetBinding (Label.TextProperty, "Title");

			label = new Label {
				YAlign = TextAlignment.Center,
				Font = Font.SystemFontOfSize(10)
			};
			label.SetBinding (Label.TextProperty, "LocationDisplay");

			var fav = new Image {
				Source = FileImageSource.FromFile ("favorite.png"),
			};
			//TODO: implement favorites
			//fav.SetBinding (Image.IsVisibleProperty, "IsFavorite");

			var text = new StackLayout {
				Orientation = StackOrientation.Vertical,
				Padding = new Thickness(0, 0, 0, 0),
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = {title, label}
			};

			layout = new StackLayout {
				Padding = new Thickness(20, 0, 0, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = {text, fav}
			};
			View = layout;
		}
开发者ID:Randy3W,项目名称:xamarin-forms-samples,代码行数:34,代码来源:SessionCell.cs

示例9: FancyListCell

        public FancyListCell()
        {
            var image = new Image
              {
            HorizontalOptions = LayoutOptions.Start
              };
              image.SetBinding(Image.SourceProperty, new Binding("Icon"));
              image.WidthRequest = image.HeightRequest = 50;

              var nameLabel = new Label
              {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.Center,
            FontSize = 26,
            TextColor = Color.FromHex("111111")
              };
              nameLabel.SetBinding(Label.TextProperty, "Title");

              var viewLayout = new StackLayout()
              {
            Orientation = StackOrientation.Horizontal,
            Spacing = 10,
            Padding = 15,
            Children = { image, nameLabel }
              };
              View = viewLayout;
        }
开发者ID:bencrispin,项目名称:firstitemscrolledpastrepo,代码行数:27,代码来源:FancyListCell.cs

示例10: CreateHistogram

        public void CreateHistogram(Image<Bgr, Byte> img)
        {
            Image<Gray, Byte>[] channels = img.Split();
            Image<Gray, Byte> blueChannel = channels[0];
            Image<Gray, Byte> greenChannel = channels[1];
            Image<Gray, Byte> redChannel = channels[2];

            //Red colour channel
            DenseHistogram dhRed = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
            dhRed.Calculate<Byte>(new Image<Gray, Byte>[1] { redChannel }, false, null);
            redChart.ClearHistogram();
            redChart.AddHistogram("Red Channel", System.Drawing.Color.Red, dhRed);
            redChart.Refresh();

            //Green colour Channel
            DenseHistogram dhGreen = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
            dhGreen.Calculate<Byte>(new Image<Gray, Byte>[1] { greenChannel }, false, null);
            greenChart.ClearHistogram();
            greenChart.AddHistogram("Green Channel", System.Drawing.Color.Green, dhGreen);

            greenChart.Refresh();

            //Blue colour Channel
            DenseHistogram dhBlue = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
            dhBlue.Calculate<Byte>(new Image<Gray, Byte>[1] { blueChannel }, false, null);
            blueChart.ClearHistogram();
            blueChart.Show();
            blueChart.AddHistogram("Blue Channel", System.Drawing.Color.Blue, dhBlue);
            blueChart.Refresh();
        }
开发者ID:JamesMasterman,项目名称:SeaScan,代码行数:30,代码来源:HistogramView.cs

示例11: Convert

 public object Convert(object value, Type targetType, object parameter, string language) {
     if (value != null) {
         var page = (Page)value;
         if (page != null) {
             if (page.Icon == null) {
                 var glyph = (string)page.GetValue(AttachedFontIcon.GlyphProperty);
                 if (!string.IsNullOrWhiteSpace(glyph)) {
                     var familary = (string)page.GetValue(AttachedFontIcon.FontFamilyProperty);
                     //control it's color by theme resource.
                     //var color = (Color)page.GetValue(AttachedFontIcon.ColorProperty);
                     var size = (double)page.GetValue(AttachedFontIcon.FontSizeProperty);
                     var icon = new Windows.UI.Xaml.Controls.FontIcon() {
                         Glyph = glyph,
                         FontFamily = familary.ToFontFamily(),
                         FontSize = size,
                         //Foreground = color.ToBrush()
                     };
                     return icon;
                 }
             } else {
                 var img = new Image();
                 img.Source = page.Icon;
                 return img;
             }
         }
     }
     return null;
 }
开发者ID:zhangcj,项目名称:Xamarin.Forms.Lagou,代码行数:28,代码来源:TabbedPageHeaderIconConverter.cs

示例12: Load

        public override Image Load(System.IO.Stream s)
        {

            if (s.ReadByte() == 255)
            {
                byte[] buf = new byte[s.Length - 1];
                s.Read(buf, 0, buf.Length);
                s = new MemoryStream(Orvid.Compression.LZMA.Decompress(buf));
            }
            else
            {
                s.Position = 0;
            }
            byte[] tmp = new byte[8];
            s.Read(tmp, 0, 8); // skip the 8 empty bytes at the start of the file.
            tmp = new byte[4];
            s.Read(tmp, 0, 4);
            uint Height = ReadUInt32(tmp); // Read the Height.
            s.Read(tmp, 0, 4);
            uint Width = ReadUInt32(tmp); // Read the Width.
            Image i = new Image((int)Width, (int)Height);
            byte r, g, b, a;
            for (uint x = 0; x < Width; x++)
            {
                for (uint y = 0; y < Height; y++)
                {
                    r = (byte)s.ReadByte();
                    g = (byte)s.ReadByte();
                    b = (byte)s.ReadByte();
                    a = (byte)s.ReadByte();
                    i.SetPixel(x, y, new Pixel(r, g, b, a));
                }
            }
            return i;
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:35,代码来源:OIFSupport.cs

示例13: Save

        public override void Save(Image i, System.IO.Stream dest)
        {
            MemoryStream m = new MemoryStream();
            m.WriteByte(0);
#warning Change this next byte to 255 if you update Image with UInt64 for width and height.
            m.WriteByte(0);
            m.WriteByte(0);
            m.WriteByte(0); // Write the 8 empty bytes at the start of the file.
            m.WriteByte(0);
            m.WriteByte(0);
            m.WriteByte(0);
            m.WriteByte(0);

            byte[] dat = BitConverter.GetBytes(i.Height); // Write the height.
            m.Write(dat, 0, dat.Length);
            dat = BitConverter.GetBytes(i.Width); // Write the width.
            m.Write(dat, 0, dat.Length);

            // Now to write the actual data.
            Pixel p;
            for (uint x = 0; x < i.Width; x++)
            {
                for (uint y = 0; y < i.Height; y++)
                {
                    p = i.GetPixel(x, y);
                    m.WriteByte(p.R);
                    m.WriteByte(p.G);
                    m.WriteByte(p.B);
                    m.WriteByte(p.A);
                }
            }
            dat = Orvid.Compression.LZMA.Compress(m.GetBuffer());
            dest.WriteByte(255);
            dest.Write(dat, 0, dat.Length);
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:35,代码来源:OIFSupport.cs

示例14: ContentDemo

        public ContentDemo()
        {
            Button button = new Button
            {
                Text = "Edit Profile",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            button.Clicked += OnButtonClicked;

            Image myImage = new Image
            {
                Aspect = Aspect.Fill,
                Source = ImageSource.FromUri( new Uri(@"https://4e72eb44013d543eb0c67f8fbddf2ed30743ec8d.googledrive.com/host/0B70CO9lnNPfceHNFLXh2Wm8yMHc/List-Most-Expensive-Cars-photo-OdYL.jpg"))
            };
            this.Title = "Content Page";

            RelativeLayout relativeLayout = new RelativeLayout ();

            relativeLayout.Children.Add (myImage,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => { return parent.Width; }),
                Constraint.RelativeToParent ((parent) => { return parent.Height; }));

            relativeLayout.Children.Add (button,
                Constraint.RelativeToParent ((parent) => {return parent.Width/2;} ),
                Constraint.RelativeToParent ((parent) => {return parent.Height/2;} ),
                Constraint.RelativeToParent ((parent) => { return 75.0; }),
                Constraint.RelativeToParent ((parent) => { return 75.0; }));

            Content = relativeLayout;
        }
开发者ID:ctsxamarintraining,项目名称:cts440202,代码行数:33,代码来源:ContentDemo.cs

示例15: RangeSliderBubble

        public RangeSliderBubble()
        {
            // Init
            this.BackgroundColor = Color.Transparent;

            // Image
            _image = new Image();

            AbsoluteLayout.SetLayoutFlags(_image, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_image, new Rectangle(0f, 0f, 1f, 1f));

            _image.SetBinding(Image.SourceProperty, new Binding(path: "Source", source: this));

            this.Children.Add(_image);

            // Label
            _label = new Label() { VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center };

            AbsoluteLayout.SetLayoutFlags(_label, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_label, new Rectangle(0.5f, 0.7f, 0.8f, 0.6f));

            _label.SetBinding(Label.TextProperty, new Binding(path: "Text", source: this));

            this.Children.Add(_label);
        }
开发者ID:Manne990,项目名称:XamTest,代码行数:25,代码来源:RangeSliderView.cs


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