Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UINT8 roundedCorner[10][10] =
- {
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0xC0, 0xFF},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0x00, 0x00, 0x00, 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0x00, 0x00, 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0x00, 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0x00, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0x40, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- { 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
- };
- Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
- RETURN_ON_ERROR(Status);
- img=CreateImage(w,h,TRUE);
- pixData=img->PixelData;
- for(iy=0;iy<h;iy++)
- {
- for(ix=0;ix<w;ix++)
- {
- *(pixData+ix+(iy*w))=*((UINT32*)backGround);
- }
- }
- // round edges
- if(w>10 && h>10)
- {
- DEBUG((EFI_D_ERROR,"rounding..."));
- for( iy=0; iy<10; iy++)
- {
- for( ix=0; ix<10; ix++)
- {
- UINT8 alpha=roundedCorner[iy][ix]?((roundedCorner[iy][ix] * backGround->Reserved) / 255):0;
- // skip if the pixel should be visible
- if(roundedCorner[iy][ix] == 0xFF)
- continue;
- // Upper left corner
- ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+ix+(iy*w))))->Reserved = alpha;
- // upper right corner
- ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+(w-ix)+(iy*w))))->Reserved=alpha;
- // lower left corner
- ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+ix+((h-iy)*w))))->Reserved=alpha;
- // lower right corner
- ((EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)((pixData+(w-ix)+((h-iy)*w))))->Reserved=alpha;
- }
- }
- DEBUG((EFI_D_ERROR,"rounding done."));
- }
- if(GraphicsOutput!=NULL)
- {
- Status = GraphicsOutput->Blt (GraphicsOutput,img->PixelData,EfiBltBufferToVideo,0,0,(UINTN) xpos,(UINTN) ypos,w,h,0);
- }
Add Comment
Please, Sign In to add comment