Page MenuHomePhabricator

enum Efl.Orient
Open, TODOPublic

Description

enum @beta Efl.Orient
{
   [[An orientation type, to rotate visual objects.

     Not to be confused with @Efl.Ui.Dir which is meant for widgets, rather
     than images and canvases. This enum is used to rotate images, videos and
     the like.

     See also @Efl.Orientation.
   ]]
   none = 0,   [[Default, same as up]]
   up = 0,     [[Orient up, do not rotate.]]
   right = 90, [[Orient right, rotate 90 degrees counter clock-wise.]]
   down = 180, [[Orient down, rotate 180 degrees.]]
   left = 270, [[Orient left, rotate 90 degrees clock-wise.]]
}

Related Objects

StatusAssignedTask
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
segfaultxavi triaged this task as TODO priority.
segfaultxavi moved this task from Backlog to Evaluating on the efl: api board.Wed, May 15, 5:02 AM

Besides the comment in T7878 regarding the possible merging of this class with Efl.Flip, I am not sure {up, down, left, right} are sensible names for a rotation. What does it mean that an icon is oriented "to the right"?
How about we rename the enum ROTATION_0, ROTATION_90, etc ?

Is this API related to T7712 in any way?

I would say yeah.

segfaultxavi added a comment.EditedThu, May 16, 10:48 AM

After a lengthy brainstorming session:

  • Rename this enum to Efl.Gfx.Image_Orientation
  • Turn it into a bitfield and include flipping values in both axes
  • Use it in all places where Efl.Orientation was used except in Efl.Ui.Layout_Base.theme_rotation_apply, that should be turned into an int.
  • Delete Efl.Orientation and Efl.Flip.

After a lengthy brainstorming session:

  • Rename this enum to Efl.Gfx.Orientation
  • Turn it into a bitfield and include flipping values in both axes
  • Use it in all places where Efl.Orientation was used except in Efl.Ui.Layout_Base.theme_rotation_apply, that should be turned into an int.
  • Delete Efl.Orientation and Efl.Flip.

It should be Efl.Gfx.Image_Orientation, but otherwise this seems right.

Edited, thanks.

segfaultxavi reopened this task as Open.Mon, May 20, 9:05 AM

Stay put, phab.

After that commit, it now looks like this and I think it's good to go:

enum @beta Efl.Gfx.Orientation
{
   [[An orientation type, to rotate and flip images.

     This is similar to EXIF's orientation.
     Directional values ($up, $down, $left, $right) indicate the final direction in
     which the top of the image will be facing (e.g. a picture of a house will have
     its roof pointing to the right if the $right orientation is used).
     Flipping values ($flip_horizontal and $flip_vertical) can be additionaly added
     to produce a mirroring in each axis.
     Not to be confused with @Efl.Ui.Dir which is meant for widgets, rather
     than images and canvases. This enum is used to rotate images, videos and
     the like.
   ]]
   none = 0,             [[Default, same as up, do not rotate.]]
   up = 0,               [[Orient up, do not rotate.]]
   right = 1,            [[Orient right, rotate 90 degrees clock-wise.]]
   down = 2,             [[Orient down, rotate 180 degrees.]]
   left = 3,             [[Orient left, rotate 270 degrees clock-wise.]]
   rotation_bitmask = 3, [[Bitmask that can be used to isolate rotation values, that is, $none, $up, $down, $left and $right.]]
   flip_horizontal = 4,  [[Mirror horizontally. Can be added to the other values.]]
   flip_vertical = 8,    [[Mirror vertically. Can be added to the other values.]]
   flip_bitmask = 12     [[Bitmask that can be used to isolate flipping values, that is, $flip_vertical and $flip_horizontal.]]
}