Page MenuHomePhabricator

evas: add an API to know where inside an object content can be layout over.
ClosedPublic

Authored by cedric on Jun 14 2019, 4:59 PM.

Details

Summary

The first step with this API is to use the information provided when setting
the border on an image to define the content area inside it. Improvement will
be to use more flexible stretch region area to make it more customizable and
finally read the information from a 9patch file (.9.png).

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cedric created this revision.Jun 14 2019, 4:59 PM
cedric requested review of this revision.Jun 14 2019, 4:59 PM
cedric updated this revision to Diff 22730.Jun 14 2019, 5:01 PM
cedric edited the summary of this revision. (Show Details)

Just screwed by phab.

Shouldn't this be fill_area or something like that since we use that terminology in image API? cc @segfaultxavi for doc cop action

https://i.gifer.com/26ME.gif

I've read all image-related eo files and I cannot find any property named "area". What did you have in mind, @zmike?

@cedric: Is content_zone a common name in 9-patch terminology, or is it something you came up with?

zmike added a comment.Jun 17 2019, 9:45 AM

https://i.gifer.com/26ME.gif

I've read all image-related eo files and I cannot find any property named "area". What did you have in mind, @zmike?

@cedric: Is content_zone a common name in 9-patch terminology, or is it something you came up with?

I meant that we use "fill"

In D9093#167406, @zmike wrote:

https://i.gifer.com/26ME.gif

I've read all image-related eo files and I cannot find any property named "area". What did you have in mind, @zmike?

@cedric: Is content_zone a common name in 9-patch terminology, or is it something you came up with?

I meant that we use "fill"

No, this has nothing to do with fill. 9 patch have the concept of defining an area where content is supposed to go in. This is what the right and bottom border means and are used for. You can check https://developer.android.com/guide/topics/graphics/drawables#nine-patch for more detail, but basically as it is stating there: "The bottom and right lines define the relative area within the image that the contents of the view are allowed to occupy.".

Ideally, I would like to expose that all the way to edje_cc and get that as offset information so that you wouldn't even need to report it inside edc to leverage 9patch file.

I could drop the "zone" suffix from all the newly added API if that is fine for you.

cedric updated this revision to Diff 22837.Jun 19 2019, 12:13 PM
cedric edited the summary of this revision. (Show Details)

Rebase and take comment into account.

zmike added a comment.Thu, Jun 20, 6:57 AM

I'm just not sure we want to use zone here, but maybe that's only me. @segfaultxavi what do you think?

You made me look into this in more detail, and I found another issue. There's another property here called border_center_fill which is very related to the newly introduced content_zone. These two need to be consistent.

border_center_fill was a horrible name to begin with (it contains both "border" and "center", which are antonyms, and does not include "mode").

If @zmike does not like "content", how about "region"?

border -> border_region
content_zone -> content_region
border_center_fill -> content_region_mode

cedric planned changes to this revision.Thu, Jun 20, 9:20 AM

I like region.

cedric updated this revision to Diff 22892.Thu, Jun 20, 4:58 PM
cedric edited the summary of this revision. (Show Details)

Rebase and rename.

@cedric can you also rename the other two region properties?
Maybe in another patch, to avoid a whole patchset rebase...

@cedric

Fundamentally the behavior is nothing different with border_get()...
Later, will you return the actual pixel data region? or just geometry region?

Hermet accepted this revision.Wed, Jun 26, 3:22 AM
This revision is now accepted and ready to land.Wed, Jun 26, 3:22 AM
This revision was automatically updated to reflect the committed changes.