Exemple #1
0
        private static void ProxyVirtual()
        {
            IImage imageProxy = new ImageProxy("Flower");

            imageProxy.DisplayImage();
            imageProxy.DisplayImage();
        }
Exemple #2
0
 public EmbeddedImageGraphic(PointF graphicPosition, ImageProxy startingImage)
     :
     this()
 {
     this.SetPosition(graphicPosition);
     this.Image = startingImage;
 }
Exemple #3
0
 public EmbeddedImageGraphic(PointF graphicPosition, SizeF graphicSize, ImageProxy startingImage)
     :
     this(graphicPosition, startingImage)
 {
     this.SetSize(graphicSize);
     this.AutoSize = false;
 }
Exemple #4
0
        /// <summary>
        /// A step in building the attention map
        /// </summary>
        /// <param name="position">The location shown</param>
        /// <param name="size">The size of the visible part</param>
        /// <param name="duration">Duration at that point</param>
        /// <param name="shouldRemove">Is positive or negative change, for UNDO</param>
        public void BuildActivationMap(PointF position,
                                       SizeF size,
                                       TimeSpan duration,
                                       bool shouldRemove)
        {
            if (AttentionMap != null)
            {
                ImageProxy <double> imageProxy = AttentionMap?.Proxy(
                    new Rectangle((int)(position.X - size.Width / 2), (int)(position.Y - size.Height / 2),
                                  (int)size.Width, (int)size.Height));
                //Apply a change to every pixel
                imageProxy?.ApplyFilter((value, location) =>
                {
                    var ix = (location.X / size.Width) * 2 - 1;
                    var iy = (location.Y / size.Height) * 2 - 1;
                    if (ix * ix + iy * iy > 1)//out of circle = original pixel
                    {
                        return(value);
                    }
                    var distance = Math.Pow((ix * ix + iy * iy), 0.5);

                    //=2*(1- 1.5^(8*dist-1) / (1.5^(8*dist-1)+1))
                    const double _base      = 1.5d;
                    const double _mult_dist = 8;
                    const double _off       = -1;
                    const double _mult      = 2;

                    var distanceFactor = _mult * (1 - Math.Pow(_base, _mult_dist * distance + _off) / (Math.Pow(_base, _mult_dist * distance + _off) + 1));

                    //If remove(subtract) multiply by minus one
                    var removeFactor = shouldRemove ? -1 : 1;
                    return(value += duration.TotalMilliseconds * distanceFactor * removeFactor);
                });
            }
        }
		public EmbeddedImageGraphic(PointD3D graphicPosition, ImageProxy startingImage)
			:
			this()
		{
			this.SetPosition(graphicPosition, Main.EventFiring.Suppressed);
			this.Image = startingImage;
		}
        static void Main()
        {
            Console.WriteLine("Proxy:");

            // assuming that the user selects a folder that has 3 images
            //create the 3 images
            IImage highResolutionImage1 = new ImageProxy("sample/veryHighResPhoto1.jpeg");
            IImage highResolutionImage2 = new ImageProxy("sample/veryHighResPhoto2.jpeg");
            IImage highResolutionImage3 = new ImageProxy("sample/veryHighResPhoto3.jpeg");

            // assume that the user clicks on Image one item in a list
            // this would cause the program to call showImage() for that image only
            // note that in this case only image one was loaded into memory

            highResolutionImage1.showImage();
            Console.WriteLine("\nNot proxy:");

            // consider using the high resolution image object directly
            IImage highResolutionImageNoProxy1 = new HighResolutionImage("sample/veryHighResPhoto1.jpeg");
            IImage highResolutionImageNoProxy2 = new HighResolutionImage("sample/veryHighResPhoto2.jpeg");
            IImage highResolutionImageBoProxy3 = new HighResolutionImage("sample/veryHighResPhoto3.jpeg");

            // assume that the user selects image two item from images list
            highResolutionImageNoProxy2.showImage();
        }
 public EmbeddedImageGraphic(PointD2D graphicPosition, ImageProxy startingImage)
     :
     this()
 {
     SetPosition(graphicPosition, Main.EventFiring.Suppressed);
     Image = startingImage;
 }
