lc-soft/LCUI

Improve highlighting of repainted areas #180

lc-soft posted onGitHub

Is your feature request related to a problem? Please describe. https://github.com/lc-soft/LCUI/blob/4a9516e8eb3bc23b681575653ac31468093d8a2c/src/display.c#L173-L184

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.


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


posted by issuehunt-app[bot] over 5 years ago

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

posted by anshulxyz over 5 years ago

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


posted by issuehunt-app[bot] over 5 years ago

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

posted by anshulxyz over 5 years ago

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

posted by lc-soft over 5 years ago

Alright :pray:

posted by anshulxyz over 5 years ago

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

posted by lc-soft over 5 years ago

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

  • :moneybag: Total deposit: $10.00
  • :tada: Repository reward(10%): $1.00
  • :wrench: Service fee(10%): $1.00
posted by issuehunt-app[bot] over 5 years ago

Fund this Issue

$10.00
Rewarded

Rewarded pull request

Recent activities

vbalyasnyy was rewarded by lc-soft for lc-soft/LCUI# 180
over 5 years ago
lc-soft submitted an output to  lc-soft/ LCUI# 180
over 5 years ago