Guest User

Untitled

a guest
Jun 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. UINT8 roundedCorner[10][10] =
  2. {
  3. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0xC0, 0xFF},
  4. { 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF},
  5. { 0x00, 0x00, 0x00, 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  6. { 0x00, 0x00, 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  7. { 0x00, 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  8. { 0x00, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  9. { 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  10. { 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  11. { 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  12. { 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
  13. };
  14.  
  15. Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
  16. RETURN_ON_ERROR(Status);
  17.  
  18. img=CreateImage(w,h,TRUE);
  19.  
  20. pixData=img->PixelData;
  21. for(iy=0;iy<h;iy++)
  22. {
  23. for(ix=0;ix<w;ix++)
  24. {
  25.  
  26. *(pixData+ix+(iy*w))=*((UINT32*)backGround);
  27. }
  28. }
  29.  
  30. // round edges
  31. if(w>10 && h>10)
  32. {
  33. DEBUG((EFI_D_ERROR,"rounding..."));
  34. for( iy=0; iy<10; iy++)
  35. {
  36. for( ix=0; ix<10; ix++)
  37. {
  38. UINT8 alpha=roundedCorner[iy][ix]?((roundedCorner[iy][ix] * backGround->Reserved) / 255):0;
  39. // skip if the pixel should be visible
  40. if(roundedCorner[iy][ix] == 0xFF)
  41. continue;
  42.  
  43. // Upper left corner
  44. ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+ix+(iy*w))))->Reserved = alpha;
  45.  
  46. // upper right corner
  47. ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+(w-ix)+(iy*w))))->Reserved=alpha;
  48.  
  49. // lower left corner
  50. ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+ix+((h-iy)*w))))->Reserved=alpha;
  51.  
  52. // lower right corner
  53. ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+(w-ix)+((h-iy)*w))))->Reserved=alpha;
  54. }
  55. }
  56.  
  57. DEBUG((EFI_D_ERROR,"rounding done."));
  58.  
  59. }
  60.  
  61.  
  62. if(GraphicsOutput!=NULL)
  63. {
  64. Status = GraphicsOutput->Blt (GraphicsOutput,img->PixelData,EfiBltBufferToVideo,0,0,(UINTN) xpos,(UINTN) ypos,w,h,0);
  65. }
Add Comment
Please, Sign In to add comment