Exemple #8
0
 private WktReader(LayeredVectorImage vecImg, string fname, double scaleDiv, bool flipY, bool incermentalLoad)
 {
     vectorImg            = vecImg;
     scaleDivider         = scaleDiv;
     flipYAxis            = flipY;
     incermentalCoordLoad = incermentalLoad;
     imagePxory           = new ImageProxy(vecImg, incermentalLoad);
 }
 public override void Init()
 {
     base.Init();
     _head      = FindInChild <ImageProxy>("BigHead");
     _title     = FindInChild <TextProxy>("Top/Back/text");
     _uploadBtn = FindInChild <Button>("Top/SelectBtn");
     _uploadBtn.onClick.AddListener(OnClickUpload);
 }
Exemple #10
0
        private void menuItem_Click(object sender, EventArgs e)
        {
            MenuItem menuItem = sender as MenuItem;
            string   cdName   = menuItem.Text;
            string   url      = _cds[cdName];

            icon = new ImageProxy(url);
            imageComponent.Refresh();
        }
Exemple #11
0
        public object BuildItem(object caller, Codon codon, ArrayList subItems)
        {
            string     id       = codon.Id;
            string     resource = codon.Properties["resource"];
            ImageProxy proxy    = ResourceImageProxy.FromResource(id, resource);

            TextureManager.BuiltinTextures.Add(proxy);
            return(proxy);
        }
 public override void Init()
 {
     base.Init();
     _personalMainBtn = FindInChild <Button>("Content/Item1");
     _headImg         = FindInChild <ImageProxy>("Content/Item1/head");
     _realName        = FindInChild <TextProxy>("Content/Item2/name");
     _accountText     = FindInChild <TextProxy>("Content/Item3/num");
     _personalMainBtn.onClick.AddListener(OnClickPersonalMain);
 }
Exemple #13
0
        public static Pixbuf ToPixbuf <T>(ImageProxy <T> input)
            where T : unmanaged
        {
            MemoryStream ms = new MemoryStream();

            input.Save(ms);
            ms.Position = 0;
            return(new Pixbuf(ms));
        }
Exemple #14
0
        public static void TestVirtualProxy()
        {
            Console.WriteLine("----------------------Virtual Proxy----------------------");
            ISubject image = new ImageProxy();

            image.DisplayImage();
            image.DisplayImage();
            Console.WriteLine("---------------------------------------------------\n");
        }
 public override void Init()
 {
     base.Init();
     _bankIcon   = FindInChild <ImageProxy>("icon");
     _cardName   = FindInChild <TextProxy>("bankName");
     _lastNumber = FindInChild <TextProxy>("lastNum");
     _btn        = GetComponent <Button>();
     _btn.onClick.AddListener(OnClickBtn);
 }
Exemple #16
0
        protected override void CopyFrom(GraphicBase bfrom)
        {
            EmbeddedImageGraphic from = bfrom as EmbeddedImageGraphic;

            if (from != null)
            {
                this._imageProxy = null == from._imageProxy ? null : (ImageProxy)from._imageProxy.Clone();
            }
            base.CopyFrom(bfrom);
        }
Exemple #17
0
    static public void AddImage(MenuCommand menuCommand)
    {
        GameObject go  = new GameObject("ImageProxy");
        ImageProxy txt = go.AddComponent <ImageProxy>();

        go.transform.SetParent(Selection.activeGameObject.transform);
        txt.raycastTarget          = false;
        go.transform.localPosition = Vector3.zero;
        go.transform.localScale    = Vector3.one;
        Selection.activeObject     = go;
    }
 private PointD2D GetSizeOfImageProxy(ImageProxy proxy)
 {
     if (proxy is ISyntheticRepeatableTexture)
     {
         return(((ISyntheticRepeatableTexture)proxy).Size);
     }
     else
     {
         var img = proxy.GetImage();
         return(new PointD2D(img.Width * 72.0 / img.HorizontalResolution, img.Height * 72.0 / img.VerticalResolution));
     }
 }
Exemple #19
0
        private void Preload(int bufferIndex)
        {
            if (bufferIndex < 0 || bufferIndex >= _buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(bufferIndex));
            }

            var entityIndex = (_position + bufferIndex) % Entities.Count;
            var entity      = Entities[entityIndex];
            var loadTask    = Queue.EnqueueAsync(entity);

            _buffer[bufferIndex] = new ImageProxy(loadTask);
        }
