-
Notifications
You must be signed in to change notification settings - Fork 92
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
How to set the width of dashed lines & Why do the dashed lines blink #91
Comments
Hello @ChauncyZhang, I am not sure why dashed lines blink, as Nano-X doesn't support blinking directly with graphics draw. Can you describe your framebuffer hardware, does it support hardware blinking with some color combinations? Perhaps try drawing with a different color than GR_COLOR_RED to see if any difference results. Please post a screenshot or photo so I can get a better understanding of how layer is below image. To set the dashed line width and/or dash count, use Thank you! |
https://github.com/user-attachments/assets/c1285709-e0b0-47e6-a418-cf994f463751 |
Hmmm, it seems that the blinking may be the result of the background being erased and then the image redrawn, which produces a flicker. Flicker is not the same as blink, so I misunderstood your problem. In order to remove flicker, one must either 1) redraw the background that changed, then redraw the foreground without background bits, or 2) redraw the entire background and foreground at the same time, without erasing the screen beforehand. That said, does this occur only when using dashed lines, or have you looked at the result using solid lines instead with no problems? |
`GrSetGCForeground(gc_, BLACK);
`void ns::Render::CrossDividingLine(int x, int y) { void Render::DrawDashedLine(GR_WINDOW_ID window, Every frame is refreshed. When drawing, I will delete the screen and copy back_buffer to the window, what is the problem with the process? |
I am not sure, I don't have the time to debug your code right now. You haven't answered the question I asked, does this happen only with dashed lines or will it work without them? We need to eliminate variables to get root of the problem.
What do you mean "delete the screen"? If that involves a repaint of background, then you will see flicker, even when using a back buffer. You might try setting background color to WHITE instead of black, this method shows sometimes when background is being drawn differently by different graphics calls to help debug why the display is flickering. |
`GrSetGCForeground(gc_, BLACK);
GrFillRect(back_buffer_id_, gc_, 0, 0, screen_info_.cols,
screen_info_.rows);
GrArea(back_buffer_id_, gc_, 0, 0, screen_info_.cols, screen_info_.rows,
(void*)frame.data, MWPF_PIXELVAL);
DrawText("Please press confirm after overlap", screen_info_.cols / 2, 200);
GrSetGCForeground(gc_, GR_COLOR_RED);
DrawDashedLine(wid_, gc_, x - 200, y, x + 200, y);
DrawDashedLine(wid_, gc_, x, y - 200, x, y + 200);
GrCopyArea(wid_, gc_, 0, 0, screen_info_.cols, screen_info_.rows,
back_buffer_id_, 0, 0, MWROP_SRC);
GrFlush();`
The text and image show well, but the dashed lines always blink, and seem like the layer is below the image, but I can see the dashed line.
I have two questions, 1. Why does the dashed line blink, 2. How to set the width of dashed lines?
The text was updated successfully, but these errors were encountered: