+// Display a message in the center of the screen, surrounded by a box of the
+// specified color. For the moment, uses graphics calls only. (It still works
+// in text mode on GOP/UEFI systems, but not on UGA/EFI 1.x systems.)
+VOID egDisplayMessage(IN CHAR16 *Text, EG_PIXEL *BGColor) {
+ UINTN BoxWidth, BoxHeight;
+ EG_IMAGE *Box;
+
+ if ((Text != NULL) && (BGColor != NULL)) {
+ egMeasureText(Text, &BoxWidth, &BoxHeight);
+ BoxWidth += 14;
+ BoxHeight *= 2;
+ if (BoxWidth > egScreenWidth)
+ BoxWidth = egScreenWidth;
+ Box = egCreateFilledImage(BoxWidth, BoxHeight, FALSE, BGColor);
+ egRenderText(Text, Box, 7, BoxHeight / 4, (BGColor->r + BGColor->g + BGColor->b) / 3);
+ egDrawImage(Box, (egScreenWidth - BoxWidth) / 2, (egScreenHeight - BoxHeight) / 2);
+ } // if non-NULL inputs
+} // VOID egDisplayMessage()
+
+// Copy the current contents of the display into an EG_IMAGE....
+// Returns pointer if successful, NULL if not.
+EG_IMAGE * egCopyScreen(VOID) {
+ EG_IMAGE *Image = NULL;
+
+ if (!egHasGraphics)
+ return NULL;
+
+ // allocate a buffer for the whole screen
+ Image = egCreateImage(egScreenWidth, egScreenHeight, FALSE);
+ if (Image == NULL) {
+ return NULL;
+ }
+
+ // get full screen image
+ if (GraphicsOutput != NULL) {
+ refit_call10_wrapper(GraphicsOutput->Blt, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData,
+ EfiBltVideoToBltBuffer, 0, 0, 0, 0, Image->Width, Image->Height, 0);
+ } else if (UgaDraw != NULL) {
+ refit_call10_wrapper(UgaDraw->Blt, UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaVideoToBltBuffer,
+ 0, 0, 0, 0, Image->Width, Image->Height, 0);
+ }
+ return Image;
+} // EG_IMAGE * egCopyScreen()
+