Esempio n. 1
0
 public EvasImageContainer(EvasObject parent) : base(parent)
 {
     _content          = new EvasImage(parent);
     _content.IsFilled = true;
     _content.Show();
     PackEnd(_content);
     SetLayoutCallback(OnLayout);
 }
        public static void SetScaleDown(this EvasImage evasImage, int scale)
        {
            var interop    = typeof(EvasObject).Assembly.GetType("Interop");
            var elementary = interop?.GetNestedType("Elementary", BindingFlags.NonPublic | BindingFlags.Static) ?? null;
            var method     = elementary?.GetMethod("evas_object_image_load_scale_down_set", BindingFlags.NonPublic | BindingFlags.Static);

            if (method != null)
            {
                method.Invoke(null, new object[] { evasImage.RealHandle, scale });
            }
            else
            {
                System.Console.WriteLine("No API evas_object_image_load_scale_down_set");
            }
        }
Esempio n. 3
0
        EvasObject GetShapeView(EvasObject parent)
        {
            var copiedImg = new EvasImage(parent);

            copiedImg.IsFilled = true;

            if (NativeView is ShapeView shapeView)
            {
                var canvas     = shapeView.SKCanvasView;
                var realHandle = DragDropExtensions.Interop.elm_object_part_content_get(canvas, "elm.swallow.content");

                DragDropExtensions.Interop.evas_object_image_size_get(realHandle, out int w, out int h);
                DragDropExtensions.Interop.evas_object_image_size_set(copiedImg, w, h);

                var imgData = DragDropExtensions.Interop.evas_object_image_data_get(realHandle, false);
                DragDropExtensions.Interop.evas_object_image_data_set(copiedImg, imgData);
            }

            return(copiedImg);
        }
Esempio n. 4
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window);

            conformant.SetContent(box);
            box.Show();

            Box horizentalBox = new Box(window)
            {
                IsHorizontal = true,
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
            };

            horizentalBox.Show();

            Button realObject1 = new Button(window)
            {
                Text       = "It is RealObject",
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            realObject1.Show();

            Image realObject2 = new Image(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            realObject2.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
            realObject2.Show();

            horizentalBox.PackEnd(realObject1);
            horizentalBox.PackEnd(realObject2);

            EvasImage proxyObject = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 0.5,
            };
            Button toggle = new Button(window)
            {
                Text       = "Change Source",
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 0.1,
            };

            toggle.Show();

            EvasObject proxyedObject = realObject1;

            toggle.Clicked += (s, e) =>
            {
                if (proxyedObject == realObject1)
                {
                    proxyedObject = realObject2;
                }
                else
                {
                    proxyedObject = realObject1;
                }
                proxyObject.SetSource(proxyedObject);
            };


            proxyObject.IsFilled = true;
            proxyObject.SetSource(realObject1);
            proxyObject.Show();

            box.PackEnd(horizentalBox);
            box.PackEnd(proxyObject);
            box.PackEnd(toggle);
        }
Esempio n. 5
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window);

            conformant.SetContent(box);
            box.Show();

            Image realObject2 = new Image(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            realObject2.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
            realObject2.Show();

            EvasImage img1 = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            img1.IsFilled = true;
            img1.File     = Path.Combine(TestRunner.ResourceDir, "picture.png");
            img1.Show();

            EvasImage img2 = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            img2.IsFilled = true;
            img2.SetStream(new FileStream(Path.Combine(TestRunner.ResourceDir, "picture.png"), FileMode.Open, FileAccess.Read));
            img2.Show();

            EvasImage img3 = new EvasImage(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            img3.IsFilled = true;
            img3.SetSource(realObject2);
            img3.Show();
            img3.IsSourceVisible = true;

            box.PackEnd(realObject2);
            box.PackEnd(img1);
            box.PackEnd(img2);
            box.PackEnd(img3);
        }
 public static void Save(this EvasImage evasImage, string file, string key, string flags)
 {
     typeof(EvasImage)?.GetMethod("Save")?.Invoke(evasImage, new[] { file, key, flags });
 }