示例#1
0
    static void Main(string[] args)
    {
        efl.All.Init();

        efl.Loop loop = new efl.LoopConcrete();

        EcoreEvas ecore_evas = new EcoreEvas();

        eina.Size2D size = new eina.Size2D();

        efl.canvas.Object canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        efl.Object parent = canvas.GetParent();
        System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);

        efl.canvas.Rectangle bg = new efl.canvas.RectangleConcrete(canvas);
        bg.SetColor(255, 255, 255, 255);
        size.W = WIDTH;
        size.H = HEIGHT;
        bg.SetSize(size);
        bg.SetVisible(true);

        string valid_path = args[0];

        evas.Image image = new evas.ImageConcrete(canvas);
        image.SetFile(valid_path, null);

        /* FIXME evas-image uses error handling code from
         * evas_object_image_load_error_get, which seems to be not available
         * efl.image.load.State state = image.load_error_get(); */

        // FIXME missing move
        eina.Rect rect = new eina.Rect();

        rect.X = 0;
        rect.Y = 0;
        rect.W = WIDTH / 2;
        rect.H = HEIGHT / 2;
        image.SetFill(rect);

        size.W = WIDTH / 2;
        size.H = HEIGHT / 2;
        image.SetSize(size);
        image.SetVisible(true);

        rect    = image.GetFill();
        rect.Y -= 50;
        rect.W += 100;
        image.SetFill(rect);

        TestMain listener = new TestMain(image);

        // TODO handle key events in order to alter the image like the C
        // example. Meanwhile, just set some w fill
        /* EventListener callback = new EventListener(); */

        /* bg.key_focus_set(true); */
        /* bg.event_callback_priority_add(evas.Callback_Type.Key_down, */
        /*         efl.Callback_Priority.Default, */
        /*         callback, null); */

        loop.Begin();

        efl.All.Shutdown();
    }
    static void Main(string[] args)
    {
        efl.All.Init();

        efl.Loop loop = new efl.LoopConcrete();

        EcoreEvas ecore_evas = new EcoreEvas();

        eina.Size2D     size = new eina.Size2D();
        eina.Position2D pos  = new eina.Position2D();

        efl.canvas.Object canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        efl.canvas.Rectangle bg = new efl.canvas.RectangleConcrete(canvas);
        bg.SetColor(255, 255, 255, 255);
        pos.X = 0;
        pos.Y = 0;
        bg.SetPosition(pos);
        size.W = WIDTH;
        size.H = HEIGHT;
        bg.SetSize(size);
        bg.SetVisible(true);

        string path = args[0];

        evas.Image logo = new evas.ImageConcrete(canvas);
        logo.SetFillAuto(true);

        // TODO add preloaded support (depends on events)

        logo.SetFile(path, null);
        size.W = WIDTH / 2;
        size.H = HEIGHT / 2;
        logo.SetSize(size);

        // TODO add a bunch of key/mouse handlers

        logo.SetVisible(true);

        int[]         pixels    = new int[(WIDTH / 4) * (HEIGHT / 4)];
        System.Random generator = new System.Random();
        for (int i = 0; i < pixels.Length; i++)
        {
            pixels[i] = generator.Next();
        }

        evas.Image noise_img = new evas.ImageConcrete(canvas);
        size.W = WIDTH / 4;
        size.H = HEIGHT / 4;
        noise_img.SetSize(size);
        // FIXME Add a way to set the pixels.
        // noise_img.data_set(pixels);
        noise_img.SetFillAuto(true);
        pos.X = WIDTH * 5 / 8;
        pos.Y = HEIGHT / 8;
        noise_img.SetPosition(pos);
        noise_img.SetVisible(true);
        Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH / 4, HEIGHT / 4);

        efl.canvas.Proxy proxy_img = new efl.canvas.ProxyConcrete(canvas);
        proxy_img.SetSource(noise_img);
        pos.X = WIDTH / 2;
        pos.Y = HEIGHT / 2;
        proxy_img.SetPosition(pos);
        size.W = WIDTH / 2;
        size.H = HEIGHT / 2;
        proxy_img.SetSize(size);
        proxy_img.SetVisible(true);

        loop.Begin();
    }