summaryrefslogtreecommitdiff
path: root/src/lib/efl/interfaces/efl_image_load.eo
blob: 65e4853111976f8c1d6d4007a080ce71987b23bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
import efl_gfx_types;

/*
enum Efl.Image.Load.State
{
   none = 0,      [[Not loading any image.]]
   loaded = 1,    [[Image data is loaded, nothing is pending.]]
   pending = 2,   [[The image has been queued for load, but actual loading may not have started yet.]]
   loading = 3,   [[The image is currently loading.]]
   error = 4,     [[Image load has failed. Call @Efl.Image.Load.load_error.get to know why.]]
   cancelled = 5  [[Image load has been cancelled.]]
}
*/

interface Efl.Image.Load ()
{
   [[Common APIs for all loadable 2D images.]]

   methods {
      load_async_start {
         [[Begin preloading an image object's image data in the background.

           Once the background task is done, the event $load,done will be
           emitted.
         ]]
      }
      load_async_cancel {
         [[Cancel preloading an image object's image data in the background.

           The event $load,cancelled should be triggered soon after
           cancellation happened, and the object should be left in a state
           where it has no image data. If cancel is called too late, the image
           will be kept in memory.
         ]]
      }
      /*
      @property load_state {
         get {
            [[Queries information on the current state of load of the image.

              While more relevant to asynchronous load, this will also return
              meaningful information about the last synchronous load.
            ]]
         }
         values {
            state: Efl.Image.Load.State; [[Image loading status]]
         }
      }
      */
      @property load_size {
         [[The load size of an image.

           The image will be loaded into memory as if it was the specified
           size instead of its original size. This can save a lot of memory,
           and is important for scalable types like svg.

           By default, the load size is not specified, so it is 0x0.
         ]]
         set {
            [[Requests the canvas to load the image at the given size.

              EFL will try to load the image at the requested size, but does
              not guarantee an exact match between the request and the loaded
              image dimensions.
            ]]
         }
         get {
            [[Returns the requested load size.]]
         }
         values {
            size: Eina.Size2D; [[The image load size.]]
         }
      }
      @property load_dpi {
         set {
            [[Set the DPI resolution of an image object's source image.

              This function sets the DPI resolution of a given loaded canvas
              image. Most useful for the SVG image loader.
            ]]
         }
         get {
            [[Get the DPI resolution of a loaded image object in the canvas.

              This function returns the DPI resolution of the given canvas
              image.
            ]]
         }
         values {
            dpi: double; [[The DPI resolution.]]
         }
      }
      @property load_region_support {
         [[Indicates whether the @.load_region property is supported for the
           current file.

           @since 1.2
         ]]
         get {}
         values {
            support: bool; [[$true if region load of the image is supported, $false otherwise]]
         }
      }
      @property load_region {
         set {
            [[Inform a given image object to load a selective region of its
              source image.

              This function is useful when one is not showing all of an
              image's area on its image object.

              Note: The image loader for the image format in question has
              to support selective region loading in order to this function
              to take effect.
            ]]
         }
         get {
            [[Retrieve the coordinates of a given image object's selective
              (source image) load region.
            ]]
         }
         values {
            region: Eina.Rect; [[A region of the image.]]
         }
      }
      @property load_orientation {
         [[Defines whether the orientation information in the image file
           should be honored.

           The orientation can for instance be set in the EXIF tags of a
           JPEG image. If this flag is $false, then the orientation will be
           ignored at load time, otherwise the image will be loaded with the
           proper orientation.

           @since 1.1
         ]]
         set {}
         get {}
         values {
            enable: bool; [[$true means that it should honor the orientation
                            information.]]
         }
      }
      @property load_scale_down {
         [[The scale down factor is a divider on the original image size.

           Setting the scale down factor can reduce load time and memory usage,
           at the cost of having a scaled down image in memory.

           This function sets the scale down factor of a given canvas
           image. Most useful for the SVG image loader, but also applies
           to JPEG, PNG and BMP.

           Powers of two (2, 4, 8) are best supported (especially with JPEG)
         ]]
         set {
            [[Requests the image loader to scale down by $div times.
              Call this before starting the actual image load.
            ]]
         }
         get {}
         values {
            div: int; [[The scale down dividing factor.]]
         }
      }
      @property load_error {
         get {
            [[Retrieves a number representing any error that occurred during
              the last loading of the given image object's source image.
            ]]
            return: Efl.Image.Load.Error @warn_unused; [[
               A value giving the last error that occurred, one of
               @Efl.Image.Load.Error values. @Efl.Image.Load.Error.none is
               returned if there was no error.
            ]]
         }
      }
      @property load_skip_header {
         [[Initial load should skip header check and leave it all to data load

           If this is true, then future loads of images will defer header
           loading to a preload stage and/or data load later on rather than
           at the start when the load begins (e.g. when file is set).
         ]]
         set {
            [[Set the skip header state for susbsequent loads of a file. ]]
         }
         get {}
         values {
            skip: bool; [[Will be true if header is to be skipped. ]]
         }
      }
   }
   events {
      load,done; [[Called when he image was loaded]]
      load,error: Efl.Image.Load.Error; [[Called when an error happened during image loading]]
      load,cancelled; [[Called when the image loading was cancelled]]
   }
}