Exemple #20
0
        public CDCoverViewer(Dictionary <string, string> cds)
        {
            InitializeComponent();

            _cds = cds;
            CreateMyMenu();

            string url = _cds.Values.First();

            icon = new ImageProxy(url);

            CreatePictureBox();
        }
        private void AddImage(ImageProxy img)
        {
            if (null == img)
            {
                return;
            }
            if (_cachedItems.ContainsKey(img.ContentHash))
            {
                return;
            }
            ImageComboBoxItem it;

            _cachedItems.Add(img.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair <string, ImageProxy>(img.Name, img)));
            _currentItemsSource.Add(it);
        }
        public static void Start()
        {
            // set up frame and menus
            Icon icon = new ImageProxy("http://some-url.com/123.png");

            Console.WriteLine($"Image icon width: {icon.GetIconWidth()}px");
            Console.WriteLine($"Image icon height: {icon.GetIconHeight()}px");

            icon.PaintIcon();

            Console.WriteLine($"Image icon width: {icon.GetIconWidth()}px");
            Console.WriteLine($"Image icon height: {icon.GetIconHeight()}px");

            icon.PaintIcon();
        }
Exemple #23
0
 public BrushX(BrushX from)
 {
     _brushType              = from._brushType;                                                            // Type of the brush
     _cachedBrush            = null;                                                                       // this is the cached brush object
     _foreColor              = from._foreColor;                                                            // Color of the brush
     _backColor              = from._backColor;                                                            // Backcolor of brush, f.i.f. HatchStyle brushes
     _hatchStyle             = from._hatchStyle;                                                           // für HatchBrush
     _textureImage           = null == from._textureImage ? null : (ImageProxy)from._textureImage.Clone(); // für Texturebrush
     _wrapMode               = from._wrapMode;                                                             // für TextureBrush und LinearGradientBrush
     _brushBoundingRectangle = from._brushBoundingRectangle;
     _focus              = from._focus;
     _exchangeColors     = from._exchangeColors;
     this._gradientMode  = from._gradientMode;
     this._gradientShape = from._gradientShape;
     this._scale         = from._scale;
 }
Exemple #24
0
 public override void Init()
 {
     base.Init();
     _backImg       = FindInChild <ImageProxy>("ScrollView/Viewport/Content/bigHead");
     _head          = FindInChild <ImageProxy>("ScrollView/Viewport/Content/head/head");
     _nickName      = FindInChild <TextProxy>("ScrollView/Viewport/Content/nickName");
     _signatureText = FindInChild <TextProxy>("ScrollView/Viewport/Content/signature");
     _accountText   = FindInChild <TextProxy>("ScrollView/Viewport/Content/account/value");
     _realNameText  = FindInChild <TextProxy>("ScrollView/Viewport/Content/realName/value");
     _systemHeadObj = FindChild("ScrollView/Viewport/Content/head/system_head");
     _uploadHeadBtn = FindInChild <Button>("ScrollView/Viewport/Content/head");
     _uploadBackBtn = FindInChild <Button>("ScrollView/Viewport/Content/bigHead");
     _changeNickBtn = FindInChild <Button>("ScrollView/Viewport/Content/changeNameBtn");
     _uploadHeadBtn.onClick.AddListener(OnClickUploadHead);
     _uploadBackBtn.onClick.AddListener(OnClickUploadBack);
     _changeNickBtn.onClick.AddListener(OnClickChangeName);
 }
Exemple #25
0
        void EhLoadFromFile(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            if (DialogResult.OK == dlg.ShowDialog(Current.MainWindow))
            {
                ImageProxy img = ImageProxy.FromFile(dlg.FileName);
                if (img.IsValid)
                {
                    TextureManager.UserTextures.Add(img);
                    SetDataSource(img);
                    OnSelectedItemChanged(EventArgs.Empty);
                    OnSelectedValueChanged(EventArgs.Empty);
                    OnSelectionChangeCommitted(EventArgs.Empty);
                }
            }
        }
        private void EhLoadFromFile(object sender, EventArgs e)
        {
            var options = new OpenFileOptions();

            options.AddFilter("*.*", "All files (*.*");
            options.FilterIndex = 0;
            if (Current.Gui.ShowOpenFileDialog(options))
            {
                var img = ImageProxy.FromFile(options.FileName);
                if (img.IsValid)
                {
                    TextureManager.UserTextures.Add(img);
                    AddImage(img);
                    TextureImage = img;
                }
            }
        }
