summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bouchaud(yoz) <yoz@efl.so>2017-03-15 18:21:22 +0100
committerMichael Bouchaud(yoz) <yoz@efl.so>2017-03-15 18:21:22 +0100
commitb314692e161c599ca442c1db2f57ca01a2ee7591 (patch)
tree3c22202aaf088a058a4136e752fa5948938268ce
parent89ce0f0ea99143fd6c48986d744bdcfb6bdd2820 (diff)
elementary: add raw image load to elm_photocamdevs/yoz/wip
-rw-r--r--src/lib/elementary/elm_photocam.c83
-rw-r--r--src/lib/elementary/elm_photocam.eo12
2 files changed, 94 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_photocam.c b/src/lib/elementary/elm_photocam.c
index 0dd18fc7ea..4107d5f843 100644
--- a/src/lib/elementary/elm_photocam.c
+++ b/src/lib/elementary/elm_photocam.c
@@ -1758,6 +1758,7 @@ _elm_photocam_is_remote(const char *file)
1758 return EINA_FALSE; 1758 return EINA_FALSE;
1759} 1759}
1760 1760
1761
1761static Evas_Load_Error 1762static Evas_Load_Error
1762_elm_photocam_file_set_internal(Eo *obj, Elm_Photocam_Data *sd, const char *file) 1763_elm_photocam_file_set_internal(Eo *obj, Elm_Photocam_Data *sd, const char *file)
1763{ 1764{
@@ -1794,6 +1795,87 @@ _elm_photocam_file_set_internal(Eo *obj, Elm_Photocam_Data *sd, const char *file
1794 return ret; 1795 return ret;
1795} 1796}
1796 1797
1798static void
1799_internal_data_set(Eo *obj, Elm_Photocam_Data *sd, void *data, int w, int h, Evas_Load_Error *ret)
1800{
1801 double tz;
1802
1803 evas_object_hide(sd->img);
1804 evas_object_image_data_copy_set (sd->img, data);
1805 evas_object_image_size_set(sd->img, w, h);
1806
1807 sd->do_region = EINA_FALSE;
1808
1809 sd->size.imw = w;
1810 sd->size.imh = h;
1811 sd->size.w = w / sd->zoom;
1812 sd->size.h = h / sd->zoom;
1813 evas_object_raise(sd->img);
1814 evas_object_show(sd->img);
1815
1816 sd->no_smooth--;
1817 if (sd->no_smooth == 0)
1818 _smooth_update(obj);
1819
1820 evas_object_raise (sd->img);
1821 evas_object_show (sd->img);
1822 sd->main_load_pending = EINA_TRUE;
1823
1824 if (sd->calc_job) ecore_job_del(sd->calc_job);
1825 sd->calc_job = ecore_job_add(_calc_job_cb, sd);
1826 evas_object_smart_callback_call(obj, SIG_LOAD, NULL);
1827
1828 evas_object_show (sd->img);
1829 tz = sd->zoom;
1830 sd->zoom = 0.0;
1831 elm_photocam_zoom_set(obj, tz);
1832
1833 evas_object_hide(sd->img);
1834
1835 evas_object_image_data_copy_set (sd->img, data);
1836 sd->main_load_pending = EINA_TRUE;
1837
1838 evas_object_smart_callback_call(obj, SIG_LOAD, NULL);
1839
1840 evas_object_show (sd->img);
1841
1842 tz = sd->zoom;
1843 sd->zoom = 0.0;
1844 elm_photocam_zoom_set(obj, tz);
1845
1846 if (ret) *ret = evas_object_image_load_error_get(sd->img);
1847}
1848static Evas_Load_Error
1849_elm_photocam_image_data_set_internal(Eo *obj, Elm_Photocam_Data *sd, void *data, int w, int h)
1850{
1851 Evas_Load_Error ret = EVAS_LOAD_ERROR_NONE;
1852
1853 _grid_clear_all(obj);
1854 _elm_photocam_zoom_reset(obj, sd);
1855 _elm_photocam_bounce_reset(obj, sd);
1856 sd->no_smooth--;
1857 if (sd->no_smooth == 0) _smooth_update(obj);
1858
1859 ecore_job_del(sd->calc_job);
1860 evas_object_hide(sd->img);
1861
1862 _internal_data_set(obj, sd, data, w, h, &ret);
1863
1864 return ret;
1865}
1866
1867EOLIAN static Eina_Bool
1868_elm_photocam_image_data_set(Eo *obj, Elm_Photocam_Data *sd, void *data, int w, int h)
1869{
1870 ELM_PHOTOCAM_CHECK(obj) EVAS_LOAD_ERROR_NONE;
1871 if ((!data) || (w < 1) || (h < 1)) return EVAS_LOAD_ERROR_NONE;
1872 return (EVAS_LOAD_ERROR_NONE ==_elm_photocam_image_data_set_internal(obj, sd, data, w, h));
1873}
1874
1875
1876
1877
1878
1797EOLIAN static Eina_Bool 1879EOLIAN static Eina_Bool
1798_elm_photocam_efl_file_file_set(Eo *obj, Elm_Photocam_Data *sd, const char *file, const char *key EINA_UNUSED) 1880_elm_photocam_efl_file_file_set(Eo *obj, Elm_Photocam_Data *sd, const char *file, const char *key EINA_UNUSED)
1799{ 1881{
@@ -1832,7 +1914,6 @@ elm_photocam_file_set(Elm_Photocam *obj, const char *file)
1832 EVAS_LOAD_ERROR_UNKNOWN_FORMAT : 1914 EVAS_LOAD_ERROR_UNKNOWN_FORMAT :
1833 EVAS_LOAD_ERROR_GENERIC; 1915 EVAS_LOAD_ERROR_GENERIC;
1834} 1916}
1835
1836EOLIAN static void 1917EOLIAN static void
1837_elm_photocam_efl_file_file_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd, const char **file, const char **key) 1918_elm_photocam_efl_file_file_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd, const char **file, const char **key)
1838{ 1919{
diff --git a/src/lib/elementary/elm_photocam.eo b/src/lib/elementary/elm_photocam.eo
index e2197bac4d..c623de5f90 100644
--- a/src/lib/elementary/elm_photocam.eo
+++ b/src/lib/elementary/elm_photocam.eo
@@ -186,6 +186,18 @@ class Elm.Photocam (Elm.Widget, Elm.Interface_Scrollable,
186 @in h: int; [[Height of region in image original pixels]] 186 @in h: int; [[Height of region in image original pixels]]
187 } 187 }
188 } 188 }
189 image_data_set {
190 [[Set the viewed region of the image
191
192 This shows the region of the image without using animation.
193 ]]
194 params {
195 @in data: void_ptr; [[X-coordinate of region in image original pixels]]
196 @in w: int; [[Width of region in image original pixels]]
197 @in h: int; [[Height of region in image original pixels]]
198 }
199 return: bool;
200 }
189 } 201 }
190 implements { 202 implements {
191 class.constructor; 203 class.constructor;