aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-04-28 01:09:37 +0300
committerJoursoir <chat@joursoir.net>2022-04-28 01:09:50 +0300
commit1d7319cdabef8ed161b30ea671e2cf308a995f42 (patch)
tree750bfeaeac63925ec0043a0a979726af034aaacd
parent799b75d1a6ef41d96b4bee2b92733e0ad1e6f462 (diff)
downloadumt-1d7319cdabef8ed161b30ea671e2cf308a995f42.tar.gz
umt-1d7319cdabef8ed161b30ea671e2cf308a995f42.tar.bz2
umt-1d7319cdabef8ed161b30ea671e2cf308a995f42.zip
graphics: add the rounded rectangle drawing routine
-rw-r--r--UefiMonitorTest/Graphics.c27
-rw-r--r--UefiMonitorTest/Graphics.h11
2 files changed, 38 insertions, 0 deletions
diff --git a/UefiMonitorTest/Graphics.c b/UefiMonitorTest/Graphics.c
index fc9571c..7c76e37 100644
--- a/UefiMonitorTest/Graphics.c
+++ b/UefiMonitorTest/Graphics.c
@@ -359,6 +359,33 @@ DrawRectWithBorder (
}
VOID
+DrawRoundedRect (
+ IN GRAPHICS_CONTEXT *Graphics,
+ IN UINTN X0,
+ IN UINTN Y0,
+ IN UINTN X1,
+ IN UINTN Y1,
+ IN UINTN CornerRadius,
+ IN CONST GRAPHICS_PIXEL_COLOR *Color
+ )
+{
+ UINT8 Index;
+
+ DrawCircle (Graphics, X0 + CornerRadius, Y0 + CornerRadius, CornerRadius, Color);
+ DrawCircle (Graphics, X1 - CornerRadius, Y0 + CornerRadius, CornerRadius, Color);
+ DrawCircle (Graphics, X0 + CornerRadius, Y1 - CornerRadius, CornerRadius, Color);
+ DrawCircle (Graphics, X1 - CornerRadius, Y1 - CornerRadius, CornerRadius, Color);
+
+ for (Index = 0; Index < CornerRadius; Index++) {
+ DrawLine (Graphics, X0 + CornerRadius, Y0 + Index , X1 - 1 - CornerRadius, Y0 + Index, Color);
+ DrawLine (Graphics, X0 + Index , Y0 + CornerRadius, X0 + Index , Y1 - 1 - CornerRadius, Color);
+ DrawLine (Graphics, X1 - 1 - Index , Y0 + CornerRadius, X1 - 1 - Index , Y1 - 1 - CornerRadius, Color);
+ DrawLine (Graphics, X0 + CornerRadius, Y1 - 1 - Index , X1 - 1 - CornerRadius, Y1 - 1 - Index, Color);
+ }
+ PutRect (Graphics, X0 + CornerRadius, Y0 + CornerRadius, X1 - CornerRadius, Y1 - CornerRadius, Color);
+}
+
+VOID
DrawCircle (
IN GRAPHICS_CONTEXT *Graphics,
IN UINTN X0,
diff --git a/UefiMonitorTest/Graphics.h b/UefiMonitorTest/Graphics.h
index 6396098..9e50cc4 100644
--- a/UefiMonitorTest/Graphics.h
+++ b/UefiMonitorTest/Graphics.h
@@ -150,6 +150,17 @@ DrawRectWithBorder (
);
VOID
+DrawRoundedRect (
+ IN GRAPHICS_CONTEXT *Graphics,
+ IN UINTN X0,
+ IN UINTN Y0,
+ IN UINTN X1,
+ IN UINTN Y1,
+ IN UINTN CornerRadius,
+ IN CONST GRAPHICS_PIXEL_COLOR *Color
+ );
+
+VOID
DrawCircle (
IN GRAPHICS_CONTEXT *Graphics,
IN UINTN X0,