Exemple #27
0
 static void SetUI()
 {
     Button[] buttons = GameObject.FindObjectsOfType <Button> ();
     for (int i = 0; i < buttons.Length; i++)
     {
         buttons [i].navigation = new Navigation();
     }
     Text[] texts = Selection.activeGameObject.GetComponentsInChildren <Text>();
     for (int i = 0; i < texts.Length; i++)
     {
         string     s  = texts[i].text;
         int        m  = texts[i].fontSize;
         Font       f  = texts[i].font;
         Color      c  = texts[i].color;
         TextAnchor a  = texts[i].alignment;
         GameObject go = texts[i].gameObject;
         GameObject.DestroyImmediate(texts[i]);
         TextProxy p = go.AddComponent <TextProxy>();
         p.text      = s;
         p.font      = f;
         p.fontSize  = m;
         p.color     = c;
         p.alignment = a;
     }
     Image[] images = Selection.activeGameObject.GetComponentsInChildren <Image>();
     for (int i = 0; i < images.Length; i++)
     {
         if (images [i] is ImageProxy || images [i] is UnityEngine.UI.ProceduralImage)
         {
             continue;
         }
         Sprite     s  = images[i].sprite;
         Color      c  = images[i].color;
         Material   m  = images[i].material;
         Image.Type t  = images [i].type;
         GameObject go = images[i].gameObject;
         GameObject.DestroyImmediate(images[i]);
         ImageProxy p = go.AddComponent <ImageProxy>();
         p.type     = t;
         p.sprite   = s;
         p.material = m;
         p.color    = c;
     }
 }
Exemple #28
0
        void EhLoadFromFile(object sender, EventArgs e)
        {
            OpenFileOptions options = new OpenFileOptions();

            options.AddFilter("*.*", "All files (*.*");
            options.FilterIndex = 0;
            if (Current.Gui.ShowOpenFileDialog(options))
            {
                ImageProxy img = ImageProxy.FromFile(options.FileName);
                if (img.IsValid)
                {
                    TextureManager.UserTextures.Add(img);
                    SetDataSource(img);
                    OnSelectedItemChanged(EventArgs.Empty);
                    OnSelectedValueChanged(EventArgs.Empty);
                    OnSelectionChangeCommitted(EventArgs.Empty);
                }
            }
        }
Exemple #29
0
        public object BuildItem(BuildItemArgs args)
        {
            string id       = args.Codon.Id;
            string resource = args.Codon.Properties["resource"];

            if (!string.IsNullOrEmpty(resource))
            {
                ImageProxy proxy = ResourceImageProxy.FromResource(id, resource);
                TextureManager.BuiltinTextures.Add(proxy);
                return(proxy);
            }
            string classname = args.Codon.Properties["class"];

            if (!string.IsNullOrEmpty(classname))
            {
                var proxy = (ImageProxy)System.Activator.CreateInstance("AltaxoBase", classname).Unwrap();
                TextureManager.BuiltinTextures.Add(proxy);
                return(proxy);
            }
            return(null);
        }
Exemple #30
0
        void SetDataSource(ImageProxy selected)
        {
            string selHash = null == selected ? null : selected.ContentHash;

            this.BeginUpdate();

            Items.Clear();

            int selIndex = -1;

            foreach (KeyValuePair <string, ImageProxy> pair in TextureManager.BuiltinTextures)
            {
                if (selIndex < 0 && pair.Value.ContentHash == selHash)
                {
                    selIndex = Items.Count;
                }

                Items.Add(pair);
            }
            foreach (KeyValuePair <string, ImageProxy> pair in TextureManager.UserTextures)
            {
                if (selIndex < 0 && pair.Value.ContentHash == selHash)
                {
                    selIndex = Items.Count;
                }

                Items.Add(pair);
            }

            if (selIndex < 0 && selected != null)
            {
                selIndex = Items.Count;
                TextureManager.UserTextures.Add(selected);
            }

            SelectedIndex = selIndex;

            this.EndUpdate();
        }
Exemple #31
0
        static void Main(string[] args)
        {
            List<string> result = new List<string>();
            //FFXImageServiceClient proxy = new FFXImageServiceClient("NetTcpBinding_IFFXImageService");
            ImageProxy proxy = new ImageProxy("NetTcpBinding_IFFXImageService");
            proxy.ClientCredentials.Windows.ClientCredential.UserName = "******";
            try
            {
                result = proxy.GetTicketsList("aticket").ToList();
            }
            catch(Exception ex)
            {
                Console.WriteLine("Failed to load server data. " + ex.Message);
            }
            finally
            {
                proxy.Close();
            }

            foreach (string s in result)
                Console.WriteLine(s);
            Console.ReadKey();
        }
Exemple #32
0
		public EmbeddedImageGraphic(PointD3D graphicPosition, VectorD3D graphicSize, ImageProxy startingImage)
			:
			this(graphicPosition, startingImage)
		{
			this.SetSize(graphicSize.X, graphicSize.Y, graphicSize.Z, Main.EventFiring.Suppressed);
		}
Exemple #33
0
 public BrushX(BrushX from)
 {
   _brushType = from._brushType; // Type of the brush
   _cachedBrush = null;      // this is the cached brush object
   _foreColor = from._foreColor; // Color of the brush
   _backColor = from._backColor; // Backcolor of brush, f.i.f. HatchStyle brushes
   _hatchStyle = from._hatchStyle; // für HatchBrush
   _textureImage = null == from._textureImage ? null : (ImageProxy)from._textureImage.Clone(); // für Texturebrush
   _wrapMode = from._wrapMode; // für TextureBrush und LinearGradientBrush
   _brushBoundingRectangle = from._brushBoundingRectangle;
   _focus = from._focus;
   _exchangeColors = from._exchangeColors;
   this._gradientMode = from._gradientMode;
   this._gradientShape = from._gradientShape;
   this._scale = from._scale;
 }
Exemple #34
0
 public EmbeddedImageGraphic(double posX, double posY, double width, double height, ImageProxy startingImage)
     :
     this(new PointD2D(posX, posY), new PointD2D(width, height), startingImage)
 {
 }
Exemple #35
0
		public EmbeddedImageGraphic(PointD2D graphicPosition, PointD2D graphicSize, double Rotation, ImageProxy startingImage)
			:
			this(graphicPosition, Rotation, startingImage)
		{
			this.SetSize(graphicSize.X, graphicSize.Y, Main.EventFiring.Suppressed);
		}
Exemple #36
0
		public EmbeddedImageGraphic(double posX, double posY, PointD2D graphicSize, ImageProxy startingImage)
			:
			this(new PointD2D(posX, posY), graphicSize, startingImage)
		{
		}
Exemple #37
0
		public EmbeddedImageGraphic(double posX, double posY, double posZ, double width, double height, double Rotation, ImageProxy startingImage)
			:
			this(new PointD3D(posX, posY, posZ), new VectorD3D(width, height, 0), Rotation, startingImage)
		{
		}
Exemple #38
0
		public EmbeddedImageGraphic(double posX, double posY, double posZ, VectorD3D graphicSize, ImageProxy startingImage)
			:
			this(new PointD3D(posX, posY, posZ), graphicSize, startingImage)
		{
		}
Exemple #39
0
		public EmbeddedImageGraphic(double posX, double posY, double width, double height, ImageProxy startingImage)
			:
			this(new PointD2D(posX, posY), new PointD2D(width, height), startingImage)
		{
		}
Exemple #40
0
		public EmbeddedImageGraphic(double posX, double posY, double posZ, ImageProxy startingImage)
			:
			this(new PointD3D(posX, posY, posZ), startingImage)
		{
		}
Exemple #41
0
		public EmbeddedImageGraphic(PointD3D graphicPosition, double Rotation, ImageProxy startingImage)
			:
			this(graphicPosition, startingImage)
		{
			this.RotationZ = Rotation;
		}
Exemple #42
0
		public EmbeddedImageGraphic(double posX, double posY, double Rotation, ImageProxy startingImage)
			:
			this(new PointD2D(posX, posY), Rotation, startingImage)
		{
		}