ARGB Graphics Made Easy

Code — May 22, 2006 @ 5:49 am

Many people dismiss Enlightenment’s cool GUI effects as just “hacks” that are no substitute for real transparency. That may have been true in the past when X didn’t have such features, but thanks to the new Xrender engine in Evas, it’s no longer true. For the skeptics, here’s a little 48-line program that can display any Edje file with full transparency (when a composite manager is running). Don’t try this with XLib.

#include <stdio.h>
#include <stdlib.h>
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Edje.h>

int main(int argc, char ** argv)
   Evas *evas;
   Ecore_Evas *ee;
   Evas_Object *edje;

   if (argc < 2)

   ecore_app_args_set(argc, (const char **)argv);
   ee = ecore_evas_xrender_x11_new(0, 0, 0, 0, 400, 400);
   evas = ecore_evas_get(ee);
   ecore_evas_alpha_set(ee, 1);
   ecore_evas_title_set(ee, "MAGIC!");
   ecore_evas_borderless_set(ee, 1);
   ecore_evas_move(ee, 0, 0);

   edje = edje_object_add(evas);
   if (!edje_object_file_set(edje, argv[1], "Main"))
      fprintf(stderr, "Failed to load collection 'Main' from Edje file %s\n",
   evas_object_move(edje, 0, 0);
   ecore_evas_resize(ee, 200, 200);
   evas_object_resize(edje, 200, 200);
   return 0;

Two examples are shown here -- a static camera image and an animated E logo:

You can download the source, together with the two sample edjes here. You need to have Evas, Ecore and Edje installed (visit for more info). This all comes with a minor caveat: Xrender performance generally ranges from sucky to depressing, and as a result evas_xrender is approximately 10 times slower than the plain software engine. But any decently fast computer should be able to handle this test case with ease.

  • Digg
  • Facebook
  • Technorati
  • Twitter
  • Add to favorites
  • email

3 Responses to “ARGB Graphics Made Easy”

  1. Cius says:

    Did you happen to try RenderAccel “true” in your xorg.conf or similar file? I’m just wondering maybe the lack of render performance could be improved by this.

  2. xcomp says:

    Yes I did. It works well enough to be usable, but the frame rates are absolute crap compared to regular Evas software rendering, even with hardware render acceleration enabled. See this Slashdot Story from a couple of years ago.

  3. raster says:

    Actually you can just use the software_x11 engine too – it works with ARGB targets as well :) so you can play with a middle ground – render contents with sw, let xcomposite/xrender deal with the rest.

Leave a Reply

You must be logged in to post a comment.

Copyright © Ibukun Olumuyiwa 2007.