From dd7595a3475407a7fa96a97393bae8c5220e8762 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Wed, 4 Jan 2012 18:41:13 +1000 Subject: Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje. Note that embryo wont be used, but I'm not sure yet if you can build edje without it. --- libraries/evas/src/examples/Makefile.am | 149 ++++ libraries/evas/src/examples/Makefile.in | 983 +++++++++++++++++++++ libraries/evas/src/examples/aspect.edc | 17 + libraries/evas/src/examples/cube1.png | Bin 0 -> 183167 bytes libraries/evas/src/examples/enlightenment.png | Bin 0 -> 17541 bytes libraries/evas/src/examples/evas-aspect-hints.c | 249 ++++++ libraries/evas/src/examples/evas-box.c | 382 ++++++++ libraries/evas/src/examples/evas-buffer-simple.c | 228 +++++ libraries/evas/src/examples/evas-events.c | 413 +++++++++ libraries/evas/src/examples/evas-hints.c | 375 ++++++++ libraries/evas/src/examples/evas-images.c | 353 ++++++++ libraries/evas/src/examples/evas-images2.c | 204 +++++ libraries/evas/src/examples/evas-init-shutdown.c | 56 ++ libraries/evas/src/examples/evas-map-utils.c | 321 +++++++ .../evas/src/examples/evas-object-manipulation.c | 235 +++++ libraries/evas/src/examples/evas-smart-object.c | 708 +++++++++++++++ libraries/evas/src/examples/evas-stacking.c | 329 +++++++ libraries/evas/src/examples/evas-text.c | 411 +++++++++ libraries/evas/src/examples/im1.png | Bin 0 -> 467518 bytes libraries/evas/src/examples/red.png | Bin 0 -> 225 bytes 20 files changed, 5413 insertions(+) create mode 100644 libraries/evas/src/examples/Makefile.am create mode 100644 libraries/evas/src/examples/Makefile.in create mode 100644 libraries/evas/src/examples/aspect.edc create mode 100644 libraries/evas/src/examples/cube1.png create mode 100644 libraries/evas/src/examples/enlightenment.png create mode 100644 libraries/evas/src/examples/evas-aspect-hints.c create mode 100644 libraries/evas/src/examples/evas-box.c create mode 100644 libraries/evas/src/examples/evas-buffer-simple.c create mode 100644 libraries/evas/src/examples/evas-events.c create mode 100644 libraries/evas/src/examples/evas-hints.c create mode 100644 libraries/evas/src/examples/evas-images.c create mode 100644 libraries/evas/src/examples/evas-images2.c create mode 100644 libraries/evas/src/examples/evas-init-shutdown.c create mode 100644 libraries/evas/src/examples/evas-map-utils.c create mode 100644 libraries/evas/src/examples/evas-object-manipulation.c create mode 100644 libraries/evas/src/examples/evas-smart-object.c create mode 100644 libraries/evas/src/examples/evas-stacking.c create mode 100644 libraries/evas/src/examples/evas-text.c create mode 100644 libraries/evas/src/examples/im1.png create mode 100644 libraries/evas/src/examples/red.png (limited to 'libraries/evas/src/examples') diff --git a/libraries/evas/src/examples/Makefile.am b/libraries/evas/src/examples/Makefile.am new file mode 100644 index 0000000..f748c12 --- /dev/null +++ b/libraries/evas/src/examples/Makefile.am @@ -0,0 +1,149 @@ +MAINTAINERCLEANFILES = Makefile.in + +pkglibdir = $(datadir)/$(PACKAGE)/examples + +#put here all EDCs one needs to the tests +EDCS = aspect.edc + +filesdir = $(datadir)/$(PACKAGE)/examples +files_DATA = + +if BUILD_EXAMPLES + +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_srcdir)/src/lib/include \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +-DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\" \ +@EINA_CFLAGS@ \ +@FREETYPE_CFLAGS@ \ +@PIXMAN_CFLAGS@ \ +@FRIBIDI_CFLAGS@ \ +@EET_CFLAGS@ \ +@FONTCONFIG_CFLAGS@ \ +@pthread_cflags@ + +AM_CFLAGS = @WIN32_CFLAGS@ + +pkglib_PROGRAMS = + +if BUILD_ENGINE_BUFFER +AM_CPPFLAGS += -I$(top_srcdir)/src/modules/engines/buffer + +pkglib_PROGRAMS += evas_buffer_simple +evas_buffer_simple_SOURCES = evas-buffer-simple.c +evas_buffer_simple_LDADD = $(top_builddir)/src/lib/libevas.la +endif + +pkglib_PROGRAMS += evas_init_shutdown +evas_init_shutdown_SOURCES = evas-init-shutdown.c +evas_init_shutdown_LDADD = $(top_builddir)/src/lib/libevas.la + +#the ones using ecore_evas follow +AM_CPPFLAGS += @ECORE_EVAS_CFLAGS@ + +pkglib_PROGRAMS += evas_images +evas_images_SOURCES = evas-images.c +evas_images_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_events +evas_events_SOURCES = evas-events.c +evas_events_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_object_manipulation +evas_object_manipulation_SOURCES = evas-object-manipulation.c +evas_object_manipulation_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_hints +evas_hints_SOURCES = evas-hints.c +evas_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_stacking +evas_stacking_SOURCES = evas-stacking.c +evas_stacking_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_images2 +evas_images2_SOURCES = evas-images2.c +evas_images2_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_text +evas_text_SOURCES = evas-text.c +evas_text_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_smart_object +evas_smart_object_SOURCES = evas-smart-object.c +evas_smart_object_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +pkglib_PROGRAMS += evas_box +evas_box_SOURCES = evas-box.c +evas_box_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EINA_LIBS@ + +#the ones using ecore_evas and edje follow +AM_CPPFLAGS += @EDJE_CFLAGS@ + +pkglib_PROGRAMS += evas_aspect_hints +evas_aspect_hints_DEPS = $(srcdir)/aspect.edc +evas_aspect_hints_SOURCES = evas-aspect-hints.c +evas_aspect_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EDJE_LIBS@ + +pkglib_PROGRAMS += evas_map_utils +evas_map_utils_SOURCES = evas-map-utils.c +evas_map_utils_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ + +aspect.edj: ${evas_aspect_hints_DEPS} + +.edc.edj: + $(edje_cc) -v -id $(srcdir) $< $(builddir)/$(@F) + +EDJS = $(EDCS:%.edc=%.edj) + +files_DATA += $(EDJS) + +endif # if BUILD_EXAMPLES + +if INSTALL_EXAMPLES + +#put here additional data when installing examples +files_DATA += $(srcdir)/enlightenment.png \ + $(srcdir)/red.png \ + $(srcdir)/im1.png \ + $(srcdir)/cube1.png + +files_DATA += \ + $(EDCS) \ + $(srcdir)/evas-buffer-simple.c \ + $(srcdir)/evas-init-shutdown.c \ + $(srcdir)/evas-images.c \ + $(srcdir)/evas-images2.c \ + $(srcdir)/evas-object-manipulation.c \ + $(srcdir)/evas-events.c \ + $(srcdir)/evas-aspect-hints.c \ + $(srcdir)/evas-hints.c \ + $(srcdir)/evas-stacking.c \ + $(srcdir)/evas-map-utils.c \ + $(srcdir)/evas-text.c \ + $(srcdir)/evas-smart-object.c \ + $(srcdir)/evas-box.c +endif + +EXTRA_DIST = $(EDCS) \ + $(srcdir)/evas-buffer-simple.c \ + $(srcdir)/evas-init-shutdown.c \ + $(srcdir)/evas-images.c \ + $(srcdir)/evas-images2.c \ + $(srcdir)/evas-object-manipulation.c \ + $(srcdir)/evas-events.c \ + $(srcdir)/evas-aspect-hints.c \ + $(srcdir)/evas-hints.c \ + $(srcdir)/evas-stacking.c \ + $(srcdir)/evas-map-utils.c \ + $(srcdir)/evas-text.c \ + $(srcdir)/evas-smart-object.c \ + $(srcdir)/evas-box.c \ + $(srcdir)/enlightenment.png \ + $(srcdir)/red.png \ + $(srcdir)/im1.png \ + $(srcdir)/cube1.png diff --git a/libraries/evas/src/examples/Makefile.in b/libraries/evas/src/examples/Makefile.in new file mode 100644 index 0000000..5332650 --- /dev/null +++ b/libraries/evas/src/examples/Makefile.in @@ -0,0 +1,983 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_EXAMPLES_TRUE@pkglib_PROGRAMS = $(am__EXEEXT_1) \ +@BUILD_EXAMPLES_TRUE@ evas_init_shutdown$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_images$(EXEEXT) evas_events$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_object_manipulation$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_hints$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_stacking$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_images2$(EXEEXT) evas_text$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_smart_object$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_box$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_aspect_hints$(EXEEXT) \ +@BUILD_EXAMPLES_TRUE@ evas_map_utils$(EXEEXT) +@BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am__append_1 = -I$(top_srcdir)/src/modules/engines/buffer +@BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am__append_2 = evas_buffer_simple +@BUILD_EXAMPLES_TRUE@am__append_3 = $(EDJS) + +#put here additional data when installing examples +@INSTALL_EXAMPLES_TRUE@am__append_4 = $(srcdir)/enlightenment.png \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/red.png $(srcdir)/im1.png \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/cube1.png $(EDCS) \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-buffer-simple.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-init-shutdown.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-images.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-images2.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-object-manipulation.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-events.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-aspect-hints.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-hints.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-stacking.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-map-utils.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-text.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-smart-object.c \ +@INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-box.c +subdir = src/examples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/efl_attribute.m4 \ + $(top_srcdir)/m4/efl_coverage.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_fnmatch.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/evas_check_engine.m4 \ + $(top_srcdir)/m4/evas_check_loader.m4 \ + $(top_srcdir)/m4/evas_converter.m4 \ + $(top_srcdir)/m4/evas_dither.m4 \ + $(top_srcdir)/m4/evas_scaler.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am__EXEEXT_1 = evas_buffer_simple$(EXEEXT) +am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)" +PROGRAMS = $(pkglib_PROGRAMS) +am__evas_aspect_hints_SOURCES_DIST = evas-aspect-hints.c +@BUILD_EXAMPLES_TRUE@am_evas_aspect_hints_OBJECTS = \ +@BUILD_EXAMPLES_TRUE@ evas-aspect-hints.$(OBJEXT) +evas_aspect_hints_OBJECTS = $(am_evas_aspect_hints_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_aspect_hints_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__evas_box_SOURCES_DIST = evas-box.c +@BUILD_EXAMPLES_TRUE@am_evas_box_OBJECTS = evas-box.$(OBJEXT) +evas_box_OBJECTS = $(am_evas_box_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_box_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_buffer_simple_SOURCES_DIST = evas-buffer-simple.c +@BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am_evas_buffer_simple_OBJECTS = evas-buffer-simple.$(OBJEXT) +evas_buffer_simple_OBJECTS = $(am_evas_buffer_simple_OBJECTS) +@BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@evas_buffer_simple_DEPENDENCIES = $(top_builddir)/src/lib/libevas.la +am__evas_events_SOURCES_DIST = evas-events.c +@BUILD_EXAMPLES_TRUE@am_evas_events_OBJECTS = evas-events.$(OBJEXT) +evas_events_OBJECTS = $(am_evas_events_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_events_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_hints_SOURCES_DIST = evas-hints.c +@BUILD_EXAMPLES_TRUE@am_evas_hints_OBJECTS = evas-hints.$(OBJEXT) +evas_hints_OBJECTS = $(am_evas_hints_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_hints_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_images_SOURCES_DIST = evas-images.c +@BUILD_EXAMPLES_TRUE@am_evas_images_OBJECTS = evas-images.$(OBJEXT) +evas_images_OBJECTS = $(am_evas_images_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_images_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_images2_SOURCES_DIST = evas-images2.c +@BUILD_EXAMPLES_TRUE@am_evas_images2_OBJECTS = evas-images2.$(OBJEXT) +evas_images2_OBJECTS = $(am_evas_images2_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_images2_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_init_shutdown_SOURCES_DIST = evas-init-shutdown.c +@BUILD_EXAMPLES_TRUE@am_evas_init_shutdown_OBJECTS = \ +@BUILD_EXAMPLES_TRUE@ evas-init-shutdown.$(OBJEXT) +evas_init_shutdown_OBJECTS = $(am_evas_init_shutdown_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_init_shutdown_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_map_utils_SOURCES_DIST = evas-map-utils.c +@BUILD_EXAMPLES_TRUE@am_evas_map_utils_OBJECTS = \ +@BUILD_EXAMPLES_TRUE@ evas-map-utils.$(OBJEXT) +evas_map_utils_OBJECTS = $(am_evas_map_utils_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_map_utils_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_object_manipulation_SOURCES_DIST = \ + evas-object-manipulation.c +@BUILD_EXAMPLES_TRUE@am_evas_object_manipulation_OBJECTS = \ +@BUILD_EXAMPLES_TRUE@ evas-object-manipulation.$(OBJEXT) +evas_object_manipulation_OBJECTS = \ + $(am_evas_object_manipulation_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_object_manipulation_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_smart_object_SOURCES_DIST = evas-smart-object.c +@BUILD_EXAMPLES_TRUE@am_evas_smart_object_OBJECTS = \ +@BUILD_EXAMPLES_TRUE@ evas-smart-object.$(OBJEXT) +evas_smart_object_OBJECTS = $(am_evas_smart_object_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_smart_object_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_stacking_SOURCES_DIST = evas-stacking.c +@BUILD_EXAMPLES_TRUE@am_evas_stacking_OBJECTS = \ +@BUILD_EXAMPLES_TRUE@ evas-stacking.$(OBJEXT) +evas_stacking_OBJECTS = $(am_evas_stacking_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_stacking_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +am__evas_text_SOURCES_DIST = evas-text.c +@BUILD_EXAMPLES_TRUE@am_evas_text_OBJECTS = evas-text.$(OBJEXT) +evas_text_OBJECTS = $(am_evas_text_OBJECTS) +@BUILD_EXAMPLES_TRUE@evas_text_DEPENDENCIES = \ +@BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(evas_aspect_hints_SOURCES) $(evas_box_SOURCES) \ + $(evas_buffer_simple_SOURCES) $(evas_events_SOURCES) \ + $(evas_hints_SOURCES) $(evas_images_SOURCES) \ + $(evas_images2_SOURCES) $(evas_init_shutdown_SOURCES) \ + $(evas_map_utils_SOURCES) $(evas_object_manipulation_SOURCES) \ + $(evas_smart_object_SOURCES) $(evas_stacking_SOURCES) \ + $(evas_text_SOURCES) +DIST_SOURCES = $(am__evas_aspect_hints_SOURCES_DIST) \ + $(am__evas_box_SOURCES_DIST) \ + $(am__evas_buffer_simple_SOURCES_DIST) \ + $(am__evas_events_SOURCES_DIST) $(am__evas_hints_SOURCES_DIST) \ + $(am__evas_images_SOURCES_DIST) \ + $(am__evas_images2_SOURCES_DIST) \ + $(am__evas_init_shutdown_SOURCES_DIST) \ + $(am__evas_map_utils_SOURCES_DIST) \ + $(am__evas_object_manipulation_SOURCES_DIST) \ + $(am__evas_smart_object_SOURCES_DIST) \ + $(am__evas_stacking_SOURCES_DIST) \ + $(am__evas_text_SOURCES_DIST) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +DATA = $(files_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkglibdir = $(datadir)/$(PACKAGE)/examples +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_EVAS_CFLAGS = @ECORE_EVAS_CFLAGS@ +ECORE_EVAS_LIBS = @ECORE_EVAS_LIBS@ +EDB_CFLAGS = @EDB_CFLAGS@ +EDB_LIBS = @EDB_LIBS@ +EDJE_CFLAGS = @EDJE_CFLAGS@ +EDJE_LIBS = @EDJE_LIBS@ +EET_CFLAGS = @EET_CFLAGS@ +EET_LIBS = @EET_LIBS@ +EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@ +EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@ +EFL_FNMATCH_LIBS = @EFL_FNMATCH_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVAS_SSE3_CFLAGS = @EVAS_SSE3_CFLAGS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +FRIBIDI_CFLAGS = @FRIBIDI_CFLAGS@ +FRIBIDI_LIBS = @FRIBIDI_LIBS@ +GL_EET_CFLAGS = @GL_EET_CFLAGS@ +GL_EET_LIBS = @GL_EET_LIBS@ +GREP = @GREP@ +HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ +HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LINEBREAK_CFLAGS = @LINEBREAK_CFLAGS@ +LINEBREAK_LIBS = @LINEBREAK_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SHM_OPEN_LINK = @SHM_OPEN_LINK@ +STRIP = @STRIP@ +SVG_CFLAGS = @SVG_CFLAGS@ +SVG_LIBS = @SVG_LIBS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +XCB_CFLAGS = @XCB_CFLAGS@ +XCB_GL_CFLAGS = @XCB_GL_CFLAGS@ +XCB_GL_LIBS = @XCB_GL_LIBS@ +XCB_LIBS = @XCB_LIBS@ +XEXT_CFLAGS = @XEXT_CFLAGS@ +XEXT_LIBS = @XEXT_LIBS@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +altivec_cflags = @altivec_cflags@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +evas_engine_buffer_cflags = @evas_engine_buffer_cflags@ +evas_engine_buffer_libs = @evas_engine_buffer_libs@ +evas_engine_direct3d_cflags = @evas_engine_direct3d_cflags@ +evas_engine_direct3d_libs = @evas_engine_direct3d_libs@ +evas_engine_directfb_cflags = @evas_engine_directfb_cflags@ +evas_engine_directfb_libs = @evas_engine_directfb_libs@ +evas_engine_fb_cflags = @evas_engine_fb_cflags@ +evas_engine_fb_libs = @evas_engine_fb_libs@ +evas_engine_gl_cocoa_cflags = @evas_engine_gl_cocoa_cflags@ +evas_engine_gl_cocoa_libs = @evas_engine_gl_cocoa_libs@ +evas_engine_gl_common_libs = @evas_engine_gl_common_libs@ +evas_engine_gl_sdl_cflags = @evas_engine_gl_sdl_cflags@ +evas_engine_gl_sdl_libs = @evas_engine_gl_sdl_libs@ +evas_engine_gl_xcb_cflags = @evas_engine_gl_xcb_cflags@ +evas_engine_gl_xcb_libs = @evas_engine_gl_xcb_libs@ +evas_engine_gl_xlib_cflags = @evas_engine_gl_xlib_cflags@ +evas_engine_gl_xlib_libs = @evas_engine_gl_xlib_libs@ +evas_engine_psl1ght_cflags = @evas_engine_psl1ght_cflags@ +evas_engine_psl1ght_libs = @evas_engine_psl1ght_libs@ +evas_engine_software_16_ddraw_cflags = @evas_engine_software_16_ddraw_cflags@ +evas_engine_software_16_ddraw_libs = @evas_engine_software_16_ddraw_libs@ +evas_engine_software_16_sdl_cflags = @evas_engine_software_16_sdl_cflags@ +evas_engine_software_16_sdl_libs = @evas_engine_software_16_sdl_libs@ +evas_engine_software_16_wince_cflags = @evas_engine_software_16_wince_cflags@ +evas_engine_software_16_wince_libs = @evas_engine_software_16_wince_libs@ +evas_engine_software_16_x11_cflags = @evas_engine_software_16_x11_cflags@ +evas_engine_software_16_x11_libs = @evas_engine_software_16_x11_libs@ +evas_engine_software_8_x11_cflags = @evas_engine_software_8_x11_cflags@ +evas_engine_software_8_x11_libs = @evas_engine_software_8_x11_libs@ +evas_engine_software_ddraw_cflags = @evas_engine_software_ddraw_cflags@ +evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@ +evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@ +evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@ +evas_engine_software_sdl_cflags = @evas_engine_software_sdl_cflags@ +evas_engine_software_sdl_libs = @evas_engine_software_sdl_libs@ +evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@ +evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@ +evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@ +evas_engine_software_xlib_libs = @evas_engine_software_xlib_libs@ +evas_image_loader_bmp_cflags = @evas_image_loader_bmp_cflags@ +evas_image_loader_bmp_libs = @evas_image_loader_bmp_libs@ +evas_image_loader_edb_cflags = @evas_image_loader_edb_cflags@ +evas_image_loader_edb_libs = @evas_image_loader_edb_libs@ +evas_image_loader_eet_cflags = @evas_image_loader_eet_cflags@ +evas_image_loader_eet_libs = @evas_image_loader_eet_libs@ +evas_image_loader_generic_cflags = @evas_image_loader_generic_cflags@ +evas_image_loader_generic_libs = @evas_image_loader_generic_libs@ +evas_image_loader_gif_cflags = @evas_image_loader_gif_cflags@ +evas_image_loader_gif_libs = @evas_image_loader_gif_libs@ +evas_image_loader_ico_cflags = @evas_image_loader_ico_cflags@ +evas_image_loader_ico_libs = @evas_image_loader_ico_libs@ +evas_image_loader_jpeg_cflags = @evas_image_loader_jpeg_cflags@ +evas_image_loader_jpeg_libs = @evas_image_loader_jpeg_libs@ +evas_image_loader_pmaps_cflags = @evas_image_loader_pmaps_cflags@ +evas_image_loader_pmaps_libs = @evas_image_loader_pmaps_libs@ +evas_image_loader_png_cflags = @evas_image_loader_png_cflags@ +evas_image_loader_png_libs = @evas_image_loader_png_libs@ +evas_image_loader_psd_cflags = @evas_image_loader_psd_cflags@ +evas_image_loader_psd_libs = @evas_image_loader_psd_libs@ +evas_image_loader_svg_cflags = @evas_image_loader_svg_cflags@ +evas_image_loader_svg_libs = @evas_image_loader_svg_libs@ +evas_image_loader_tga_cflags = @evas_image_loader_tga_cflags@ +evas_image_loader_tga_libs = @evas_image_loader_tga_libs@ +evas_image_loader_tiff_cflags = @evas_image_loader_tiff_cflags@ +evas_image_loader_tiff_libs = @evas_image_loader_tiff_libs@ +evas_image_loader_wbmp_cflags = @evas_image_loader_wbmp_cflags@ +evas_image_loader_wbmp_libs = @evas_image_loader_wbmp_libs@ +evas_image_loader_xpm_cflags = @evas_image_loader_xpm_cflags@ +evas_image_loader_xpm_libs = @evas_image_loader_xpm_libs@ +exec_prefix = @exec_prefix@ +have_evas_engine_gl_x11 = @have_evas_engine_gl_x11@ +have_evas_engine_gl_xcb = @have_evas_engine_gl_xcb@ +have_evas_engine_gl_xlib = @have_evas_engine_gl_xlib@ +have_evas_engine_software_x11 = @have_evas_engine_software_x11@ +have_evas_engine_software_xcb = @have_evas_engine_software_xcb@ +have_evas_engine_software_xlib = @have_evas_engine_software_xlib@ +have_lcov = @have_lcov@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pthread_cflags = @pthread_cflags@ +pthread_libs = @pthread_libs@ +release_info = @release_info@ +requirement_evas = @requirement_evas@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in + +#put here all EDCs one needs to the tests +EDCS = aspect.edc +filesdir = $(datadir)/$(PACKAGE)/examples +files_DATA = $(am__append_3) $(am__append_4) + +#the ones using ecore_evas follow + +#the ones using ecore_evas and edje follow +@BUILD_EXAMPLES_TRUE@AM_CPPFLAGS = -I. -I$(top_srcdir)/src/lib \ +@BUILD_EXAMPLES_TRUE@ -I$(top_srcdir)/src/lib/include \ +@BUILD_EXAMPLES_TRUE@ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ +@BUILD_EXAMPLES_TRUE@ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@BUILD_EXAMPLES_TRUE@ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@BUILD_EXAMPLES_TRUE@ -DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\" \ +@BUILD_EXAMPLES_TRUE@ @EINA_CFLAGS@ @FREETYPE_CFLAGS@ \ +@BUILD_EXAMPLES_TRUE@ @PIXMAN_CFLAGS@ @FRIBIDI_CFLAGS@ \ +@BUILD_EXAMPLES_TRUE@ @EET_CFLAGS@ @FONTCONFIG_CFLAGS@ \ +@BUILD_EXAMPLES_TRUE@ @pthread_cflags@ $(am__append_1) \ +@BUILD_EXAMPLES_TRUE@ @ECORE_EVAS_CFLAGS@ @EDJE_CFLAGS@ \ +@BUILD_EXAMPLES_TRUE@ $(am__empty) +@BUILD_EXAMPLES_TRUE@AM_CFLAGS = @WIN32_CFLAGS@ +@BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@evas_buffer_simple_SOURCES = evas-buffer-simple.c +@BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@evas_buffer_simple_LDADD = $(top_builddir)/src/lib/libevas.la +@BUILD_EXAMPLES_TRUE@evas_init_shutdown_SOURCES = evas-init-shutdown.c +@BUILD_EXAMPLES_TRUE@evas_init_shutdown_LDADD = $(top_builddir)/src/lib/libevas.la +@BUILD_EXAMPLES_TRUE@evas_images_SOURCES = evas-images.c +@BUILD_EXAMPLES_TRUE@evas_images_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_events_SOURCES = evas-events.c +@BUILD_EXAMPLES_TRUE@evas_events_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_object_manipulation_SOURCES = evas-object-manipulation.c +@BUILD_EXAMPLES_TRUE@evas_object_manipulation_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_hints_SOURCES = evas-hints.c +@BUILD_EXAMPLES_TRUE@evas_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_stacking_SOURCES = evas-stacking.c +@BUILD_EXAMPLES_TRUE@evas_stacking_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_images2_SOURCES = evas-images2.c +@BUILD_EXAMPLES_TRUE@evas_images2_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_text_SOURCES = evas-text.c +@BUILD_EXAMPLES_TRUE@evas_text_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_smart_object_SOURCES = evas-smart-object.c +@BUILD_EXAMPLES_TRUE@evas_smart_object_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_box_SOURCES = evas-box.c +@BUILD_EXAMPLES_TRUE@evas_box_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EINA_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_aspect_hints_DEPS = $(srcdir)/aspect.edc +@BUILD_EXAMPLES_TRUE@evas_aspect_hints_SOURCES = evas-aspect-hints.c +@BUILD_EXAMPLES_TRUE@evas_aspect_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EDJE_LIBS@ +@BUILD_EXAMPLES_TRUE@evas_map_utils_SOURCES = evas-map-utils.c +@BUILD_EXAMPLES_TRUE@evas_map_utils_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ +@BUILD_EXAMPLES_TRUE@EDJS = $(EDCS:%.edc=%.edj) +EXTRA_DIST = $(EDCS) \ + $(srcdir)/evas-buffer-simple.c \ + $(srcdir)/evas-init-shutdown.c \ + $(srcdir)/evas-images.c \ + $(srcdir)/evas-images2.c \ + $(srcdir)/evas-object-manipulation.c \ + $(srcdir)/evas-events.c \ + $(srcdir)/evas-aspect-hints.c \ + $(srcdir)/evas-hints.c \ + $(srcdir)/evas-stacking.c \ + $(srcdir)/evas-map-utils.c \ + $(srcdir)/evas-text.c \ + $(srcdir)/evas-smart-object.c \ + $(srcdir)/evas-box.c \ + $(srcdir)/enlightenment.png \ + $(srcdir)/red.png \ + $(srcdir)/im1.png \ + $(srcdir)/cube1.png + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .edc .edj .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkglibPROGRAMS: $(pkglib_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" + @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkglibdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkglibdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-pkglibPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkglibdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkglibdir)" && rm -f $$files + +clean-pkglibPROGRAMS: + @list='$(pkglib_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +evas_aspect_hints$(EXEEXT): $(evas_aspect_hints_OBJECTS) $(evas_aspect_hints_DEPENDENCIES) + @rm -f evas_aspect_hints$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_aspect_hints_OBJECTS) $(evas_aspect_hints_LDADD) $(LIBS) +evas_box$(EXEEXT): $(evas_box_OBJECTS) $(evas_box_DEPENDENCIES) + @rm -f evas_box$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_box_OBJECTS) $(evas_box_LDADD) $(LIBS) +evas_buffer_simple$(EXEEXT): $(evas_buffer_simple_OBJECTS) $(evas_buffer_simple_DEPENDENCIES) + @rm -f evas_buffer_simple$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_buffer_simple_OBJECTS) $(evas_buffer_simple_LDADD) $(LIBS) +evas_events$(EXEEXT): $(evas_events_OBJECTS) $(evas_events_DEPENDENCIES) + @rm -f evas_events$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_events_OBJECTS) $(evas_events_LDADD) $(LIBS) +evas_hints$(EXEEXT): $(evas_hints_OBJECTS) $(evas_hints_DEPENDENCIES) + @rm -f evas_hints$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_hints_OBJECTS) $(evas_hints_LDADD) $(LIBS) +evas_images$(EXEEXT): $(evas_images_OBJECTS) $(evas_images_DEPENDENCIES) + @rm -f evas_images$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_images_OBJECTS) $(evas_images_LDADD) $(LIBS) +evas_images2$(EXEEXT): $(evas_images2_OBJECTS) $(evas_images2_DEPENDENCIES) + @rm -f evas_images2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_images2_OBJECTS) $(evas_images2_LDADD) $(LIBS) +evas_init_shutdown$(EXEEXT): $(evas_init_shutdown_OBJECTS) $(evas_init_shutdown_DEPENDENCIES) + @rm -f evas_init_shutdown$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_init_shutdown_OBJECTS) $(evas_init_shutdown_LDADD) $(LIBS) +evas_map_utils$(EXEEXT): $(evas_map_utils_OBJECTS) $(evas_map_utils_DEPENDENCIES) + @rm -f evas_map_utils$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_map_utils_OBJECTS) $(evas_map_utils_LDADD) $(LIBS) +evas_object_manipulation$(EXEEXT): $(evas_object_manipulation_OBJECTS) $(evas_object_manipulation_DEPENDENCIES) + @rm -f evas_object_manipulation$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_object_manipulation_OBJECTS) $(evas_object_manipulation_LDADD) $(LIBS) +evas_smart_object$(EXEEXT): $(evas_smart_object_OBJECTS) $(evas_smart_object_DEPENDENCIES) + @rm -f evas_smart_object$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_smart_object_OBJECTS) $(evas_smart_object_LDADD) $(LIBS) +evas_stacking$(EXEEXT): $(evas_stacking_OBJECTS) $(evas_stacking_DEPENDENCIES) + @rm -f evas_stacking$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_stacking_OBJECTS) $(evas_stacking_LDADD) $(LIBS) +evas_text$(EXEEXT): $(evas_text_OBJECTS) $(evas_text_DEPENDENCIES) + @rm -f evas_text$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(evas_text_OBJECTS) $(evas_text_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-aspect-hints.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-box.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-buffer-simple.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-events.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-hints.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-images.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-images2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-init-shutdown.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-map-utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-object-manipulation.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-smart-object.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-stacking.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-text.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-filesDATA: $(files_DATA) + @$(NORMAL_INSTALL) + test -z "$(filesdir)" || $(MKDIR_P) "$(DESTDIR)$(filesdir)" + @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filesdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(filesdir)" || exit $$?; \ + done + +uninstall-filesDATA: + @$(NORMAL_UNINSTALL) + @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(filesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(filesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkglibPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filesDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-filesDATA uninstall-pkglibPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkglibPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-filesDATA \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-pkglibPROGRAMS \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-filesDATA \ + uninstall-pkglibPROGRAMS + + +@BUILD_EXAMPLES_TRUE@aspect.edj: ${evas_aspect_hints_DEPS} + +@BUILD_EXAMPLES_TRUE@.edc.edj: +@BUILD_EXAMPLES_TRUE@ $(edje_cc) -v -id $(srcdir) $< $(builddir)/$(@F) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/evas/src/examples/aspect.edc b/libraries/evas/src/examples/aspect.edc new file mode 100644 index 0000000..b8bfb31 --- /dev/null +++ b/libraries/evas/src/examples/aspect.edc @@ -0,0 +1,17 @@ +collections { + group { + name: "main"; + parts { + part { + name: "content"; + mouse_events: 0; + type: SWALLOW; + description { + state: "default" 0.0; + visible: 1; + } + } + } + } +} + diff --git a/libraries/evas/src/examples/cube1.png b/libraries/evas/src/examples/cube1.png new file mode 100644 index 0000000..c2f4fda Binary files /dev/null and b/libraries/evas/src/examples/cube1.png differ diff --git a/libraries/evas/src/examples/enlightenment.png b/libraries/evas/src/examples/enlightenment.png new file mode 100644 index 0000000..aeb836b Binary files /dev/null and b/libraries/evas/src/examples/enlightenment.png differ diff --git a/libraries/evas/src/examples/evas-aspect-hints.c b/libraries/evas/src/examples/evas-aspect-hints.c new file mode 100644 index 0000000..de8ed50 --- /dev/null +++ b/libraries/evas/src/examples/evas-aspect-hints.c @@ -0,0 +1,249 @@ +/** + * Simple Evas example illustrating aspect control hints on objects. + * + * You'll need at least one engine built for it (excluding the buffer + * one) and the png image loader also built. See stdout/stderr for + * output. + * + * You'll also need @b Edje for this one, as it has the only smart + * object implementing aspect control for children. + * + * @verbatim + * gcc -o evas-events evas-events.c `pkg-config --libs --cflags ecore-evas edje` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#define WIDTH 320 +#define HEIGHT 480 + +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; +static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/aspect.edj"; + +struct test_data +{ + Ecore_Evas *ee; + Evas *canvas; + Evas_Object *bg, *rect, *container, *border; +}; + +static struct test_data d = {0}; + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +static const char * +_get_aspect_name(Evas_Aspect_Control aspect) +{ + switch (aspect) + { + case 0: + return "NONE"; + + case 1: + return "NEITHER"; + + case 2: + return "HORIZONTAL"; + + case 3: + return "VERTICAL"; + + case 4: + return "BOTH"; + + default: + return "INVALID"; + } +} + +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o, + void *einfo) +{ + const Evas_Modifier *mods; + Evas_Event_Key_Down *ev = einfo; + + mods = evas_key_modifier_get(evas_object_evas_get(o)); + + if (evas_key_modifier_is_set(mods, "Shift") && + strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, "commands are:\n" + "\tc - cycle aspect control on object\n" + "\th - change horizontal aspect component\n" + "\tv - change vertical aspect component\n" + "\ts - print current object's status\n" + "\tH - print help\n"); + return; + } + + if (strcmp(ev->keyname, "s") == 0) /* get aspect status of the obj */ + { + Evas_Coord w, h; + Evas_Aspect_Control aspect; + + evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); + + fprintf(stdout, "Object has aspect %s, with horizontal compontent %d" + " and vertical compontent %d\n", + _get_aspect_name(aspect), w, h); + + return; + } + + if (strcmp(ev->keyname, "c") == 0) /* cycle aspect control on obj */ + { + Evas_Coord w, h; + Evas_Aspect_Control aspect; + + evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); + + aspect = (aspect + 1) % 5; + + evas_object_size_hint_aspect_set(d.rect, aspect, w, h); + + fprintf(stdout, "Changing aspect control to %s\n", + _get_aspect_name(aspect)); + + return; + } + + if (strcmp(ev->keyname, "h") == 0) /* change horizontal aspect component */ + { + Evas_Coord w, h; + Evas_Aspect_Control aspect; + + evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); + + w = (w + 1) % 3; + + evas_object_size_hint_aspect_set(d.rect, aspect, w, h); + + fprintf(stdout, "Changing horizontal aspect component to %d\n", w); + + return; + } + + if (strcmp(ev->keyname, "v") == 0) /* change vertical aspect component */ + { + Evas_Coord w, h; + Evas_Aspect_Control aspect; + + evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); + + h = (h + 1) % 3; + + evas_object_size_hint_aspect_set(d.rect, aspect, w, h); + + fprintf(stdout, "Changing vertical aspect component to %d\n", h); + + return; + } +} + +int +main(void) +{ + Eina_Bool ret; + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + if (!edje_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.canvas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.canvas); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(d.bg, 0, 0); /* at canvas' origin */ + evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + d.container = edje_object_add(d.canvas); + ret = edje_object_file_set(d.container, edje_file_path, "main"); + if (!ret) + { + Edje_Load_Error err = edje_object_load_error_get(d.container); + const char *msg = edje_load_error_str(err); + fprintf(stderr, "could not load 'main' from %s: %s", + edje_file_path, msg); + + goto panic; + } + + evas_object_move(d.container, (WIDTH / 4), (HEIGHT / 4)); + evas_object_resize(d.container, (WIDTH / 2), (HEIGHT / 2)); + evas_object_show(d.container); + + d.rect = evas_object_rectangle_add(d.canvas); + evas_object_color_set(d.rect, 0, 0, 255, 255); + evas_object_size_hint_aspect_set(d.rect, EVAS_ASPECT_CONTROL_NONE, 1, 1); + evas_object_show(d.rect); + + edje_object_part_swallow(d.container, "content", d.rect); + evas_object_smart_changed(d.container); + + /* this is a border around the edje object, container of the + * rectangle we are going to experiment with (change its aspect + * hints). this way you can see how their sizes relate */ + d.border = evas_object_image_filled_add(d.canvas); + evas_object_image_file_set(d.border, border_img_path, NULL); + evas_object_image_border_set(d.border, 3, 3, 3, 3); + evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); + evas_object_move(d.border, (WIDTH / 4) - 3, (HEIGHT / 4) - 3); + evas_object_resize(d.border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); + evas_object_show(d.border); + + ecore_main_loop_begin(); + + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + edje_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); +panic: + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + edje_shutdown(); + + return -1; +} diff --git a/libraries/evas/src/examples/evas-box.c b/libraries/evas/src/examples/evas-box.c new file mode 100644 index 0000000..13f12cf --- /dev/null +++ b/libraries/evas/src/examples/evas-box.c @@ -0,0 +1,382 @@ +/** + * Simple Evas example illustrating a custom Evas box object + * + * You'll need at least one engine built for it (excluding the buffer + * one). See stdout/stderr for output. + * + * @verbatim + * gcc -o evas-box evas-box.c `pkg-config --libs --cflags evas ecore ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else +#define PACKAGE_EXAMPLES_DIR "." +#define __UNUSED__ +#endif + +#include +#include + +#include +#include +#include + +#define WIDTH (640) +#define HEIGHT (480) + +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; + +static const char *commands = \ + "commands are:\n" + "\ta - change the box's alignment values\n" + "\tp - change the box's padding values\n" + "\t1 - change the box's layout to horizontal\n" + "\t2 - change the box's layout to vertical\n" + "\t3 - change the box's layout to horizontal homogeneous\n" + "\t4 - change the box's layout to vertical homogeneous\n" + "\t5 - change the box's layout to horizontal maximum size homogeneous\n" + "\t6 - change the box's layout to vertical maximum size homogeneous\n" + "\t7 - change the box's layout to horizontal flow\n" + "\t8 - change the box's layout to vertical flow\n" + "\t9 - change the box's layout to stack\n" + "\t0 - change the box's layout to a custom-made one\n" + "\tCtrl + NUMBER - insert a new child object at that position in the box\n" + "\tShift + NUMBER - remove the child object at that position in the box\n" + "\th - print help\n"; + +struct exemple_data +{ + Ecore_Evas *ee; + Evas *evas; + Evas_Object *bg, *box, *border; +}; + +static struct exemple_data d; + +static void /* custom 'diagonal' layout */ +_custom_layout(Evas_Object *o, + Evas_Object_Box_Data *p, + void *data __UNUSED__) +{ + int x, y, w, h; + int xx, yy, ww, hh; + int count; + Eina_List *l; + Evas_Object_Box_Option *opt; + + evas_object_geometry_get(o, &x, &y, &w, &h); + count = eina_list_count(p->children); + ww = w / (count ? : 1); + hh = h / (count ? : 1); + if (ww < 1) ww = 1; + if (hh < 1) hh = 1; + + xx = x; + yy = y; + EINA_LIST_FOREACH(p->children, l, opt) + { + evas_object_move(opt->obj, xx, yy); + xx += ww; + yy += hh; + } +} + +static Evas_Object * /* new rectangle to be put in the box */ +_new_rectangle_add(Evas *e) +{ + Evas_Object *o; + + o = evas_object_rectangle_add(e); + evas_object_resize(o, 10, 10); + evas_object_color_set(o, 0, 255, 0, 255); + evas_object_show(o); + + return o; +} + +/* use the following commands to interact with this example - 'h' is + * the key for help */ +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + const Evas_Modifier *mods = evas_key_modifier_get(evas); + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (evas_key_modifier_is_set(mods, "Shift")) + { + int pos; + Eina_Bool ret; + Evas_Object *obj; + Eina_List *children; + + pos = atoi(ev->keyname); + children = evas_object_box_children_get(d.box); + + obj = eina_list_nth(children, pos); + if (!obj) goto list_free; + + ret = evas_object_box_remove_at(d.box, pos); + if (ret) evas_object_del(obj); + +list_free: + eina_list_free(children); + return; + } + + if (evas_key_modifier_is_set(mods, "Control")) + { + Evas_Object *o; + int pos; + pos = atoi(ev->keyname); + o = _new_rectangle_add(d.evas); + if (!evas_object_box_insert_at(d.box, o, pos)) + evas_object_box_append(d.box, o); + return; + } + + if (strcmp(ev->keyname, "a") == 0) + { + double h, v; + + evas_object_box_align_get(d.box, &h, &v); + + if (h == 0.5) + h = v = 1.0; + else if (h == 1.0) + h = v = -1.0; + else if (h == -1.0) + h = v = 0.0; + else if (h == 0.0) + h = v = 0.5; + + evas_object_box_align_set(d.box, h, v); + + fprintf(stdout, "Applying new alignment values (%.1f, %.1f)" + " on the box\n", h, v); + return; + } + + if (strcmp(ev->keyname, "p") == 0) + { + int h, v; + + evas_object_box_padding_get(d.box, &h, &v); + + if (h == 0) + h = v = 50; + else + h = v = 0; + + evas_object_box_padding_set(d.box, h, v); + + fprintf(stdout, "Applying new padding values (%d, %d)" + " on the box\n", h, v); + return; + } + + if (strcmp(ev->keyname, "1") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_horizontal, NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", "horizontal"); + return; + } + + if (strcmp(ev->keyname, "2") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_vertical, NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", "vertical"); + return; + } + + if (strcmp(ev->keyname, "3") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_homogeneous_horizontal, NULL, + NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", + "horizontal homogeneous"); + return; + } + + if (strcmp(ev->keyname, "4") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_homogeneous_vertical, NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", + "vertical homogeneous"); + return; + } + + if (strcmp(ev->keyname, "5") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_homogeneous_max_size_horizontal, + NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", + "horizontal maximum size homogeneous"); + return; + } + + if (strcmp(ev->keyname, "6") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_homogeneous_max_size_vertical, + NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", + "vertical maximum size homogeneous"); + return; + } + + if (strcmp(ev->keyname, "7") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_flow_horizontal, NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", "horizontal flow"); + return; + } + + if (strcmp(ev->keyname, "8") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_flow_vertical, NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", "vertical flow"); + return; + } + + if (strcmp(ev->keyname, "9") == 0) + { + evas_object_box_layout_set( + d.box, evas_object_box_layout_stack, NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", "stack"); + return; + } + + if (strcmp(ev->keyname, "0") == 0) + { + evas_object_box_layout_set(d.box, _custom_layout, NULL, NULL); + + fprintf(stdout, "Applying '%s' layout on the box\n", "CUSTOM"); + return; + } +} + +static void +_on_delete(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +static void /* adjust canvas' contents on resizes */ +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + + evas_object_resize(d.bg, w, h); + + evas_object_move(d.box, (w / 4), (h / 4)); + evas_object_resize(d.box, (w / 2), (h / 2)); + + evas_object_move(d.border, (w / 4) - 2, (h / 4) - 2); + evas_object_resize(d.border, (w / 2) + 4, (h / 2) + 4); +} + +int +main(void) +{ + Evas_Object *last, *o; + int i; + + srand(time(NULL)); + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto panic; + + ecore_evas_callback_delete_request_set(d.ee, _on_delete); + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + d.evas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.evas); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + d.box = evas_object_box_add(d.evas); + evas_object_show(d.box); + + for (i = 1; i <= 5; i++) + { + o = last = evas_object_rectangle_add(d.evas); + evas_object_size_hint_min_set(o, 50, 50); + evas_object_color_set( + o, rand() % 256, rand() % 256, rand() % 256, 255); + evas_object_show(o); + + if (!evas_object_box_append(d.box, o)) + { + fprintf(stderr, "Error appending child object on the box!\n"); + goto error; + } + } + + /* this is a border around the box, container of the rectangles we + * are going to experiment with. this way you can see how the + * container relates to the children */ + d.border = evas_object_image_filled_add(d.evas); + evas_object_image_file_set(d.border, border_img_path, NULL); + evas_object_image_border_set(d.border, 2, 2, 2, 2); + evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); + evas_object_show(d.border); + + fprintf(stdout, commands); + + _canvas_resize_cb(d.ee); + ecore_main_loop_begin(); + ecore_evas_shutdown(); + return 0; + +error: + ecore_evas_shutdown(); + return -1; + +panic: + fprintf(stderr, "You got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); + return -2; +} + diff --git a/libraries/evas/src/examples/evas-buffer-simple.c b/libraries/evas/src/examples/evas-buffer-simple.c new file mode 100644 index 0000000..6676ef1 --- /dev/null +++ b/libraries/evas/src/examples/evas-buffer-simple.c @@ -0,0 +1,228 @@ +/** + * Simple Evas example using the Buffer engine. + * + * You must have Evas compiled with the buffer engine, and have the + * evas-software-buffer pkg-config files installed. + * + * Compile with: + * + * @verbatim + * gcc -o evas-buffer-simple evas-buffer-simple.c `pkg-config --libs --cflags evas evas-software-buffer` + * @endverbatim + * + */ +#include +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +/* + * create_canvas(), destroy_canvas() and draw_scene() are support functions. + * + * They are only required to use raw Evas, but for real world usage, + * it is recommended to use ecore and its ecore-evas submodule, that + * provide convenience canvas creators, integration with main loop and + * automatic render of updates (draw_scene()) when system goes back to + * main loop. + */ +static Evas *create_canvas(int width, int height); +static void destroy_canvas(Evas *canvas); +static void draw_scene(Evas *canvas); + +// support function to save scene as PPM image +static void save_scene(Evas *canvas, const char *dest); + +int main(void) +{ + Evas *canvas; + Evas_Object *bg, *r1, *r2, *r3; + + evas_init(); + + // create your canvas + // NOTE: consider using ecore_evas_buffer_new() instead! + canvas = create_canvas(WIDTH, HEIGHT); + if (!canvas) + return -1; + + bg = evas_object_rectangle_add(canvas); + evas_object_color_set(bg, 255, 255, 255, 255); // white bg + evas_object_move(bg, 0, 0); // at origin + evas_object_resize(bg, WIDTH, HEIGHT); // covers full canvas + evas_object_show(bg); + + puts("initial scene, with just background:"); + draw_scene(canvas); + + r1 = evas_object_rectangle_add(canvas); + evas_object_color_set(r1, 255, 0, 0, 255); // 100% opaque red + evas_object_move(r1, 10, 10); + evas_object_resize(r1, 100, 100); + evas_object_show(r1); + + // pay attention to transparency! Evas color values are pre-multiplied by + // alpha, so 50% opaque green is: + // non-premul: r=0, g=255, b=0 a=128 (50% alpha) + // premul: + // r_premul = r * a / 255 = 0 * 128 / 255 = 0 + // g_premul = g * a / 255 = 255 * 128 / 255 = 128 + // b_premul = b * a / 255 = 0 * 128 / 255 = 0 + // + // this 50% green is over a red background, so it will show in the + // final output as yellow (green + red = yellow) + r2 = evas_object_rectangle_add(canvas); + evas_object_color_set(r2, 0, 128, 0, 128); // 50% opaque green + evas_object_move(r2, 10, 10); + evas_object_resize(r2, 50, 50); + evas_object_show(r2); + + r3 = evas_object_rectangle_add(canvas); + evas_object_color_set(r3, 0, 128, 0, 255); // 100% opaque dark green + evas_object_move(r3, 60, 60); + evas_object_resize(r3, 50, 50); + evas_object_show(r3); + + puts("final scene (note updates):"); + draw_scene(canvas); + save_scene(canvas, "/tmp/evas-buffer-simple-render.ppm"); + + // NOTE: use ecore_evas_buffer_new() and here ecore_evas_free() + destroy_canvas(canvas); + + evas_shutdown(); + + return 0; +} + +static Evas *create_canvas(int width, int height) +{ + Evas *canvas; + Evas_Engine_Info_Buffer *einfo; + int method; + void *pixels; + + method = evas_render_method_lookup("buffer"); + if (method <= 0) + { + fputs("ERROR: evas was not compiled with 'buffer' engine!\n", stderr); + return NULL; + } + + canvas = evas_new(); + if (!canvas) + { + fputs("ERROR: could not instantiate new evas canvas.\n", stderr); + return NULL; + } + + evas_output_method_set(canvas, method); + evas_output_size_set(canvas, width, height); + evas_output_viewport_set(canvas, 0, 0, width, height); + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); + if (!einfo) + { + fputs("ERROR: could not get evas engine info!\n", stderr); + evas_free(canvas); + return NULL; + } + + // ARGB32 is sizeof(int), that is 4 bytes, per pixel + pixels = malloc(width * height * sizeof(int)); + if (!pixels) + { + fputs("ERROR: could not allocate canvas pixels!\n", stderr); + evas_free(canvas); + return NULL; + } + + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + einfo->info.dest_buffer = pixels; + einfo->info.dest_buffer_row_bytes = width * sizeof(int); + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + evas_engine_info_set(canvas, (Evas_Engine_Info *)einfo); + + return canvas; +} + +static void destroy_canvas(Evas *canvas) +{ + Evas_Engine_Info_Buffer *einfo; + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); + if (!einfo) + { + fputs("ERROR: could not get evas engine info!\n", stderr); + evas_free(canvas); + return; + } + + free(einfo->info.dest_buffer); + evas_free(canvas); +} + +static void draw_scene(Evas *canvas) +{ + Eina_List *updates, *n; + Eina_Rectangle *update; + + // render and get the updated rectangles: + updates = evas_render_updates(canvas); + + // informative only here, just print the updated areas: + EINA_LIST_FOREACH(updates, n, update) + printf("UPDATED REGION: pos: %3d, %3d size: %3dx%3d\n", + update->x, update->y, update->w, update->h); + + // free list of updates + evas_render_updates_free(updates); +} + +static void save_scene(Evas *canvas, const char *dest) +{ + Evas_Engine_Info_Buffer *einfo; + const unsigned int *pixels, *pixels_end; + int width, height; + FILE *f; + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); + if (!einfo) + { + fputs("ERROR: could not get evas engine info!\n", stderr); + return; + } + evas_output_size_get(canvas, &width, &height); + + f = fopen(dest, "wb+"); + if (!f) + { + fprintf(stderr, "ERROR: could not open for writing '%s': %s\n", + dest, strerror(errno)); + return; + } + + pixels = einfo->info.dest_buffer; + pixels_end = pixels + (width * height); + + // PPM P6 format is dead simple to write: + fprintf(f, "P6\n%d %d\n255\n", width, height); + for (; pixels < pixels_end; pixels++) + { + int r, g, b; + + r = ((*pixels) & 0xff0000) >> 16; + g = ((*pixels) & 0x00ff00) >> 8; + b = (*pixels) & 0x0000ff; + + fprintf(f, "%c%c%c", r, g, b); + } + + fclose(f); + printf("saved scene as '%s'\n", dest); +} diff --git a/libraries/evas/src/examples/evas-events.c b/libraries/evas/src/examples/evas-events.c new file mode 100644 index 0000000..28b22ed --- /dev/null +++ b/libraries/evas/src/examples/evas-events.c @@ -0,0 +1,413 @@ +/** + * Simple Evas example illustrating how to interact with canvas' (and + * its objects') events and other canvas operations. + * + * You'll need at least one engine built for it (excluding the buffer + * one) and the png image loader also built. See stdout/stderr for + * output. + * + * @verbatim + * gcc -o evas-events evas-events.c `pkg-config --libs --cflags evas ecore ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else + +#define PACKAGE_EXAMPLES_DIR "." +#define __UNUSED__ + +#endif + +#include +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +static const char *img_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; + +static const char *commands = \ + "commands are:\n" + "\ta - toggle animation timer\n" + "\tc - cycle between focus and key grabs for key input\n" + "\td - delete canvas callbacks\n" + "\tf - freeze input for 3 seconds\n" + "\tp - toggle precise point collision detection on image\n" + "\tControl + o - add an obscured rectangle\n" + "\th - print help\n"; + +struct test_data +{ + Ecore_Evas *ee; + Evas *canvas; + Evas_Object *img, *bg; + Ecore_Timer *resize_timer, *freeze_timer; + Eina_Bool obscured, focus; +}; + +static struct test_data d = {0}; + +/* here to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +/* called when our rectangle gets focus */ +static void +_object_focus_in_cb(void *data __UNUSED__, + Evas *e, + void *event_info) +{ + fprintf(stdout, "An object got focused: %s\n", + evas_object_name_get(event_info)); + + fprintf(stdout, "Let's recheck it: %s\n", + evas_object_name_get(evas_focus_get(e))); + + fprintf(stdout, "And again: %s\n", evas_object_focus_get(event_info) ? + "OK!" : "Oops, something is bad."); +} + +/* render flush callback */ +static void +_render_flush_cb(void *data __UNUSED__, + Evas *e __UNUSED__, + void *event_info __UNUSED__) +{ + fprintf(stdout, "Canvas is about to flush its rendering pipeline!\n"); +} + +/* put some action in the canvas */ +static Eina_Bool +_resize_cb(void *data __UNUSED__) +{ + int w, h, cw, ch; + + evas_object_geometry_get(d.img, NULL, NULL, &w, &h); + ecore_evas_geometry_get(d.ee, NULL, NULL, &cw, &ch); + + if (w < cw) + evas_object_resize(d.img, cw, ch); + else + evas_object_resize(d.img, cw / 2, ch / 2); + + return EINA_TRUE; /* re-issue the timer */ +} + +/* let's have our events back */ +static Eina_Bool +_thaw_cb(void *data __UNUSED__) +{ + fprintf(stdout, "Canvas was frozen %d times, now thawing.\n", + evas_event_freeze_get(d.canvas)); + evas_event_thaw(d.canvas); + return EINA_FALSE; /* do not re-issue the timer */ +} + +/* mouse enters the object's area */ +static void +_on_mouse_in(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo __UNUSED__) +{ + fprintf(stdout, "Enlightenment logo has had the mouse in.\n"); +} + +static void +_on_mouse_out(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo __UNUSED__) +{ + fprintf(stdout, "Enlightenment logo has had the mouse out.\n"); +} /* mouse exits the object's area */ + +/* examine the keys pressed */ +static void +_on_keydown(void *data __UNUSED__, + Evas *evas, + Evas_Object *o __UNUSED__, + void *einfo) +{ + const Evas_Modifier *mods; + Evas_Event_Key_Down *ev = einfo; + + fprintf(stdout, "We've got key input: %s\n", ev->keyname); + fprintf(stdout, "It actually came from %s\n", d.focus ? + "focus" : "key grab"); + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (strcmp(ev->keyname, "a") == 0) /* toggle animation timer */ + { + if (d.resize_timer != NULL) + { + fprintf(stdout, "Stopping animation timer\n"); + ecore_timer_del(d.resize_timer); + d.resize_timer = NULL; + } + else + { + fprintf(stdout, "Re-issuing animation timer\n"); + d.resize_timer = ecore_timer_add(2, _resize_cb, NULL); + } + return; + } + + if (strcmp(ev->keyname, "c") == 0) /* cycle between focus and key + * grabs for key input */ + { + Eina_Bool ret; + Evas_Modifier_Mask mask = + evas_key_modifier_mask_get(d.canvas, "Control"); + + fprintf(stdout, "Switching to %s for key input\n", d.focus ? + "key grabs" : "focus"); + + if (d.focus) + { + evas_object_focus_set(d.bg, EINA_FALSE); + fprintf(stdout, "Focused object is now %s\n", + evas_focus_get(d.canvas) ? + "still valid! Something went wrong." : "none."); + + ret = evas_object_key_grab(d.bg, "a", 0, 0, EINA_TRUE); + if (!ret) + { + fprintf(stdout, "Something went wrong with key grabs.\n"); + goto c_end; + } + ret = evas_object_key_grab(d.bg, "c", 0, 0, EINA_TRUE); + if (!ret) + { + fprintf(stdout, "Something went wrong with key grabs.\n"); + goto c_end; + } + ret = evas_object_key_grab(d.bg, "d", 0, 0, EINA_TRUE); + if (!ret) + { + fprintf(stdout, "Something went wrong with key grabs.\n"); + goto c_end; + } + ret = evas_object_key_grab(d.bg, "f", 0, 0, EINA_TRUE); + if (!ret) + { + fprintf(stdout, "Something went wrong with key grabs.\n"); + goto c_end; + } + ret = evas_object_key_grab(d.bg, "p", 0, 0, EINA_TRUE); + if (!ret) + { + fprintf(stdout, "Something went wrong with key grabs.\n"); + goto c_end; + } + ret = evas_object_key_grab(d.bg, "o", mask, 0, EINA_TRUE); + if (!ret) + { + fprintf(stdout, "Something went wrong with key grabs.\n"); + goto c_end; + } + ret = evas_object_key_grab(d.bg, "h", 0, 0, EINA_TRUE); + if (!ret) + { + fprintf(stdout, "Something went wrong with key grabs.\n"); + goto c_end; + } + } + else /* got here by key grabs */ + { + evas_object_key_ungrab(d.bg, "a", 0, 0); + evas_object_key_ungrab(d.bg, "c", 0, 0); + evas_object_key_ungrab(d.bg, "d", 0, 0); + evas_object_key_ungrab(d.bg, "f", 0, 0); + evas_object_key_ungrab(d.bg, "p", 0, 0); + evas_object_key_ungrab(d.bg, "o", mask, 0); + evas_object_key_ungrab(d.bg, "h", 0, 0); + + evas_object_focus_set(d.bg, EINA_TRUE); + } + +c_end: + d.focus = !d.focus; + + return; + } + + if (strcmp(ev->keyname, "d") == 0) /* delete canvas' callbacks */ + { + fprintf(stdout, "Deleting canvas event callbacks\n"); + evas_event_callback_del_full(evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, + _render_flush_cb, NULL); + evas_event_callback_del_full( + evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, + _object_focus_in_cb, NULL); + return; + } + + if (strcmp(ev->keyname, "f") == 0) /* freeze input for 3 seconds */ + { + fprintf(stdout, "Freezing input for 3 seconds\n"); + evas_event_freeze(evas); + d.freeze_timer = ecore_timer_add(3, _thaw_cb, NULL); + return; + } + + if (strcmp(ev->keyname, "p") == 0) /* toggle precise point + * collision detection */ + { + Eina_Bool precise = evas_object_precise_is_inside_get(d.img); + + fprintf(stdout, "Toggling precise point collision detection %s on" + " Enlightenment logo\n", precise ? "off" : "on"); + evas_object_precise_is_inside_set(d.img, !precise); + + return; + } + + mods = evas_key_modifier_get(evas); + if (evas_key_modifier_is_set(mods, "Control") && + (strcmp(ev->keyname, "o") == 0)) /* add an obscured + * rectangle to the middle + * of the canvas */ + { + fprintf(stdout, "Toggling obscured rectangle on canvas\n"); + if (!d.obscured) + { + int w, h; + evas_output_viewport_get(evas, NULL, NULL, &w, &h); + evas_obscured_rectangle_add(evas, w / 4, h / 4, w / 2, h / 2); + } + else + { + int w, h; + Eina_Rectangle *rect; + Eina_List *updates, *l; + + evas_output_viewport_get(evas, NULL, NULL, &w, &h); + evas_obscured_clear(evas); + + /* we have to flag a damage region here because + * evas_obscured_clear() doesn't change the canvas' + * state. we'd have to wait for an animation step, for + * example, to get the result, without it */ + evas_damage_rectangle_add(evas, 0, 0, w, h); + + updates = evas_render_updates(evas); + + EINA_LIST_FOREACH(updates, l, rect) + { + fprintf(stdout, "Rectangle (%d, %d, %d, %d) on canvas got a" + " rendering update.\n", rect->x, rect->y, + rect->w, + rect->h); + } + evas_render_updates_free(updates); + } + d.obscured = !d.obscured; + } /* end of obscured region command */ +} + +int +main(void) +{ + int err; + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.canvas = ecore_evas_get(d.ee); + + evas_event_callback_add(d.canvas, EVAS_CALLBACK_RENDER_FLUSH_PRE, + _render_flush_cb, NULL); + if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) + { + fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n"); + goto panic; + } + + evas_event_callback_add(d.canvas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, + _object_focus_in_cb, NULL); + if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) + { + fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n"); + goto panic; + } /* two canvas event callbacks */ + + d.bg = evas_object_rectangle_add(d.canvas); + evas_object_name_set(d.bg, "our dear rectangle"); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(d.bg, 0, 0); /* at canvas' origin */ + evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); /* so we get input events */ + d.focus = EINA_TRUE; + + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) + { + fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n"); + goto panic; + } + + d.img = evas_object_image_filled_add(d.canvas); + evas_object_image_file_set(d.img, img_path, NULL); + err = evas_object_image_load_error_get(d.img); + if (err != EVAS_LOAD_ERROR_NONE) + { + goto panic; + } + else + { + evas_object_move(d.img, 0, 0); + evas_object_resize(d.img, WIDTH, HEIGHT); + evas_object_show(d.img); + evas_object_event_callback_add( + d.img, EVAS_CALLBACK_MOUSE_IN, _on_mouse_in, NULL); + evas_object_event_callback_add( + d.img, EVAS_CALLBACK_MOUSE_OUT, _on_mouse_out, NULL); + } + + d.resize_timer = ecore_timer_add(2, _resize_cb, NULL); + + fprintf(stdout, commands); + ecore_main_loop_begin(); + + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); +panic: + ecore_evas_shutdown(); + return -1; +} diff --git a/libraries/evas/src/examples/evas-hints.c b/libraries/evas/src/examples/evas-hints.c new file mode 100644 index 0000000..c42444c --- /dev/null +++ b/libraries/evas/src/examples/evas-hints.c @@ -0,0 +1,375 @@ +/** + * Simple Evas example illustrating alignment, minimum size, maximum + * size, padding and weight hints on objects. + * + * To exemplify those hints, whe use the Evas box object, one of the + * managers using size hints to layout its children. + * + * You'll need at least one engine built for it (excluding the buffer + * one) and the png image loader also built. See stdout/stderr for + * output. + * + * @verbatim + * gcc -o evas-events evas-events.c `pkg-config --libs --cflags ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include +#include +#include + +#define WIDTH 320 +#define HEIGHT 480 + +static const char commands[] = \ + "commands are:\n" + "\tShift + a - change alignment hints on top rectangle\n" + "\tShift + m - change min. size hint on top rectangle\n" + "\tShift + n - change max. size hint on top rectangle\n" + "\tShift + p - change padding hints on top rectangle\n" + "\tShift + w - change weight hints on top rectangle\n\n" + "\tControl + a - change alignment hints on bottom rectangle\n" + "\tControl + m - change min. size hint on bottom rectangle\n" + "\tControl + n - change max. size hint on bottom rectangle\n" + "\tControl + p - change padding hints on bottom rectangle\n" + "\tControl + w - change weight hints on bottom rectangle\n\n" + "\ts - print current hints information\n" + "\th - print help\n"; + +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; + +struct coord_tuple +{ + Evas_Coord w, h; +}; + +struct weight_tuple +{ + double x, y; +}; + +struct padding_tuple +{ + Evas_Coord l, r, t, b; +}; + +struct rect_data +{ + struct coord_tuple *min_ptr; + struct coord_tuple min[4]; + + struct coord_tuple *max_ptr; + struct coord_tuple max[4]; + + struct weight_tuple *align_ptr; + struct weight_tuple align[3]; + + struct weight_tuple *weight_ptr; + struct weight_tuple weight[3]; + + struct padding_tuple *padding_ptr; + struct padding_tuple padding[3]; +}; + +struct test_data +{ + Ecore_Evas *ee; + Evas *canvas; + struct rect_data t_data, b_data; + Evas_Object *bg, *box, *t_rect, *b_rect, *border; +}; + +static struct test_data d = {0}; + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); + + evas_object_move(d.box, (w / 4), (h / 4)); + evas_object_resize(d.box, (w / 2), (h / 2)); + + evas_object_move(d.border, (w / 4) - 3, (h / 4) - 3); + evas_object_resize(d.border, (w / 2) + 6, (h / 2) + 6); +} + +static void +_print_rect_stats(Evas_Object *rect) +{ + Evas_Coord w, h, l, r, t, b; + double x, y; + + evas_object_size_hint_align_get(rect, &x, &y); + fprintf(stdout, "\talign hints: h(%f), v(%f)\n", x, y); + + evas_object_size_hint_min_get(rect, &w, &h); + fprintf(stdout, "\tmin. size hints: h(%d), v(%d)\n", w, h); + + evas_object_size_hint_max_get(rect, &w, &h); + fprintf(stdout, "\tmax. size hints: h(%d), v(%d)\n", w, h); + + evas_object_size_hint_padding_get(rect, &l, &r, &t, &b); + fprintf(stdout, "\tpadding hints: l(%d), r(%d), t(%d), b(%d)\n", + l, r, t, b); + + evas_object_size_hint_weight_get(rect, &x, &y); + fprintf(stdout, "\tweight hints: h(%f), v(%f)\n", x, y); +} + +/* use the following commands to interact with this example - 'h' is + * the key for help */ +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + struct rect_data *r_data = NULL; + const Evas_Modifier *mods; + Evas_Object *rect = NULL; + const char *name = NULL; + + mods = evas_key_modifier_get(evas); + if (evas_key_modifier_is_set(mods, "Shift")) + { + rect = d.t_rect; + r_data = &d.t_data; + name = "top"; + } + else if (evas_key_modifier_is_set(mods, "Control")) + { + rect = d.b_rect; + r_data = &d.b_data; + name = "bottom"; + } + else if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + else if (strcmp(ev->keyname, "s") == 0) /* get aspect status of the + * rectangles WRT size + * hints */ + { + fprintf(stdout, "Top rectangle:\n"); + _print_rect_stats(d.t_rect); + + fprintf(stdout, "\nBottom rectangle:\n"); + _print_rect_stats(d.b_rect); + + return; + } + + if (!rect) return; + + if (strcmp(ev->keyname, "a") == 0) /* alignment hints */ + { + (r_data->align_ptr)++; + + if ((unsigned) + (((void *)(r_data->align_ptr)) - ((void *)(r_data->align))) >= + sizeof(r_data->align)) + r_data->align_ptr = r_data->align; + + evas_object_size_hint_align_set( + rect, r_data->align_ptr->x, r_data->align_ptr->y); + + fprintf(stdout, "Changing align hints for %s rect. to (%f, %f)\n", + name, r_data->align_ptr->x, r_data->align_ptr->y); + return; + } + + if (strcmp(ev->keyname, "m") == 0) /* min. size hints */ + { + (r_data->min_ptr)++; + + if ((unsigned) + (((void *)(r_data->min_ptr)) - ((void *)(r_data->min))) >= + sizeof(r_data->min)) + r_data->min_ptr = r_data->min; + + evas_object_size_hint_min_set( + rect, r_data->min_ptr->w, r_data->min_ptr->h); + + fprintf(stdout, "Changing min. size hints for %s rect. to (%d, %d)\n", + name, r_data->min_ptr->w, r_data->min_ptr->h); + return; + } + + if (strcmp(ev->keyname, "n") == 0) /* max. size hints */ + { + (r_data->max_ptr)++; + + if ((unsigned) + (((void *)(r_data->max_ptr)) - ((void *)(r_data->max))) >= + sizeof(r_data->max)) + r_data->max_ptr = r_data->max; + + evas_object_size_hint_max_set( + rect, r_data->max_ptr->w, r_data->max_ptr->h); + + fprintf(stdout, "Changing max. size hints for %s rect. to (%d, %d)\n", + name, r_data->max_ptr->w, r_data->max_ptr->h); + return; + } + + if (strcmp(ev->keyname, "p") == 0) /* padding size hints */ + { + (r_data->padding_ptr)++; + + if ((unsigned) + (((void *)(r_data->padding_ptr)) - ((void *)(r_data->padding))) >= + sizeof(r_data->padding)) + r_data->padding_ptr = r_data->padding; + + evas_object_size_hint_padding_set( + rect, r_data->padding_ptr->l, r_data->padding_ptr->r, + r_data->padding_ptr->t, r_data->padding_ptr->b); + + fprintf(stdout, "Changing padding size hints for %s rect." + " to (%d, %d, %d, %d)\n", + name, r_data->padding_ptr->l, r_data->padding_ptr->r, + r_data->padding_ptr->t, r_data->padding_ptr->b); + return; + } + + /* experiment with weights here. keep in mind that, for the box + * object, only if all the children have non zero weights this hint + * will have an effect */ + if (strcmp(ev->keyname, "w") == 0) /* weight hints */ + { + (r_data->weight_ptr)++; + + if ((unsigned) + (((void *)(r_data->weight_ptr)) - ((void *)(r_data->weight))) >= + sizeof(r_data->weight)) + r_data->weight_ptr = r_data->weight; + + evas_object_size_hint_weight_set( + rect, r_data->weight_ptr->x, r_data->weight_ptr->y); + + fprintf(stdout, "Changing weight hints for %s rect. to (%f, %f)\n", + name, r_data->weight_ptr->x, r_data->weight_ptr->y); + return; + } +} + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +int +main(void) +{ + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* init values one is going to cycle through while running this + * example */ + struct rect_data init_data = \ + { + .min = {{0, 0}, {30, 30}, {100, 70}, {200, 200}}, + .max = {{0, 0}, {100, 100}, {100, 70}, {300, 300}}, + .align = {{0.0, 0.0}, {0.5, 0.5}, {1.0, 0.5}}, + .weight = {{0.0, 0.0}, {3, 6}, {10, 100}}, + .padding = {{0, 0, 0, 0}, {3, 6, 9, 12}, {10, 20, 0, 30}} + }; + + d.t_data = init_data; + + d.t_data.min_ptr = d.t_data.min + 1; + d.t_data.max_ptr = d.t_data.max + 1; + d.t_data.align_ptr = d.t_data.align; + d.t_data.weight_ptr = d.t_data.weight; + d.t_data.padding_ptr = d.t_data.padding; + + d.b_data = init_data; + + d.b_data.min_ptr = d.b_data.min + 1; + d.b_data.max_ptr = d.b_data.max + 1; + d.b_data.align_ptr = d.b_data.align; + d.b_data.weight_ptr = d.b_data.weight; + d.b_data.padding_ptr = d.b_data.padding; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_destroy_set(d.ee, _on_destroy); + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.canvas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.canvas); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(d.bg, 0, 0); /* at canvas' origin */ + evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + /* Evas box with vertical layout */ + d.box = evas_object_box_add(d.canvas); + evas_object_box_layout_set( + d.box, evas_object_box_layout_vertical, NULL, NULL); + evas_object_show(d.box); + + /* this is a border around the box, container of the rectangles we + * are going to experiment with (changing some size hints). this + * way you can see how the container relates to the children */ + d.border = evas_object_image_filled_add(d.canvas); + evas_object_image_file_set(d.border, border_img_path, NULL); + evas_object_image_border_set(d.border, 3, 3, 3, 3); + evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); + evas_object_show(d.border); + + d.t_rect = evas_object_rectangle_add(d.canvas); + evas_object_color_set(d.t_rect, 0, 0, 255, 255); + + evas_object_size_hint_min_set( + d.t_rect, d.t_data.min_ptr->w, d.t_data.min_ptr->h); + evas_object_show(d.t_rect); + evas_object_box_append(d.box, d.t_rect); + + d.b_rect = evas_object_rectangle_add(d.canvas); + evas_object_color_set(d.b_rect, 0, 255, 0, 255); + + evas_object_size_hint_min_set( + d.b_rect, d.b_data.min_ptr->w, d.b_data.min_ptr->h); + evas_object_show(d.b_rect); + evas_object_box_append(d.box, d.b_rect); + + _canvas_resize_cb(d.ee); + + fprintf(stdout, commands); + ecore_main_loop_begin(); + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "You got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); + return -1; +} + diff --git a/libraries/evas/src/examples/evas-images.c b/libraries/evas/src/examples/evas-images.c new file mode 100644 index 0000000..a8cf3c4 --- /dev/null +++ b/libraries/evas/src/examples/evas-images.c @@ -0,0 +1,353 @@ +/** + * Simple Evas example illustrating some image objects functions + * + * You'll need at least one engine built for it (excluding the buffer + * one) and the png image loader also built. See stdout/stderr for + * output. + * + * @verbatim + * gcc -o evas-images evas-images.c `pkg-config --libs --cflags evas ecore ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else + +#define PACKAGE_EXAMPLES_DIR "." +#define __UNUSED__ + +#endif + +#include +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; +static const char *valid_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; +static const char *bogus_path = "/tmp/non-existent-220986.png"; +static const char *commands = \ + "commands are:\n" + "\tx - change image's x fill coordinate\n" + "\ty - change image's y fill coordinate\n" + "\tw - change image's w fill size\n" + "\te - change image's h fill size\n" + "\tf - toggle image filled property (overrides fill)\n" + "\ta - toggle image's alpha channel usage\n" + "\tm - toggle border's smooth scaling\n" + "\tt - change border's thickness\n" + "\tb - change border's center region aspect\n" + "\tc - change border's scaling factor\n" + "\ts - print image's fill property status\n" + "\th - print help\n"; + +struct test_data +{ + Ecore_Evas *ee; + Evas *evas; + Evas_Object *img1, *img2, *bg, *border; +}; + +static struct test_data d = {0}; + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +static const char * +_border_fill_mode_to_str(Evas_Border_Fill_Mode mode) +{ + switch (mode) + { + case EVAS_BORDER_FILL_NONE: + return "none"; + + case EVAS_BORDER_FILL_DEFAULT: + return "default"; + + case EVAS_BORDER_FILL_SOLID: + return "solid"; + + default: + return "invalid"; + } +} + +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (strcmp(ev->keyname, "m") == 0) /* toggle border image's smooth scaling */ + { + Eina_Bool smooth_scale = evas_object_image_smooth_scale_get(d.border); + + evas_object_image_smooth_scale_set(d.border, !smooth_scale); + + fprintf(stdout, "Image's border is now %s smooth scaling\n", + smooth_scale ? "without" : "with"); + + return; + } + + if (strcmp(ev->keyname, "t") == 0) /* change border's thickness */ + { + int l, r, t, b; + + evas_object_image_border_get(d.border, &l, &r, &t, &b); + + l = (l + 3) % 9; + r = (r + 3) % 9; + t = (t + 3) % 9; + b = (b + 3) % 9; + + evas_object_image_border_set(d.border, l, r, t, b); + + fprintf(stdout, "Image's border thickness is now %d\n", l); + + return; + } + + if (strcmp(ev->keyname, "c") == 0) /* change border's scaling factor */ + { + double scale = evas_object_image_border_scale_get(d.border); + + scale *= 2; + if (scale > 4.0) scale = 1.0; + + evas_object_image_border_scale_set(d.border, scale); + + fprintf(stdout, "Image's border scaling factor is now %f\n", scale); + + return; + } + + if (strcmp(ev->keyname, "b") == 0) /* change border's center + * region's aspect */ + { + Eina_Bool fill = \ + evas_object_image_border_center_fill_get(d.border); + + fill = (fill + 1) % 3; + + evas_object_image_border_center_fill_set(d.border, fill); + + fprintf(stdout, "Image's border center region aspect is now \"%s\"\n", + _border_fill_mode_to_str(fill)); + + return; + } + + if (strcmp(ev->keyname, "a") == 0) /* toggle alpha channel usage */ + { + Eina_Bool alpha = evas_object_image_alpha_get(d.img1); + + evas_object_image_alpha_set(d.img1, !alpha); + + fprintf(stdout, "Image's alpha channel is now %s\n", + alpha ? "off" : "on"); + + return; + } + + if (strcmp(ev->keyname, "f") == 0) /* toggle filled property */ + { + Eina_Bool filled = evas_object_image_filled_get(d.img1); + + evas_object_image_filled_set(d.img1, !filled); + + fprintf(stdout, "Image's x filled property is now %s\n", + filled ? "off" : "on"); + + return; + } + + if (strcmp(ev->keyname, "x") == 0) /* change x fill coordinate */ + { + Evas_Coord x, y, w, h; + + evas_object_image_fill_get(d.img1, &x, &y, &w, &h); + x = (x + 20) % (WIDTH / 2); + evas_object_image_fill_set(d.img1, x, y, w, h); + + fprintf(stdout, "Image's x fill coordinate changed to %d\n", x); + + return; + } + + if (strcmp(ev->keyname, "y") == 0) /* change y fill coordinate */ + { + Evas_Coord x, y, w, h; + + evas_object_image_fill_get(d.img1, &x, &y, &w, &h); + y = (y + 20) % (HEIGHT / 2); + evas_object_image_fill_set(d.img1, x, y, w, h); + + fprintf(stdout, "Image's y fill coordinate changed to %d\n", y); + + return; + } + + if (strcmp(ev->keyname, "w") == 0) /* change w fill size */ + { + Evas_Coord x, y, w, h; + + evas_object_image_fill_get(d.img1, &x, &y, &w, &h); + if (w == (WIDTH / 4)) w = (WIDTH / 2); + else if (w == WIDTH / 2) w = WIDTH; + else w = (WIDTH / 4); + evas_object_image_fill_set(d.img1, x, y, w, h); + + fprintf(stdout, "Image's w fill size changed to %d\n", w); + + return; + } + + if (strcmp(ev->keyname, "e") == 0) /* change h fill size */ + { + Evas_Coord x, y, w, h; + + evas_object_image_fill_get(d.img1, &x, &y, &w, &h); + if (h == (HEIGHT / 4)) h = (HEIGHT / 2); + else if (h == HEIGHT / 2) h = HEIGHT; + else h = (HEIGHT / 4); + evas_object_image_fill_set(d.img1, x, y, w, h); + + fprintf(stdout, "Image's h fill size changed to %d\n", h); + + return; + } + + if (strcmp(ev->keyname, "s") == 0) /* status */ + { + Evas_Coord x, y, w, h; + + evas_object_image_fill_get(d.img1, &x, &y, &w, &h); + + fprintf(stdout, "Image has fill properties set to: %d, %d, %d, %d\n", + x, y, w, h); + + return; + } +} + +int +main(void) +{ + int err; + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_destroy_set(d.ee, _on_destroy); + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.evas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.evas); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(d.bg, 0, 0); /* at canvas' origin */ + evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(d.bg); + + d.img1 = evas_object_image_add(d.evas); + evas_object_image_file_set(d.img1, valid_path, NULL); + err = evas_object_image_load_error_get(d.img1); + if (err != EVAS_LOAD_ERROR_NONE) + { + fprintf(stderr, "could not load image '%s'. error string is \"%s\"\n", + valid_path, evas_load_error_str(err)); + } + else + { + fprintf(stdout, + "loaded image '%s' with succes! error string is \"%s\"\n", + valid_path, evas_load_error_str(err)); + + evas_object_move(d.img1, 3, 3); + evas_object_image_fill_set(d.img1, 0, 0, WIDTH / 2, HEIGHT / 2); + evas_object_resize(d.img1, WIDTH / 2, HEIGHT / 2); + evas_object_show(d.img1); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + } + + /* this is a border around the image above, here just to emphasize + * its geometry */ + d.border = evas_object_image_filled_add(d.evas); + evas_object_image_file_set(d.border, border_img_path, NULL); + evas_object_image_border_set(d.border, 3, 3, 3, 3); + evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); + + evas_object_move(d.border, 0, 0); + evas_object_resize(d.border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); + evas_object_show(d.border); + + /* image loading will fail for this one -- unless one cheats and + * puts a valid image on that path */ + d.img2 = evas_object_image_add(d.evas); + evas_object_image_file_set(d.img2, bogus_path, NULL); + err = evas_object_image_load_error_get(d.img2); + if (err != EVAS_LOAD_ERROR_NONE) + { + fprintf(stderr, "could not load image '%s': error string is \"%s\"\n", + bogus_path, evas_load_error_str(err)); + } + else + { + evas_object_move(d.img2, WIDTH / 2, HEIGHT / 2); + evas_object_image_fill_set(d.img2, 0, 0, WIDTH / 2, HEIGHT / 2); + evas_object_resize(d.img2, WIDTH / 2, HEIGHT / 2); + evas_object_show(d.img2); + } + + fprintf(stdout, commands); + ecore_main_loop_begin(); + + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); + ecore_evas_shutdown(); + return -1; +} diff --git a/libraries/evas/src/examples/evas-images2.c b/libraries/evas/src/examples/evas-images2.c new file mode 100644 index 0000000..ba7766c --- /dev/null +++ b/libraries/evas/src/examples/evas-images2.c @@ -0,0 +1,204 @@ +/** + * Simple Evas example illustrating some image objects functions + * + * You'll need at least one engine built for it (excluding the buffer + * one) and the png image loader/saver also built. See stdout/stderr + * for output. + * + * @verbatim + * gcc -o evas-images2 evas-images2.c `pkg-config --libs --cflags evas ecore ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else + +#define PACKAGE_EXAMPLES_DIR "." +#define __UNUSED__ + +#endif + +#include +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +static const char *img_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; +static const char *commands = \ + "commands are:\n" + "\tp - change proxy image's source\n" + "\ts - print noise image's stride value\n" + "\ta - save noise image to disk (/tmp dir)\n" + "\th - print help\n"; + +const char *file_path = "/tmp/evas-images2-example.png"; +const char *quality_str = "quality=100"; + +struct test_data +{ + Ecore_Evas *ee; + Evas *evas; + Evas_Object *logo, *noise_img, *proxy_img, *bg; +}; + +static struct test_data d = {0}; + +static void +_on_preloaded(void *data __UNUSED__, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + fprintf(stdout, "Image has been pre-loaded!\n"); +} + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (strcmp(ev->keyname, "s") == 0) /* print proxy image' stride value */ + { + int stride = evas_object_image_stride_get(d.noise_img); + + fprintf(stdout, "Image has row stride value of %d, which accounts" + " for %d pixels\n", stride, stride / 4); + + return; + } + + if (strcmp(ev->keyname, "p") == 0) /* change proxy's source */ + { + Evas_Object *source = evas_object_image_source_get(d.proxy_img); + + if (source == d.logo) source = d.noise_img; + else source = d.logo; + + evas_object_image_source_set(d.proxy_img, source); + + fprintf(stdout, "Proxy image's source changed\n"); + + return; + } + + if (strcmp(ev->keyname, "a") == 0) /* save noise image to disk */ + { + if (!evas_object_image_save(d.noise_img, file_path, NULL, quality_str)) + fprintf(stderr, "Cannot save image to '%s' (flags '%s')\n", + file_path, quality_str); + else + fprintf(stdout, "Image saved to '%s' (flags '%s'), check it out with " + "an image viewer\n", file_path, quality_str); + + return; + } +} + +int +main(void) +{ + unsigned int i; + unsigned int pixels[(WIDTH / 4) * (HEIGHT / 4)]; + + srand(time(NULL)); + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_destroy_set(d.ee, _on_destroy); + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.evas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.evas); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(d.bg, 0, 0); /* at canvas' origin */ + evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + d.logo = evas_object_image_filled_add(d.evas); + + evas_object_event_callback_add( + d.logo, EVAS_CALLBACK_IMAGE_PRELOADED, _on_preloaded, NULL); + evas_object_image_preload(d.logo, EINA_TRUE); + + evas_object_image_file_set(d.logo, img_path, NULL); + evas_object_resize(d.logo, WIDTH / 2, HEIGHT / 2); + evas_object_show(d.logo); + + /* creating noise image */ + for (i = 0; i < sizeof(pixels) / sizeof(pixels[0]); i++) + pixels[i] = rand(); + + d.noise_img = evas_object_image_add(d.evas); + evas_object_image_size_set(d.noise_img, WIDTH / 4, HEIGHT / 4); + evas_object_image_data_set(d.noise_img, pixels); + evas_object_image_filled_set(d.noise_img, EINA_TRUE); + evas_object_move(d.noise_img, (WIDTH * 3) / 4, 0); + evas_object_resize(d.noise_img, WIDTH / 4, HEIGHT / 4); + evas_object_show(d.noise_img); + fprintf(stdout, "Creating noise image with size %d, %d\n", + WIDTH / 4, HEIGHT / 4); + + d.proxy_img = evas_object_image_filled_add(d.evas); + evas_object_image_source_set(d.proxy_img, d.logo); + evas_object_move(d.proxy_img, WIDTH / 4, HEIGHT / 2); + evas_object_resize(d.proxy_img, WIDTH / 2, HEIGHT / 2); + evas_object_show(d.proxy_img); + + fprintf(stdout, commands); + ecore_main_loop_begin(); + + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); + ecore_evas_shutdown(); + return -1; +} diff --git a/libraries/evas/src/examples/evas-init-shutdown.c b/libraries/evas/src/examples/evas-init-shutdown.c new file mode 100644 index 0000000..a7508d8 --- /dev/null +++ b/libraries/evas/src/examples/evas-init-shutdown.c @@ -0,0 +1,56 @@ +/** + * Simple example illustrating usage of evas_init() and + * evas_shutdown(). Usually one would instantiate a canvas to have + * something useful out of Evas. For an example of this kind, see the + * @ref Example_Evas_Buffer_Simple. + * + * Here, we are just listing the engine Evas was compiled with support + * to. + * + * @verbatim + * gcc -o evas-init-shutdown evas-init-shutdown.c `pkg-config --libs \ + * --cflags evas` + * @endverbatim + * + */ + +#include +#include +#include + +/* + * Simple example illustrating usage of evas_init() and + * evas_shutdown(). Usually one would instantiate a canvas to have + * something useful out of Evas. For an example of this kind, see the + * evas-buffer-simple.c, which requires the buffer engine module + * compiled in Evas. + * + * Here, we are just listing the engine Evas was compiled with support + * to. + */ + +int +main(void) +{ + Eina_List *engine_list, *l; + char *engine_name; + + evas_init(); + + engine_list = evas_render_method_list(); + if (!engine_list) + { + fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n"); + exit(-1); + } + + printf("Available Evas Engines:\n"); + EINA_LIST_FOREACH(engine_list, l, engine_name) + printf("%s\n", engine_name); + + evas_render_method_list_free(engine_list); + + evas_shutdown(); + return 0; + } + diff --git a/libraries/evas/src/examples/evas-map-utils.c b/libraries/evas/src/examples/evas-map-utils.c new file mode 100644 index 0000000..2d15882 --- /dev/null +++ b/libraries/evas/src/examples/evas-map-utils.c @@ -0,0 +1,321 @@ +/* + * gcc -o evas-map-utils evas-map-utils.c `pkg-config --cflags --libs evas ecore ecore-evas` + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#else +#define __UNUSED__ +#endif + +#include +#include + +#include +#include +#include +#include + +#define WIDTH 480 +#define HEIGHT 480 + +typedef struct +{ + Ecore_Evas *ee; + Evas *canvas; + struct { + int r, g, b, a; + } colors[6]; + int colors_index; + int frame; + Eina_Bool alpha : 1; + Eina_Bool smooth : 1; + Eina_Bool backface_culling : 1; + Eina_Bool apply_perspective : 1; + Eina_Bool apply_lighting : 1; +} App_Data; + +static const char *help_string = + "Valid commands:\n" + "\ta - toggle alpha for maps\n" + "\ts - toggle smooth for maps\n" + "\tc - switch map color\n" + "\tb - toggle backface culling\n" + "\tp - toggle perspective\n" + "\tl - toggle lighting\n" + "\th - prints this help\n"; + +static Eina_Bool +_anim_cb(void *data) +{ + App_Data *ad = data; + Evas_Map *m; + const Evas_Map *old_map; + Evas_Object *o; + int r, g, b, a; + int win_w, win_h, img_w, img_h; + Evas_Coord x, y, w, h; + + evas_output_size_get(ad->canvas, &win_w, &win_h); + + m = evas_map_new(4); + evas_map_smooth_set(m, ad->smooth); + evas_map_alpha_set(m, ad->alpha); + + r = ad->colors[ad->colors_index].r; + g = ad->colors[ad->colors_index].g; + b = ad->colors[ad->colors_index].b; + a = ad->colors[ad->colors_index].a; + evas_map_util_points_color_set(m, r, g, b, a); + + o = evas_object_name_find(ad->canvas, "obj1"); + evas_object_geometry_get(o, &x, &y, &w, &h); + + evas_map_util_points_populate_from_object(m, o); + evas_map_util_rotate(m, 3 * ad->frame, x + (w / 2), y + (h / 2)); + evas_object_map_set(o, m); + evas_object_map_enable_set(o, EINA_TRUE); + + o = evas_object_name_find(ad->canvas, "obj2"); + evas_object_geometry_get(o, &x, &y, &w, &h); + evas_object_image_size_get(o, &img_w, &img_h); + + evas_map_util_points_populate_from_object_full(m, o, 100); + evas_map_point_image_uv_set(m, 0, 0, 0); + evas_map_point_image_uv_set(m, 1, img_w, 0); + evas_map_point_image_uv_set(m, 2, img_w, img_h); + evas_map_point_image_uv_set(m, 3, 0, img_h); + evas_map_util_3d_rotate(m, ad->frame * 6, ad->frame * 6, ad->frame * 6, + x + (w / 3), y + 10, 0); + if (ad->apply_lighting) + evas_map_util_3d_lighting(m, win_w / 2, win_h / 2, -100, + 255, 255, 255, 0, 0, 0); + evas_object_map_set(o, m); + evas_object_map_enable_set(o, EINA_TRUE); + + o = evas_object_name_find(ad->canvas, "obj3"); + evas_object_geometry_get(o, &x, &y, &w, &h); + evas_object_image_size_get(o, &img_w, &img_h); + + evas_map_util_points_populate_from_geometry(m, x, y + (h / 2), w, h, -20); + evas_map_point_image_uv_set(m, 0, 0, 0); + evas_map_point_image_uv_set(m, 1, img_w, 0); + evas_map_point_image_uv_set(m, 2, img_w, img_h); + evas_map_point_image_uv_set(m, 3, 0, img_h); + evas_map_util_3d_rotate(m, 20, ad->frame * 6, 0, + x + (w / 2), y + (w / 2), w / 2); + + if (ad->apply_perspective) + evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 256); + if (ad->apply_lighting) + { + Evas_Coord mx, my; + evas_pointer_canvas_xy_get(ad->canvas, &mx, &my); + evas_map_util_3d_lighting(m, mx, my, -256, + 255, 255, 255, 0, 0, 0); + } + if (ad->backface_culling) + { + if (evas_map_util_clockwise_get(m)) + evas_object_show(o); + else + evas_object_hide(o); + } + else + evas_object_show(o); + evas_object_map_set(o, m); + evas_object_map_enable_set(o, EINA_TRUE); + + evas_map_free(m); + + o = evas_object_name_find(ad->canvas, "obj4"); + evas_object_geometry_get(o, &x, &y, &w, &h); + evas_object_image_size_get(evas_object_image_source_get(o), &img_w, &img_h); + + m = evas_map_new(4); + evas_map_point_coord_set(m, 0, x, y + h, 0); + evas_map_point_coord_set(m, 1, x + w, y + h, 0); + evas_map_point_coord_set(m, 2, win_w - 10, win_h - 30, 0); + evas_map_point_coord_set(m, 3, (win_w / 2) + 10, win_h - 30, 0); + evas_map_point_image_uv_set(m, 0, 0, img_h); + evas_map_point_image_uv_set(m, 1, img_w, img_h); + evas_map_point_image_uv_set(m, 2, img_w, 2 * (img_h / 3)); + evas_map_point_image_uv_set(m, 3, 0, 2 * (img_h / 3)); + evas_map_point_color_set(m, 0, 200, 200, 200, 150); + evas_map_point_color_set(m, 1, 200, 200, 200, 150); + evas_map_point_color_set(m, 2, 0, 0, 0, 0); + evas_map_point_color_set(m, 3, 0, 0, 0, 0); + evas_object_map_set(o, m); + evas_object_map_enable_set(o, EINA_TRUE); + + evas_map_free(m); + + ad->frame = (ad->frame + 1) % 60; + + return EINA_TRUE; +} + +static void +_on_keydown(void *data, Evas *e, Evas_Object *o, void *event) +{ + App_Data *ad = data; + Evas_Event_Key_Down *ev = event; + const Evas_Modifier *mods; + + mods = evas_key_modifier_get(ad->canvas); + switch (ev->keyname[0]) + { + case 'a': + ad->alpha = !ad->alpha; + break; + case 's': + ad->smooth = !ad->smooth; + break; + case 'c': + ad->colors_index = (ad->colors_index + 1) % 6; + break; + case 'b': + ad->backface_culling = !ad->backface_culling; + break; + case 'p': + ad->apply_perspective = !ad->apply_perspective; + break; + case 'l': + ad->apply_lighting = !ad->apply_lighting; + break; + case 'h': + puts(help_string); + break; + default: + break; + } +} + +static void +_objs_fit(Evas *e) +{ + Evas_Object *o; + int w, h; + + evas_output_size_get(e, &w, &h); + w /= 2; + h /= 2; + + o = evas_object_name_find(e, "obj1"); + evas_object_move(o, w / 4, h / 4); + evas_object_resize(o, w / 2, h / 2); + + o = evas_object_name_find(e, "obj2"); + evas_object_move(o, 5 * w / 4, h / 4); + evas_object_resize(o, w / 2, h / 2); + + o = evas_object_name_find(e, "obj3"); + evas_object_move(o, w / 4, 5 * h / 4); + evas_object_resize(o, w / 2, h / 2); + + o = evas_object_name_find(e, "obj4_source"); + evas_object_move(o, 5 * w / 4, 5 * h / 4); + evas_object_resize(o, w / 2, h / 2); + + o = evas_object_name_find(e, "obj4"); + evas_object_move(o, 5 * w / 4, 5 * h / 4); + evas_object_resize(o, w / 2, h / 2); +} + +static void +_on_resize(void *data __UNUSED__, Evas *e, Evas_Object *o __UNUSED__, void *event __UNUSED__) +{ + _objs_fit(e); +} + +static void +_on_free(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event __UNUSED__) +{ + ecore_main_loop_quit(); +} + +int +main(void) +{ + Evas_Object *bg, *o, *osrc; + static App_Data d = { + .ee = NULL, + .canvas = NULL, + .colors = { + { 255, 255, 255, 255 }, + { 128, 128, 0, 128 }, + { 255, 0, 0, 255 }, + { 64, 128, 255, 255 }, + { 11, 23, 58, 132 }, + { 0, 0, 0, 255 } + }, + .colors_index = 0, + .frame = 0, + .alpha = EINA_FALSE, + .smooth = EINA_FALSE, + .backface_culling = EINA_FALSE, + .apply_perspective = EINA_TRUE, + .apply_lighting = EINA_TRUE + }; + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + d.canvas = ecore_evas_get(d.ee); + + bg = evas_object_image_filled_add(d.canvas); + evas_object_image_file_set(bg, "cube1.png", NULL); + ecore_evas_object_associate(d.ee, bg, 0); + evas_object_focus_set(bg, EINA_TRUE); + evas_object_move(bg, 0, 0); + evas_object_resize(bg, WIDTH, HEIGHT); + evas_object_show(bg); + + o = evas_object_rectangle_add(d.canvas); + evas_object_name_set(o, "obj1"); + evas_object_color_set(o, 128, 0, 200, 200); + evas_object_show(o); + + o = evas_object_image_filled_add(d.canvas); + evas_object_name_set(o, "obj2"); + evas_object_image_file_set(o, "enlightenment.png", NULL); + evas_object_show(o); + + o = evas_object_image_filled_add(d.canvas); + evas_object_name_set(o, "obj3"); + evas_object_image_file_set(o, "enlightenment.png", NULL); + evas_object_show(o); + + osrc = evas_object_image_filled_add(d.canvas); + evas_object_image_file_set(osrc, "im1.png", NULL); + evas_object_name_set(osrc, "obj4_source"); + evas_object_show(osrc); + + o = evas_object_image_filled_add(d.canvas); + evas_object_image_source_set(o, osrc); + evas_object_name_set(o, "obj4"); + evas_object_show(o); + + _objs_fit(d.canvas); + + evas_object_event_callback_add(bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, &d); + evas_object_event_callback_add(bg, EVAS_CALLBACK_RESIZE, _on_resize, NULL); + evas_object_event_callback_add(bg, EVAS_CALLBACK_FREE, _on_free, NULL); + + ecore_animator_add(_anim_cb, &d); + + ecore_main_loop_begin(); + + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); +panic: + ecore_evas_shutdown(); + return -1; +} diff --git a/libraries/evas/src/examples/evas-object-manipulation.c b/libraries/evas/src/examples/evas-object-manipulation.c new file mode 100644 index 0000000..e9c9442 --- /dev/null +++ b/libraries/evas/src/examples/evas-object-manipulation.c @@ -0,0 +1,235 @@ +/** + * Simple Evas example illustrating basic objects manipulation. + * + * You'll need at least one engine built for it (excluding the buffer + * one) and the png image loader also built. See stdout/stderr for + * output. + * + * @verbatim + * gcc -o evas-object-manipulation evas-object-manipulation.c `pkg-config --libs --cflags ecore evas ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else + +#define PACKAGE_EXAMPLES_DIR "." +#define __UNUSED__ + +#endif + +#include +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +static const char *img_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; + +struct test_data +{ + Ecore_Evas *ee; + Evas *canvas; + Evas_Object *img, *bg, *clipper, *clipper_border, *text; +}; + +static struct test_data d = {0}; + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, "commands are:\n" + "\to - change clipper's opacity\n" + "\tr - toggle clipper's color between red and white\n" + "\tc - toggle clipper's clipping function\n" + "\tv - toggle clipper's visibility\n"); + return; + } + + if (strcmp(ev->keyname, "o") == 0) /* change clipper's opacity */ + { + int alpha, r, g, b; + + evas_object_color_get(d.clipper, &r, &g, &b, &alpha); + alpha -= 20; + if (alpha < 0) + alpha = 255; + + evas_object_color_set(d.clipper, r, g, b, alpha); + + fprintf(stdout, "Changing clipper's opacity: %d%%\n", + (int)((alpha / 255.0) * 100)); + return; + } + + if (strcmp(ev->keyname, "r") == 0) /* toggle clipper's color + * between red and white */ + { + int alpha, r, g, b; + + fprintf(stdout, "Changing clipper's color to"); + + evas_object_color_get(d.clipper, &r, &g, &b, &alpha); + if (g > 0) + { + fprintf(stdout, "red\n"); + g = b = 0; + } + else + { + fprintf(stdout, "white\n"); + g = b = 255; + } + + evas_object_color_set(d.clipper, r, g, b, alpha); + return; + } + + if (strcmp(ev->keyname, "c") == 0) /* toggle clipper's clipping function */ + { + fprintf(stdout, "Toggling clipping "); + + if (evas_object_clip_get(d.img) == d.clipper) + { + evas_object_clip_unset(d.img); + fprintf(stdout, "off\n"); + } + else + { + evas_object_clip_set(d.img, d.clipper); + fprintf(stdout, "on\n"); + } + return; + } + + if (strcmp(ev->keyname, "v") == 0) /* toggle clipper's visibility */ + { + fprintf(stdout, "Clipper is now "); + + if (evas_object_visible_get(d.clipper)) + { + evas_object_hide(d.clipper); + fprintf(stdout, "hidden\n"); + } + else + { + evas_object_show(d.clipper); + fprintf(stdout, "visible\n"); + } + return; + } +} + +int +main(void) +{ + int err; + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.canvas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.canvas); + evas_object_name_set(d.bg, "background rectangle"); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(d.bg, 0, 0); /* at canvas' origin */ + evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + d.img = evas_object_image_filled_add(d.canvas); + evas_object_image_file_set(d.img, img_path, NULL); + err = evas_object_image_load_error_get(d.img); + if (err != EVAS_LOAD_ERROR_NONE) + { + goto panic; + } + else + { + evas_object_move(d.img, 0, 0); + evas_object_resize(d.img, WIDTH, HEIGHT); + evas_object_show(d.img); + + fprintf(stdout, "Image object added, type is: %s\n", + evas_object_type_get(d.img)); + } + + /* border on the image's clipper, here just to emphasize its position */ + d.clipper_border = evas_object_image_filled_add(d.canvas); + evas_object_image_file_set(d.clipper_border, border_img_path, NULL); + err = evas_object_image_load_error_get(d.clipper_border); + if (err != EVAS_LOAD_ERROR_NONE) + { + goto panic; + } + else + { + evas_object_image_border_set(d.clipper_border, 3, 3, 3, 3); + evas_object_image_border_center_fill_set( + d.clipper_border, EVAS_BORDER_FILL_NONE); + evas_object_move(d.clipper_border, (WIDTH / 4) - 3, (HEIGHT / 4) - 3); + evas_object_resize( + d.clipper_border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); + evas_object_show(d.clipper_border); + } + + /* solid white clipper (note that it's the default color for a + * rectangle) - it won't change clippees' colors, then (multiplying + * by 255) */ + d.clipper = evas_object_rectangle_add(d.canvas); + evas_object_move(d.clipper, WIDTH / 4, HEIGHT / 4); + evas_object_resize(d.clipper, WIDTH / 2, HEIGHT / 2); + evas_object_clip_set(d.img, d.clipper); + evas_object_show(d.clipper); + + ecore_main_loop_begin(); + + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); +panic: + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + return -1; +} diff --git a/libraries/evas/src/examples/evas-smart-object.c b/libraries/evas/src/examples/evas-smart-object.c new file mode 100644 index 0000000..8a36b62 --- /dev/null +++ b/libraries/evas/src/examples/evas-smart-object.c @@ -0,0 +1,708 @@ +/** + * Simple Evas example illustrating a custom Evas smart object + * + * You'll need at least one engine built for it (excluding the buffer + * one). See stdout/stderr for output. + * + * @verbatim + * gcc -o evas-smart-object evas-smart-object.c `pkg-config --libs --cflags evas ecore ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else + +#define PACKAGE_EXAMPLES_DIR "." +#define __UNUSED__ + +#endif + +#include +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +static const char *commands = \ + "commands are:\n" + "\tl - insert child rectangle on the left\n" + "\tr - insert child rectangle on the right\n" + "\tw - remove and delete all members from the smart object\n" + "\tright arrow - move smart object to the right\n" + "\tleft arrow - move smart object to the left\n" + "\tup arrow - move smart object up\n" + "\tdown arrow - move smart object down\n" + "\td - decrease smart object's size\n" + "\ti - increase smart object's size\n" + "\tc - change smart object's clipper color\n" + "\th - print help\n"; + +#define WHITE {255, 255, 255, 255} +#define RED {255, 0, 0, 255} +#define GREEN {0, 255, 0, 255} +#define BLUE {0, 0, 255, 255} + +struct test_data +{ + Ecore_Evas *ee; + Evas *evas; + Evas_Object *smt, *bg, *clipper, *rects[2]; +}; + +struct color_tuple +{ + int r, g, b, a; +} clipper_colors[4] = {WHITE, RED, GREEN, BLUE}; +int cur_color = 0; + +static const char * +_index_to_color(int i) +{ + switch (i) + { + case 0: + return "WHITE (default)"; + + case 1: + return "RED"; + + case 2: + return "GREEN"; + + case 3: + return "BLUE"; + + default: + return "other"; + } +} + +static struct test_data d = {0}; +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; + +#define _evas_smart_example_type "Evas_Smart_Example" +#define EVT_CHILDREN_NUMBER_CHANGED "children,changed" + +static const Evas_Smart_Cb_Description _smart_callbacks[] = +{ + {EVT_CHILDREN_NUMBER_CHANGED, "i"}, + {NULL, NULL} +}; + +typedef struct _Evas_Smart_Example_Data Evas_Smart_Example_Data; +/* + * This structure augments clipped smart object's instance data, + * providing extra members required by our example smart object's + * implementation. + */ +struct _Evas_Smart_Example_Data +{ + Evas_Object_Smart_Clipped_Data base; + Evas_Object *children[2], *border; + int child_count; +}; + +#define EVAS_SMART_EXAMPLE_DATA_GET(o, ptr) \ + Evas_Smart_Example_Data * ptr = evas_object_smart_data_get(o) + +#define EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN(o, ptr) \ + EVAS_SMART_EXAMPLE_DATA_GET(o, ptr); \ + if (!ptr) \ + { \ + fprintf(stderr, "No widget data for object %p (%s)!", \ + o, evas_object_type_get(o)); \ + fflush(stderr); \ + abort(); \ + return; \ + } + +#define EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ + EVAS_SMART_EXAMPLE_DATA_GET(o, ptr); \ + if (!ptr) \ + { \ + fprintf(stderr, "No widget data for object %p (%s)!", \ + o, evas_object_type_get(o)); \ + fflush(stderr); \ + abort(); \ + return val; \ + } + +EVAS_SMART_SUBCLASS_NEW(_evas_smart_example_type, _evas_smart_example, + Evas_Smart_Class, Evas_Smart_Class, + evas_object_smart_clipped_class_get, _smart_callbacks); + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +static void +_on_child_del(void *data, + Evas *evas __UNUSED__, + Evas_Object *o, + void *einfo __UNUSED__) +{ + Evas_Object *example_smart = data; + int index; + + EVAS_SMART_EXAMPLE_DATA_GET(example_smart, priv); + + index = (int)evas_object_data_get(o, "index"); + index--; + + priv->children[index] = NULL; + + evas_object_smart_member_del(o); + evas_object_smart_changed(example_smart); +} + +static void +_evas_smart_example_child_callbacks_unregister(Evas_Object *obj) +{ + evas_object_data_set(obj, "index", NULL); + evas_object_event_callback_del(obj, EVAS_CALLBACK_FREE, _on_child_del); +} + +static void +_evas_smart_example_child_callbacks_register(Evas_Object *o, + Evas_Object *child, + int index) +{ + evas_object_event_callback_add(child, EVAS_CALLBACK_FREE, _on_child_del, o); + evas_object_data_set(child, "index", (void *)(++index)); +} + +/* create and setup a new example smart object's internals */ +static void +_evas_smart_example_smart_add(Evas_Object *o) +{ + EVAS_SMART_DATA_ALLOC(o, Evas_Smart_Example_Data); + + /* this is a border around the smart object's area, delimiting it */ + priv->border = evas_object_image_filled_add(evas_object_evas_get(o)); + evas_object_image_file_set(priv->border, border_img_path, NULL); + evas_object_image_border_set(priv->border, 3, 3, 3, 3); + evas_object_image_border_center_fill_set( + priv->border, EVAS_BORDER_FILL_NONE); + evas_object_smart_member_add(priv->border, o); + + _evas_smart_example_parent_sc->add(o); +} + +static void +_evas_smart_example_smart_del(Evas_Object *o) +{ + EVAS_SMART_EXAMPLE_DATA_GET(o, priv); + + if (priv->children[0]) + { + _evas_smart_example_child_callbacks_unregister(priv->children[0]); + priv->children[0] = NULL; + } + + if (priv->children[1]) + { + _evas_smart_example_child_callbacks_unregister(priv->children[1]); + priv->children[1] = NULL; + } + + _evas_smart_example_parent_sc->del(o); +} + +static void +_evas_smart_example_smart_show(Evas_Object *o) +{ + EVAS_SMART_EXAMPLE_DATA_GET(o, priv); + + if (priv->children[0]) evas_object_show(priv->children[0]); + if (priv->children[1]) evas_object_show(priv->children[1]); + evas_object_show(priv->border); + + _evas_smart_example_parent_sc->show(o); +} + +static void +_evas_smart_example_smart_hide(Evas_Object *o) +{ + EVAS_SMART_EXAMPLE_DATA_GET(o, priv); + + if (priv->children[0]) evas_object_hide(priv->children[0]); + if (priv->children[1]) evas_object_hide(priv->children[1]); + evas_object_hide(priv->border); + + _evas_smart_example_parent_sc->hide(o); +} + +static void +_evas_smart_example_smart_resize(Evas_Object *o, + Evas_Coord w, + Evas_Coord h) +{ + Evas_Coord ow, oh; + evas_object_geometry_get(o, NULL, NULL, &ow, &oh); + if ((ow == w) && (oh == h)) return; + + /* this will trigger recalculation */ + evas_object_smart_changed(o); +} + +/* act on child objects' properties, before rendering */ +static void +_evas_smart_example_smart_calculate(Evas_Object *o) +{ + Evas_Coord x, y, w, h; + + EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN(o, priv); + evas_object_geometry_get(o, &x, &y, &w, &h); + + evas_object_resize(priv->border, w, h); + evas_object_move(priv->border, x, y); + + if (priv->children[0]) + { + evas_object_move(priv->children[0], x + 3, y + 3); + evas_object_resize(priv->children[0], (w / 2) - 3, (h / 2) - 3); + } + + if (priv->children[1]) + { + evas_object_move(priv->children[1], x + (w / 2), y + (h / 2)); + evas_object_resize(priv->children[1], (w / 2) - 3, (h / 2) - 3); + } +} + +/* setting our smart interface */ +static void +_evas_smart_example_smart_set_user(Evas_Smart_Class *sc) +{ + /* specializing these two */ + sc->add = _evas_smart_example_smart_add; + sc->del = _evas_smart_example_smart_del; + sc->show = _evas_smart_example_smart_show; + sc->hide = _evas_smart_example_smart_hide; + + /* clipped smart object has no hook on resizes or calculations */ + sc->resize = _evas_smart_example_smart_resize; + sc->calculate = _evas_smart_example_smart_calculate; +} + +/* BEGINS example smart object's own interface */ + +/* add a new example smart object to a canvas */ +Evas_Object * +evas_smart_example_add(Evas *evas) +{ + return evas_object_smart_add(evas, _evas_smart_example_smart_class_new()); +} + +static void +_evas_smart_example_remove_do(Evas_Smart_Example_Data *priv, + Evas_Object *child, + int index) +{ + priv->children[index] = NULL; + priv->child_count--; + _evas_smart_example_child_callbacks_unregister(child); + evas_object_smart_member_del(child); +} + +/* remove a child element, return its pointer (or NULL on errors) */ +Evas_Object * +evas_smart_example_remove(Evas_Object *o, + Evas_Object *child) +{ + int index; + + EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); + + if (priv->children[0] != child && priv->children[1] != child) + { + fprintf(stderr, "You are trying to remove something not belonging to" + " the example smart object!\n"); + return NULL; + } + + index = (int)evas_object_data_get(child, "index"); + index--; + + _evas_smart_example_remove_do(priv, child, index); + + evas_object_smart_callback_call( + o, EVT_CHILDREN_NUMBER_CHANGED, (void *)priv->child_count); + evas_object_smart_changed(o); + + return child; +} + +/* set to return any previous object set to the left position of the + * smart object or NULL, if any (or on errors) */ +Evas_Object * +evas_smart_example_set_left(Evas_Object *o, + Evas_Object *child) +{ + Evas_Object *ret = NULL; + + EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); + if (!child) + return NULL; + + if (priv->children[1] == child) + { + fprintf(stderr, "You mustn't place a child on both slots of" + " the example smart object!\n"); + return NULL; + } + + if (priv->children[0]) + { + if (priv->children[0] != child) + { + ret = priv->children[0]; + _evas_smart_example_remove_do(priv, priv->children[0], 0); + } + else return child; + } + + priv->children[0] = child; + _evas_smart_example_child_callbacks_register(o, child, 0); + evas_object_smart_member_add(child, o); + evas_object_smart_changed(o); + + priv->child_count++; + if (!ret) + { + evas_object_smart_callback_call( + o, EVT_CHILDREN_NUMBER_CHANGED, (void *)priv->child_count); + } + + return ret; +} + +/* set to return any previous object set to the right position of the + * smart object or NULL, if any (or on errors) */ +Evas_Object * +evas_smart_example_set_right(Evas_Object *o, + Evas_Object *child) +{ + Evas_Object *ret = NULL; + + EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); + if (!child) + return NULL; + + if (priv->children[0] == child) + { + fprintf(stderr, "You mustn't place a child on both slots of" + " the example smart object!\n"); + return NULL; + } + + if (priv->children[1]) + { + if (priv->children[1] != child) + { + ret = priv->children[1]; + _evas_smart_example_remove_do(priv, priv->children[1], 1); + } + else return child; + } + + priv->children[1] = child; + _evas_smart_example_child_callbacks_register(o, child, 1); + evas_object_smart_member_add(child, o); + evas_object_smart_changed(o); + + priv->child_count++; + if (!ret) + { + evas_object_smart_callback_call( + o, EVT_CHILDREN_NUMBER_CHANGED, (void *)priv->child_count); + } + + return ret; +} + +/* END OF example smart object's own interface */ + +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (strcmp(ev->keyname, "w") == 0) /* clear out smart object (WRT members) */ + { + if (d.rects[0]) + { + evas_smart_example_remove(d.smt, d.rects[0]); + evas_object_del(d.rects[0]); + } + if (d.rects[1]) + { + evas_smart_example_remove(d.smt, d.rects[1]); + evas_object_del(d.rects[1]); + } + + memset(d.rects, 0, sizeof(d.rects)); + + fprintf(stdout, "Deleting all members of the smart object.\n"); + + return; + } + + if (strcmp(ev->keyname, "l") == 0) /* insert random colored + * rectangle on the left */ + { + Evas_Object *rect = evas_object_rectangle_add(d.evas), *prev; + evas_object_color_set( + rect, rand() % 255, rand() % 255, rand() % 255, 255); + evas_object_show(rect); + + prev = evas_smart_example_set_left(d.smt, rect); + d.rects[0] = rect; + + fprintf(stdout, "Setting smart object's left spot with a new" + " rectangle.\n"); + fprintf(stdout, "Checking its new smart object parent: %s\n", + evas_object_smart_parent_get(rect) == d.smt ? "OK!" : + "Failure!"); + if (prev) + { + int r, g, b; + + evas_object_color_get(prev, &r, &g, &b, NULL); + fprintf(stdout, "Deleting previous left child," + " which had colors (%d, %d, %d)\n", r, g, b); + evas_object_del(prev); + } + + return; + } + + if (strcmp(ev->keyname, "r") == 0) /* insert random colored + * rectangle on the right */ + { + Evas_Object *rect = evas_object_rectangle_add(d.evas), *prev; + evas_object_color_set( + rect, rand() % 255, rand() % 255, rand() % 255, 255); + evas_object_show(rect); + + prev = evas_smart_example_set_right(d.smt, rect); + d.rects[1] = rect; + + fprintf(stdout, "Setting smart object's right spot with a new" + " rectangle.\n"); + fprintf(stdout, "Checking its new smart object parent: %s\n", + evas_object_smart_parent_get(rect) == d.smt ? "OK!" : + "Failure!"); + if (prev) + { + int r, g, b; + + evas_object_color_get(prev, &r, &g, &b, NULL); + fprintf(stdout, "Deleting previous right child," + " which had colors (%d, %d, %d)\n", r, g, b); + evas_object_del(prev); + } + + return; + } + + /* move smart object along the canvas */ + if (strcmp(ev->keyname, "Right") == 0 || strcmp(ev->keyname, "Left") == 0 || + strcmp(ev->keyname, "Up") == 0 || strcmp(ev->keyname, "Down") == 0) + { + Evas_Coord x, y; + + evas_object_geometry_get(d.smt, &x, &y, NULL, NULL); + + switch (ev->keyname[0]) + { + case 'R': + x += 20; + break; + + case 'L': + x -= 20; + break; + + case 'U': + y -= 20; + break; + + case 'D': + y += 20; + break; + } + + evas_object_move(d.smt, x, y); + + return; + } + + /* increase smart object's size */ + if (strcmp(ev->keyname, "i") == 0) + { + Evas_Coord w, h; + + evas_object_geometry_get(d.smt, NULL, NULL, &w, &h); + + w *= 1.1; + h *= 1.1; + + evas_object_resize(d.smt, w, h); + + return; + } + + /* decrease smart object's size */ + if (strcmp(ev->keyname, "d") == 0) + { + Evas_Coord w, h; + + evas_object_geometry_get(d.smt, NULL, NULL, &w, &h); + + w *= 0.9; + h *= 0.9; + + evas_object_resize(d.smt, w, h); + + return; + } + + /* change smart object's clipper color */ + if (strcmp(ev->keyname, "c") == 0) + { + cur_color = (cur_color + 1) % 4; + + evas_object_color_set( + d.clipper, clipper_colors[cur_color].r, clipper_colors[cur_color].g, + clipper_colors[cur_color].b, clipper_colors[cur_color].a); + + fprintf (stderr, "Changing clipper's color to %s\n", + _index_to_color(cur_color)); + + return; + } +} + +static void /* callback on number of member objects changed */ +_on_example_smart_object_child_num_change(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + fprintf(stdout, "Number of child members on our example smart" + " object changed to %d\n", (int)event_info); +} + +int +main(void) +{ + const Evas_Smart_Cb_Description **descriptions; + unsigned int count; + Eina_Bool ret; + + srand(time(NULL)); + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_destroy_set(d.ee, _on_destroy); + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.evas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.evas); + evas_object_color_set(d.bg, 255, 255, 255, 255); + evas_object_move(d.bg, 0, 0); + evas_object_resize(d.bg, WIDTH, HEIGHT); + evas_object_show(d.bg); + + d.smt = evas_smart_example_add(d.evas); + evas_object_move(d.smt, WIDTH / 4, HEIGHT / 4); + evas_object_resize(d.smt, WIDTH / 2, HEIGHT / 2); + evas_object_show(d.smt); + + ret = evas_object_smart_type_check(d.smt, _evas_smart_example_type); + fprintf(stdout, "Adding smart object of type \"%s\" to the canvas: %s.\n", + _evas_smart_example_type, ret ? "success" : "failure"); + + d.clipper = evas_object_smart_clipped_clipper_get(d.smt); + fprintf(stdout, "Checking if clipped smart object's clipper is a " + "\"static\" one: %s\n", evas_object_static_clip_get( + d.clipper) ? "yes" : "no"); + + evas_object_color_set( + d.clipper, clipper_colors[cur_color].r, clipper_colors[cur_color].g, + clipper_colors[cur_color].b, clipper_colors[cur_color].a); + + evas_object_smart_callbacks_descriptions_get( + d.smt, &descriptions, &count, NULL, NULL); + + for (; *descriptions; descriptions++) + { + fprintf(stdout, "We've found a smart callback on the smart object!" + "\n\tname: %s\n\ttype: %s\n", (*descriptions)->name, + (*descriptions)->type); + + if (strcmp((*descriptions)->type, "i")) continue; + /* we know we don't have other types of smart callbacks + * here, just playing with it */ + + /* for now, we know the only one callback is the one + * reporting number of member objects changed on the + * example smart object */ + evas_object_smart_callback_add( + d.smt, (*descriptions)->name, + _on_example_smart_object_child_num_change, NULL); + } + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + fprintf(stdout, commands); + ecore_main_loop_begin(); + + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); + ecore_evas_shutdown(); + return -1; +} diff --git a/libraries/evas/src/examples/evas-stacking.c b/libraries/evas/src/examples/evas-stacking.c new file mode 100644 index 0000000..49fc819 --- /dev/null +++ b/libraries/evas/src/examples/evas-stacking.c @@ -0,0 +1,329 @@ +/** + * Simple Evas example illustrating objects stacking and + * canvas layers. + * + * You'll need at least one engine built for it (excluding the buffer + * one) and the png image loader also built. See stdout/stderr for + * output. + * + * @verbatim + * gcc -o evas-stacking evas-stacking.c `pkg-config --libs --cflags evas ecore ecore-evas edje` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#else + +#define __UNUSED__ + +#endif + +#include +#include + +#include +#include +#include + +#define WIDTH 320 +#define HEIGHT 320 + +struct test_data +{ + Ecore_Evas *ee; + Evas *canvas; + Evas_Object *bg; + Evas_Object *rects[3]; /* red, green, blue */ + int layers[3]; /* default, below it, above it */ + int cur_rect, cur_layer; +}; + +static struct test_data d = {0}; + +static const char *commands = \ + "commands are:\n" + "\tc - change the target rectangle to operate on\n" + "\ta - stack target rectangle one level above\n" + "\tb - stack target rectangle one level below\n" + "\tt - stack target rectangle up to the top of its layer\n" + "\tm - stack target rectangle down to the bottom of its layer\n" + "\tp - toggle target rectangle's 'pass events' property\n" + "\tr - toggle target rectangle's 'repeat events' property\n" + "\ts - print current stacking information\n" + "\tl - change background rectangle's layer\n" + "\th - print help\n"; + +static void +_on_mouse_down(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o, + void *einfo __UNUSED__) +{ + fprintf(stdout, "Mouse down on rectangle %s!\n", evas_object_name_get(o)); +} + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +/* use the following commands to interact with this example - 'h' is + * the key for help */ +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + const char *name = evas_object_name_get(d.rects[d.cur_rect]); + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (strcmp(ev->keyname, "s") == 0) /* get status of the + * rectangles WRT size + * hints */ + { + Evas_Object *rect; + + fprintf(stdout, "Order of stacking, from top to bottom, is: "); + + rect = evas_object_top_get(evas); + fprintf(stdout, "%s", evas_object_name_get(rect)); + + rect = evas_object_below_get(rect); + while (rect) + { + fprintf(stdout, ", %s", evas_object_name_get(rect)); + rect = evas_object_below_get(rect); + } + + fprintf(stdout, ".\n"); + + fprintf(stdout, "Current target rectangle is %s\n", + evas_object_name_get(d.rects[d.cur_rect])); + + fprintf(stdout, "Background rectangle's layer is %d\n", + evas_object_layer_get(d.bg)); + + return; + } + + if (strcmp(ev->keyname, "l") == 0) /* change background rectangle's layer */ + { + d.cur_layer = (d.cur_layer + 1) % 3; + evas_object_layer_set(d.bg, d.layers[d.cur_layer]); + + fprintf(stdout, "Changing background rectangle's layer to %d\n", + d.layers[d.cur_layer]); + return; + } + + if (strcmp(ev->keyname, "c") == 0) /* change rectangle to operate on */ + { + d.cur_rect = (d.cur_rect + 1) % 3; + + fprintf(stdout, "Changing target rectangle to the %s one\n", + evas_object_name_get(d.rects[d.cur_rect])); + return; + } + + if (strcmp(ev->keyname, "t") == 0) /* bring target to top */ + { + Evas_Object *neighbour; + + evas_object_raise(d.rects[d.cur_rect]); + + fprintf(stdout, "%s rectangle was re-stacked to the top if its layer\n", + name); + + neighbour = evas_object_below_get(d.rects[d.cur_rect]); + fprintf(stdout, "Below of %s rect is %s\n", name, + neighbour ? evas_object_name_get(neighbour) : "no object"); + return; + } + + if (strcmp(ev->keyname, "m") == 0) /* bring target to bottom */ + { + Evas_Object *neighbour; + + evas_object_lower(d.rects[d.cur_rect]); + + fprintf(stdout, + "%s rectangle was re-stacked to the bottom if its layer\n", + name); + + neighbour = evas_object_below_get(d.rects[d.cur_rect]); + fprintf(stdout, "Below of %s rect is %s\n", name, + neighbour ? evas_object_name_get(neighbour) : "no object"); + return; + } + + if (strcmp(ev->keyname, "p") == 0) /* toggle pass events */ + { + Eina_Bool pass = evas_object_pass_events_get(d.rects[d.cur_rect]); + + evas_object_pass_events_set(d.rects[d.cur_rect], !pass); + + fprintf(stdout, "%s rectangle is now set to%s pass (ignore) events\n", + name, pass ? " NOT" : ""); + + return; + } + + if (strcmp(ev->keyname, "r") == 0) /* toggle repeat events */ + { + Eina_Bool repeat = evas_object_repeat_events_get(d.rects[d.cur_rect]); + + evas_object_repeat_events_set(d.rects[d.cur_rect], !repeat); + + fprintf(stdout, "%s rectangle is now set to%s repeat events\n", + name, repeat ? " NOT" : ""); + + return; + } + + if (strcmp(ev->keyname, "a") == 0) /* stack target above */ + { + Evas_Object *neighbour = evas_object_above_get(d.rects[d.cur_rect]); + + if (!neighbour || (evas_object_layer_get(d.rects[d.cur_rect]) != + evas_object_layer_get(neighbour))) + return; + + evas_object_stack_above(d.rects[d.cur_rect], neighbour); + + fprintf(stdout, "%s rectangle was re-stacked one level above\n", name); + + neighbour = evas_object_above_get(d.rects[d.cur_rect]); + fprintf(stdout, "Above of %s rect is %s\n", name, + neighbour ? evas_object_name_get(neighbour) : "no object"); + + neighbour = evas_object_below_get(d.rects[d.cur_rect]); + fprintf(stdout, "Below of %s rect is %s\n", name, + neighbour ? evas_object_name_get(neighbour) : "no object"); + return; + } + + if (strcmp(ev->keyname, "b") == 0) /* stack target below */ + { + Evas_Object *neighbour = evas_object_below_get(d.rects[d.cur_rect]); + + if (!neighbour || (evas_object_layer_get(d.rects[d.cur_rect]) != + evas_object_layer_get(neighbour))) + return; + + evas_object_stack_below(d.rects[d.cur_rect], neighbour); + + fprintf(stdout, "%s rectangle was re-stacked one level below\n", name); + + neighbour = evas_object_above_get(d.rects[d.cur_rect]); + fprintf(stdout, "Above of %s rect is %s\n", name, + neighbour ? evas_object_name_get(neighbour) : "no object"); + + neighbour = evas_object_below_get(d.rects[d.cur_rect]); + + fprintf(stdout, "Below of %s rect is %s\n", name, + neighbour ? evas_object_name_get(neighbour) : "no object"); + return; + } +} + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +int +main(void) +{ + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_destroy_set(d.ee, _on_destroy); + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.canvas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.canvas); + evas_object_name_set(d.bg, "background"); /* white bg */ + evas_object_color_set(d.bg, 255, 255, 255, 255); + evas_object_move(d.bg, 0, 0); + evas_object_resize(d.bg, WIDTH, HEIGHT); + + d.layers[0] = evas_object_layer_get(d.bg); + d.layers[1] = d.layers[0] - 1; + d.layers[2] = d.layers[0] + 1; + + d.cur_layer = 1; + evas_object_layer_set(d.bg, d.layers[d.cur_layer]); /* let's start with it + * below the default + * layer */ + + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + d.rects[2] = evas_object_rectangle_add(d.canvas); + evas_object_name_set(d.rects[2], "blue"); + evas_object_color_set(d.rects[2], 0, 0, 255, 255); + + evas_object_resize(d.rects[2], WIDTH / 2.2, WIDTH / 2.2); + evas_object_move(d.rects[2], WIDTH / 6, WIDTH / 4.5); + evas_object_show(d.rects[2]); + evas_object_event_callback_add( + d.rects[2], EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, NULL); + + d.rects[1] = evas_object_rectangle_add(d.canvas); + evas_object_name_set(d.rects[1], "green"); + evas_object_color_set(d.rects[1], 0, 255, 0, 255); + + evas_object_resize(d.rects[1], WIDTH / 2.2, WIDTH / 2.2); + evas_object_move(d.rects[1], WIDTH / 2.5, WIDTH / 7); + evas_object_show(d.rects[1]); + evas_object_event_callback_add( + d.rects[1], EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, NULL); + + d.rects[0] = evas_object_rectangle_add(d.canvas); + evas_object_name_set(d.rects[0], "red"); + evas_object_color_set(d.rects[0], 255, 0, 0, 255); + + evas_object_resize(d.rects[0], WIDTH / 2.2, WIDTH / 2.2); + evas_object_move(d.rects[0], WIDTH / 3, WIDTH / 2.5); + evas_object_show(d.rects[0]); + evas_object_event_callback_add( + d.rects[0], EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, NULL); + + fprintf(stdout, commands); + ecore_main_loop_begin(); + + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); + return -1; +} diff --git a/libraries/evas/src/examples/evas-text.c b/libraries/evas/src/examples/evas-text.c new file mode 100644 index 0000000..ba55662 --- /dev/null +++ b/libraries/evas/src/examples/evas-text.c @@ -0,0 +1,411 @@ +/** + * Simple Evas example illustrating text objects + * + * You'll need at least one engine built for it (excluding the buffer + * one). See stdout/stderr for output. + * + * @verbatim + * gcc -o evas-text evas-text.c `pkg-config --libs --cflags evas ecore ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else + +#define PACKAGE_EXAMPLES_DIR "." +#define __UNUSED__ + +#endif + +#include +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +#define GREY {190, 190, 190, 255} +#define BLACK {0, 0, 0, 255} +#define WHITE {255, 255, 255, 255} +#define RED {255, 0, 0, 255} +#define GREEN {0, 255, 0, 255} +#define BLUE {0, 0, 255, 255} + +#define POINTER_CYCLE(_ptr, _array) \ + do \ + { \ + if ((unsigned)(((void *)(_ptr)) - ((void *)(_array))) >= \ + sizeof(_array)) \ + _ptr = _array; \ + } \ + while(0) + +static const char *commands = \ + "commands are:\n" + "\tt - change text's current style\n" + "\tz - change text's font size\n" + "\tf - change text's font family\n" + "\tb - change text's base color\n" + "\ts - change text's \'shadow\' color\n" + "\to - change text's \'outline\' color\n" + "\tw - change text's \'glow\' color\n" + "\tg - change text's \'glow 2\' color\n" + "\th - print help\n"; + +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; + +struct color_tuple +{ + int r, g, b, a; +}; + +struct text_preset_data +{ + const char **font_ptr; + const char *font[3]; + + struct color_tuple *text_ptr; + struct color_tuple text[6]; + + struct color_tuple *shadow_ptr; + struct color_tuple shadow[4]; + + struct color_tuple *outline_ptr; + struct color_tuple outline[4]; + + struct color_tuple *glow_ptr; + struct color_tuple glow[4]; + + struct color_tuple *glow2_ptr; + struct color_tuple glow2[4]; +}; + +struct test_data +{ + Ecore_Evas *ee; + Evas *evas; + struct text_preset_data t_data; + Evas_Object *text, *bg, *border; +}; + +static struct test_data d = {0}; + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +/* here just to keep our example's window size and background image's + * size in synchrony */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(d.bg, w, h); +} + +static const char * +_text_style_type_to_str(Evas_Text_Style_Type mode) +{ + switch (mode) + { + case EVAS_TEXT_STYLE_PLAIN: + return "plain"; + + case EVAS_TEXT_STYLE_SHADOW: + return "shadow"; + + case EVAS_TEXT_STYLE_OUTLINE: + return "outline"; + + case EVAS_TEXT_STYLE_SOFT_OUTLINE: + return "soft outline"; + + case EVAS_TEXT_STYLE_GLOW: + return "glow"; + + case EVAS_TEXT_STYLE_OUTLINE_SHADOW: + return "outline shadow"; + + case EVAS_TEXT_STYLE_FAR_SHADOW: + return "far shadow"; + + case EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW: + return "outline soft shadow"; + + case EVAS_TEXT_STYLE_SOFT_SHADOW: + return "soft shadow"; + + case EVAS_TEXT_STYLE_FAR_SOFT_SHADOW: + return "far soft shadow"; + + default: + return "invalid"; + } +} + +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (strcmp(ev->keyname, "t") == 0) /* change text's current style */ + { + Evas_Text_Style_Type type = evas_object_text_style_get(d.text); + + type = (type + 1) % 10; + + evas_object_text_style_set(d.text, type); + + fprintf(stdout, "Changing text's style to \'%s\'\n", + _text_style_type_to_str(type)); + + return; + } + + if (strcmp(ev->keyname, "f") == 0) /* change text's font */ + { + int sz; + + (d.t_data.font_ptr)++; + + evas_object_text_font_get(d.text, NULL, &sz); + + POINTER_CYCLE(d.t_data.font_ptr, d.t_data.font); + + evas_object_text_font_set(d.text, *d.t_data.font_ptr, sz); + + fprintf(stdout, "Changing text's font to %s\n", *d.t_data.font_ptr); + + return; + } + + if (strcmp(ev->keyname, "b") == 0) /* change text's base color */ + { + (d.t_data.text_ptr)++; + + POINTER_CYCLE(d.t_data.text_ptr, d.t_data.text); + + evas_object_color_set( + d.text, d.t_data.text_ptr->r, d.t_data.text_ptr->g, + d.t_data.text_ptr->b, d.t_data.text_ptr->a); + + fprintf(stdout, "Changing base color for text to (%d, %d, %d, %d)\n", + d.t_data.text_ptr->r, d.t_data.text_ptr->g, + d.t_data.text_ptr->b, d.t_data.text_ptr->a); + + return; + } + + if (strcmp(ev->keyname, "g") == 0) /* change text's glow 2 color */ + { + (d.t_data.glow2_ptr)++; + + POINTER_CYCLE(d.t_data.glow2_ptr, d.t_data.glow2); + + evas_object_text_glow2_color_set( + d.text, d.t_data.glow2_ptr->r, d.t_data.glow2_ptr->g, + d.t_data.glow2_ptr->b, d.t_data.glow2_ptr->a); + + fprintf(stdout, "Changing glow 2 color for text to (%d, %d, %d, %d)\n", + d.t_data.glow2_ptr->r, d.t_data.glow2_ptr->g, + d.t_data.glow2_ptr->b, d.t_data.glow2_ptr->a); + + return; + } + + if (strcmp(ev->keyname, "w") == 0) /* change text's glow color */ + { + (d.t_data.glow_ptr)++; + + POINTER_CYCLE(d.t_data.glow_ptr, d.t_data.glow); + + evas_object_text_glow_color_set( + d.text, d.t_data.glow_ptr->r, d.t_data.glow_ptr->g, + d.t_data.glow_ptr->b, d.t_data.glow_ptr->a); + + fprintf(stdout, "Changing glow color for text to (%d, %d, %d, %d)\n", + d.t_data.glow_ptr->r, d.t_data.glow_ptr->g, + d.t_data.glow_ptr->b, d.t_data.glow_ptr->a); + + return; + } + + if (strcmp(ev->keyname, "o") == 0) /* change text's outline color */ + { + (d.t_data.outline_ptr)++; + + POINTER_CYCLE(d.t_data.outline_ptr, d.t_data.outline); + + evas_object_text_outline_color_set( + d.text, d.t_data.outline_ptr->r, d.t_data.outline_ptr->g, + d.t_data.outline_ptr->b, d.t_data.outline_ptr->a); + + fprintf(stdout, "Changing outline color for text to (%d, %d, %d, %d)\n", + d.t_data.outline_ptr->r, d.t_data.outline_ptr->g, + d.t_data.outline_ptr->b, d.t_data.outline_ptr->a); + + return; + } + + if (strcmp(ev->keyname, "s") == 0) /* change text's shadow color */ + { + (d.t_data.shadow_ptr)++; + + POINTER_CYCLE(d.t_data.shadow_ptr, d.t_data.shadow); + + evas_object_text_shadow_color_set( + d.text, d.t_data.shadow_ptr->r, d.t_data.shadow_ptr->g, + d.t_data.shadow_ptr->b, d.t_data.shadow_ptr->a); + + fprintf(stdout, "Changing shadow color for text to (%d, %d, %d, %d)\n", + d.t_data.shadow_ptr->r, d.t_data.shadow_ptr->g, + d.t_data.shadow_ptr->b, d.t_data.shadow_ptr->a); + + return; + } + + if (strcmp(ev->keyname, "z") == 0) /* change text's font size */ + { + const char *font; + int size; + + evas_object_text_font_get(d.text, &font, &size); + + size = (size + 10) % 50; + if (!size) size = 10; + + evas_object_text_font_set(d.text, font, size); + + fprintf(stdout, "Changing text's font size to %d\n", size); + + return; + } +} + +int +main(void) +{ + int size; + const char *font; + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* init values one is going to cycle through while running this + * example */ + struct text_preset_data init_data = + { + .font = {"DejaVu", "Courier", "Utopia"}, + .text = {BLACK, WHITE, GREY, RED, GREEN, BLUE}, + .shadow = {WHITE, BLUE, GREEN, RED}, + .outline = {WHITE, RED, GREEN, BLUE}, + .glow = {WHITE, BLUE, GREEN, RED}, + .glow2 = {WHITE, RED, BLUE, GREEN} + }; + + d.t_data = init_data; + d.t_data.font_ptr = d.t_data.font; + d.t_data.text_ptr = d.t_data.text; + d.t_data.glow_ptr = d.t_data.glow; + d.t_data.glow2_ptr = d.t_data.glow2; + d.t_data.outline_ptr = d.t_data.outline; + d.t_data.shadow_ptr = d.t_data.shadow; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); + if (!d.ee) + goto error; + + ecore_evas_callback_destroy_set(d.ee, _on_destroy); + ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); + ecore_evas_show(d.ee); + + /* the canvas pointer, de facto */ + d.evas = ecore_evas_get(d.ee); + + d.bg = evas_object_rectangle_add(d.evas); + evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(d.bg, 0, 0); /* at canvas' origin */ + evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(d.bg); + + evas_object_focus_set(d.bg, EINA_TRUE); + evas_object_event_callback_add( + d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + d.text = evas_object_text_add(d.evas); + evas_object_text_style_set(d.text, EVAS_TEXT_STYLE_PLAIN); + + /* let the pre-set thingies be enforced */ + evas_object_color_set( + d.text, d.t_data.text_ptr->r, d.t_data.text_ptr->g, + d.t_data.text_ptr->b, d.t_data.text_ptr->a); + + evas_object_text_glow_color_set( + d.text, d.t_data.glow_ptr->r, d.t_data.glow_ptr->g, + d.t_data.glow_ptr->b, d.t_data.glow_ptr->a); + + evas_object_text_glow2_color_set( + d.text, d.t_data.glow2_ptr->r, d.t_data.glow2_ptr->g, + d.t_data.glow2_ptr->b, d.t_data.glow2_ptr->a); + + evas_object_text_outline_color_set( + d.text, d.t_data.outline_ptr->r, d.t_data.outline_ptr->g, + d.t_data.outline_ptr->b, d.t_data.outline_ptr->a); + + evas_object_text_shadow_color_set( + d.text, d.t_data.shadow_ptr->r, d.t_data.shadow_ptr->g, + d.t_data.shadow_ptr->b, d.t_data.shadow_ptr->a); + + evas_object_text_font_set(d.text, *d.t_data.font_ptr, 30); + evas_object_text_text_set(d.text, "sample text"); + + evas_object_resize(d.text, (3 * WIDTH) / 4, HEIGHT / 4); + evas_object_move(d.text, WIDTH / 8, (3 * HEIGHT) / 8); + evas_object_show(d.text); + + evas_object_text_font_get(d.text, &font, &size); + fprintf(stdout, "Adding text object with font %s, size %d\n", font, size); + + /* this is a border around the text object above, here just to + * emphasize its geometry */ + d.border = evas_object_image_filled_add(d.evas); + evas_object_image_file_set(d.border, border_img_path, NULL); + evas_object_image_border_set(d.border, 3, 3, 3, 3); + evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); + + evas_object_resize(d.border, ((3 * WIDTH) / 4) + 3, (HEIGHT / 4) + 3); + evas_object_move(d.border, (WIDTH / 8) - 3, ((3 * HEIGHT) / 8) - 3); + evas_object_show(d.border); + + fprintf(stdout, commands); + ecore_main_loop_begin(); + + ecore_evas_free(d.ee); + ecore_evas_shutdown(); + return 0; + +error: + fprintf(stderr, "you got to have at least one evas engine built and linked" + " up to ecore-evas for this example to run properly.\n"); + ecore_evas_shutdown(); + return -1; +} + diff --git a/libraries/evas/src/examples/im1.png b/libraries/evas/src/examples/im1.png new file mode 100644 index 0000000..aa37869 Binary files /dev/null and b/libraries/evas/src/examples/im1.png differ diff --git a/libraries/evas/src/examples/red.png b/libraries/evas/src/examples/red.png new file mode 100644 index 0000000..dd03528 Binary files /dev/null and b/libraries/evas/src/examples/red.png differ -- cgit v1.1