Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve highlighting of repainted areas #180

Closed
lc-soft opened this issue Sep 22, 2019 · 8 comments · Fixed by #190
Closed

Improve highlighting of repainted areas #180

lc-soft opened this issue Sep 22, 2019 · 8 comments · Fixed by #190
Labels
🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt low priority

Comments

@lc-soft
Copy link
Owner

lc-soft commented Sep 22, 2019

Issuehunt badges

Is your feature request related to a problem? Please describe.

LCUI/src/display.c

Lines 173 to 184 in 4a9516e

/**
* FIXME: Improve highlighting of repainted areas
* Let the highlighted areas disappear after a short
* period of time, just like flashing
*/
if (display.show_rect_border) {
DrawBorder(paint);
}
if (display.mode != LCUI_DMODE_SEAMLESS) {
LCUICursor_Paint(paint);
}
Surface_EndPaint(s, paint);

Describe the solution you'd like

Remove DrawBorder() function and use FlashPaintArea() instead, this function should do the following:

  • Save the repainting area and its paint time into a list.
    record.rect = paint_rect;
    record.paint_time = clock();
    LinkedList_Append(&list, &record);
  • Create a timer to repaint each highlighted area of the list every 10 milliseconds.
    int timer = LCUI_SetInterval(10, OnUpdateHighlightArea, NULL);
  • Check the paint time of the highlighted area:
    if (clock() - record.paint_time >= duration) {
        // remove record and get next area.
    }
  • Fill the repainted area with the corresponding transparency color based on the current time:
    • Create a bitmap named mask:
      LCUI_Graph mask;
      
      Graph_Init(&mask);
      mask.color_type = LCUI_COLOR_TYPE_ARGB;
      Graph_Create(&mask, record.rect.width, record.rect.height);
    • Fill color into mask:
      Graph_FillRect(&mask, NULL, RGBA(255, 0, 0, 200), TRUE);
    • Paint a border to the mask. Refer the DrawBorder() function
    • Compute mask opacity:
      mask.opactiy = 1.0 * (record.paint_time + duration - clock()) / duration;
    • Render the original content of the painting area and blend mask into the canvas:
      paint = Surface_BeginPaint(s, paint_rect);
      Widget_Render(record->widget, paint);
      Graph_Mix(&paint->canvas, &mask);
      Surface_EndPaint(s, paint);

The final effect should be the same as the paint flashing of Google Chrome:

highlights-areas

Describe alternatives you've considered
None.

Additional context
None.


IssueHunt Summary

vbalyasnyy vbalyasnyy has been rewarded.

Backers (Total: $10.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@issuehunt-oss
Copy link

issuehunt-oss bot commented Sep 22, 2019

@lc-soft has funded $5.00 to this issue.


@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Sep 22, 2019
@lc-soft lc-soft added easy This issue is easy to solve help wanted labels Sep 22, 2019
@lc-soft lc-soft pinned this issue Sep 23, 2019
@anshulxyz
Copy link
Contributor

hi, @lc-soft can you describe further what you mean by "improve" the highlighting, can you show some examples?

@issuehunt-oss
Copy link

issuehunt-oss bot commented Oct 1, 2019

@lc-soft has funded $5.00 to this issue.


@anshulxyz
Copy link
Contributor

@lc-soft do you have any design/style in mind?

@lc-soft
Copy link
Owner Author

lc-soft commented Oct 1, 2019

@anshulxyz This is a low priority task and I will update the description as soon as possible.

@anshulxyz
Copy link
Contributor

Alright 🙏

@lc-soft lc-soft removed the easy This issue is easy to solve label Oct 1, 2019
@lc-soft
Copy link
Owner Author

lc-soft commented Oct 1, 2019

@anshulxyz The issue description has been updated. Maybe the implementation of this feature is a bit complicated.

@lc-soft lc-soft unpinned this issue Nov 22, 2019
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 18, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 18, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 19, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
lc-soft pushed a commit to vbalyasnyy/LCUI that referenced this issue Dec 22, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
lc-soft pushed a commit to vbalyasnyy/LCUI that referenced this issue Dec 22, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 22, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 22, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 23, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 23, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 23, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Dec 23, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
lc-soft pushed a commit that referenced this issue Dec 23, 2019
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
@issuehunt-oss
Copy link

issuehunt-oss bot commented Dec 23, 2019

@lc-soft has rewarded $8.00 to @vbalyasnyy. See it on IssueHunt

  • 💰 Total deposit: $10.00
  • 🎉 Repository reward(10%): $1.00
  • 🔧 Service fee(10%): $1.00

@issuehunt-oss issuehunt-oss bot added 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt and removed 💵 Funded on Issuehunt This issue has been funded on Issuehunt labels Dec 23, 2019
lc-soft pushed a commit that referenced this issue Jan 19, 2020
Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants