summaryrefslogtreecommitdiff
path: root/src/lib/efl/interfaces/efl_gfx_image.eo
blob: 1dd77f305859cbdaed068ba5ad67c254dec6b7ae (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
200
201
202
203
204
205
206
207
208
209
210
211
212
import efl_gfx_types;

enum Efl.Gfx.Image_Content_Hint
{
   [[How an image's data is to be treated by EFL, for optimization.]]
   none = 0,    [[No hint on the content (default).]]
   dynamic = 1, [[The content will change over time.]]
   static = 2   [[The content won't change over time.]]
}

enum Efl.Gfx.Image_Scale_Hint
{
  /* FIXME: Legacy is in Emile, where it does not belong. */
  [[How an image's data is to be treated by EFL, with regard to scaling cache.]]
  none = 0,    [[No hint on the scaling (default).]]
  dynamic = 1, [[Image will be re-scaled over time, thus turning scaling cache OFF for its data.]]
  static = 2   [[Image will not be re-scaled over time, thus turning scaling cache ON for its data.]]
}

enum Efl.Gfx.Image_Scale_Type
{
   [[Enumeration that defines scale types of an image.]]
   fill,        [[Scale the image so that it matches 
                  the object's area exactly.
                  The image's aspect ratio might be changed.]]
   fit_inside,  [[Scale the image
                  so that it fits inside the object's area
                  while maintaining the aspect ratio.
                  At least one of the dimensions of the image
                  should be equal to the corresponding dimension 
                  of the object.]]
   fit_outside, [[Scale the image
                  so that it covers the entire object area
                  while maintaining the aspect ratio.
                  At least one of the dimensions of the image
                  should be equal to the corresponding 
                  dimension of the object.]]
   tile,        [[Tile image at its original size.]]
   none         [[Not scale the image]]
}

interface Efl.Gfx.Image ()
{
   [[Common APIs for all 2D images that can be rendered on the canvas.]]

   methods {
      @property smooth_scale {
         [[Whether to use high-quality image scaling algorithm for this image.

           When enabled, a higher quality image scaling algorithm is used
           when scaling images to sizes other than the source image's
           original one. This gives better results but is more
           computationally expensive.

           $true by default
         ]]
         set {}
         get {}
         values {
            smooth_scale: bool; [[Whether to use smooth scale or not.]]
         }
      }
      @property scale_type {
         [[Control how the image is scaled.]]
         values {
            scale_type: Efl.Gfx.Image_Scale_Type; [[Image scale type]]
         }
      }
      @property ratio {
         [[The native width/height ratio of the image.]]
         get {
            [[Returns 1.0 if not applicable (eg. height = 0).]]
         }
         values {
            ratio: double; [[The image's ratio.]]
         }
      }
      @property border {
         [[Dimensions of this image's border, a region that does not scale
           with the center area.

           When EFL renders an image, its source may be scaled to fit
           the size of the object. This function sets an area from
           the borders of the image inwards which is not to be scaled.
           This function is useful for making frames and for widget
           theming, where, for example, buttons may be of varying
           sizes, but their border size must remain constant.

           The units used for $l, $r, $t and $b are canvas units (pixels).

           Note: The border region itself may be scaled by the
           @.border_scale.set function.

           Note: By default, image objects have no borders set, i.e.
           $l, $r, $t and $b start as 0.

           Note: Similar to the concepts of 9-patch images or cap insets.
         ]]
         set {}
         get {}
         values {
            l: int; [[The border's left width.]]
            r: int; [[The border's right width.]]
            t: int; [[The border's top height.]]
            b: int; [[The border's bottom height.]]
         }
      }
      @property border_scale {
         [[Scaling factor applied to the image borders.

           This value multiplies the size of the @.border when scaling an
           object.

           Default value is 1.0 (no scaling).
         ]]
         set {}
         get {}
         values {
            scale: double; [[The scale factor.]]
         }
      }
      @property border_center_fill {
         [[Specifies how the center part of the object (not the borders)
           should be drawn when EFL is rendering it.

           This function sets how the center part of the image object's
           source image is to be drawn, which must be one of the values
           in @Efl.Gfx.Border_Fill_Mode. By center we mean the complementary
           part of that defined by @.border.set. This is very useful for
           making frames and decorations. You would most probably also be
           using a filled image (as in @Efl.Gfx.Fill.fill_auto) to use as a frame.

           The default value is @Efl.Gfx.Border_Fill_Mode.default, ie. render
           and scale the center area, respecting its transparency.
         ]]
         set {}
         get {}
         values {
            fill: Efl.Gfx.Border_Fill_Mode; [[Fill mode of the center region.]]
         }
      }
      @property image_size {
         [[This represents the size of the original image in pixels.

           This may be different from the actual geometry on screen or even
           the size of the loaded pixel buffer. This is the size of the image
           as stored in the original file.

           This is a read-only property, and may return 0x0.

           @since 1.20
         ]]
         get {}
         values {
            size: Eina.Size2D; [[The size in pixels.]]
         }
      }

      /* Note: those are obscure features of evas image. Expose in Efl.Gfx.Image? */
      @property content_hint {
         set {
            [[Set the content hint setting of a given image object of the
              canvas.

              This function sets the content hint value of the given image
              of the canvas. For example, if you're on the GL engine and
              your driver implementation supports it, setting this hint to
              #EVAS_IMAGE_CONTENT_HINT_DYNAMIC will make it need zero copies
              at texture upload time, which is an "expensive" operation.
            ]]
         }
         get {
            [[Get the content hint setting of a given image object of the
              canvas.

              This returns #EVAS_IMAGE_CONTENT_HINT_NONE on error.
            ]]
         }
         values {
            hint: Efl.Gfx.Image_Content_Hint; [[Dynamic or static content hint,
                                            see @Efl.Gfx.Image_Content_Hint]]
         }
      }
      @property scale_hint {
         set {
            [[Set the scale hint of a given image of the canvas.

              This function sets the scale hint value of the given image
              object in the canvas, which will affect how Evas is to cache
              scaled versions of its original source image.
            ]]
         }
         get {
            [[Get the scale hint of a given image of the canvas.

              This function returns the scale hint value of the given image
              object of the canvas.
            ]]
         }
         values {
            hint: Efl.Gfx.Image_Scale_Hint; [[Scalable or static size hint,
                                          see @Efl.Gfx.Image_Scale_Hint]]
         }
      }
   }
   events {
      preload: void; [[Image data has been preloaded.]]
      resize: void;  [[Image was resized (its pixel data).]]
      unload: void;  [[Image data has been unloaded (by some mechanism in
                       EFL that threw out the original image data).]]
   }
}