15 #include <Protocol/GraphicsOutput.h> 20 #define COLOR EFI_GRAPHICS_OUTPUT_BLT_PIXEL 21 #define SPRITE EFI_GRAPHICS_OUTPUT_BLT_PIXEL * 22 #define GFX_BUFFER EFI_GRAPHICS_OUTPUT_BLT_PIXEL * 25 extern EFI_GRAPHICS_OUTPUT_PROTOCOL *graphics_protocol; 32 #define ARG_MODE graphics_argument_list[0].value.uint64 33 #define ARG_VSYNC graphics_argument_list[1].value.uint64 34 #define ARG_FPS graphics_argument_list[2].value.uint64 35 #define ARG_DISPLAY graphics_argument_list[3].value.uint64 36 extern cmdline_argument_t graphics_argument_list[]; 52 EFI_STATUS
draw_filled_rect(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN x, UINTN y, UINTN width, UINTN height,
COLOR *color);
55 EFI_STATUS
query_current_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **info);
74 EFI_GRAPHICS_OUTPUT_BLT_PIXEL data[];
UINTN graphics_fs_height
screen height, in pixels
Definition: graphics.c:26
COLOR interpolate_2px(COLOR *colors, float ratio)
Performs linear interpolation of a pixel value between 2 pixels.
Definition: graphics.c:359
EFI_STATUS query_current_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **info)
Fetches information about the current graphics mode.
Definition: graphics.c:659
void rotate_image(SPRITE original, SPRITE rotated, INTN radius, float theta)
Rotates an image by an arbitrary angle.
Definition: graphics.c:376
void print_graphics_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
Prints the list of available graphics modes.
Definition: graphics.c:562
EFI_STATUS graphics_fs_blt(GFX_BUFFER buffer)
Outputs a full-screen graphics buffer to the graphics display.
Definition: graphics.c:952
void draw_text(SPRITE buffer, UINTN buffer_width, glyph_list_t *glyphs, UINT32 x, UINT32 y, COLOR color, CHAR16 *text)
Draws text to a sprite or output buffer.
Definition: graphics.c:804
EFI_STATUS init_graphics()
Initializes the graphics output.
Definition: graphics.c:963
UINTN graphics_fs_pixel_count
number of pixels in output buffer
Definition: graphics.c:29
UINT32 width
the image's width, in pixels
Definition: graphics.h:72
BOOLEAN limit_framerate(UINT64 *previous, UINT64 minimum_frame_ticks)
Limits graphics animation framerates.
Definition: graphics.c:904
#define GFX_BUFFER
shortcut macro: indicates pixel data is intended to be used as a screen buffer
Definition: graphics.h:22
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * graphics_info
UEFI's graphics info.
Definition: graphics.c:24
void free_image(image_t *image)
Frees an image resource.
Definition: graphics.c:513
data type for list of glyphs, size is dynamic
Definition: graphics.h:115
image_t * load_netpbm_file(CHAR16 *filename)
Reads a netpbm file, determines the image format by the file's extension.
Definition: graphics.c:481
UINT32 memory_pages
the number of allocated memory pages
Definition: graphics.h:117
glyph_list_t * load_font()
Parses the font file.
Definition: graphics.c:739
image_t * load_pbm_file(CHAR16 *filename)
Reads a netpbm PBM (black/white bitmap) file.
Definition: graphics.c:470
void free_glyphs(glyph_list_t *glyphs)
Frees a previously allocated list of glyphs.
Definition: graphics.c:850
EFI_GRAPHICS_OUTPUT_PROTOCOL * get_graphics_protocol()
Fetches the UEFI graphics output protocol handle.
Definition: graphics.c:607
void free_graphics_fs_buffer(void *addr)
Frees a full-screen graphics buffer.
Definition: graphics.c:940
cmdline_argument_group_t graphics_arguments
group for graphics-related arguments
Definition: graphics.c:90
UINTN memory_pages
the number of memory pages allocated
Definition: graphics.h:71
Data structure for file contents.
Definition: files.h:22
image_t * load_ppm_file(CHAR16 *filename)
Reads a netpbm PPM (color) file.
Definition: graphics.c:448
image_t * parse_pgm_image_data(file_contents_t *contents)
Parses a PGM (grayscale) image.
Definition: graphics.c:280
UINT32 height
the image's height, in pixels
Definition: graphics.h:73
void draw_glyph(SPRITE start, UINTN buffer_width, glyph_t *glyph, COLOR color)
Draws a single glyph to a sprite or output buffer.
Definition: graphics.c:774
CHAR16 chr
the character the glyph is for
Definition: graphics.h:110
void wait_vsync()
Waits for the graphics card's vertical synchronisation event.
Definition: graphics.c:866
data type for image data, size is dynamic
Definition: graphics.h:69
glyph_list_t * parse_glyphs(image_t *image, CHAR16 *text)
Parses a font sprite sheet.
Definition: graphics.c:699
image_t * load_pgm_file(CHAR16 *filename)
Reads a netpbm PGM (grayscale) file.
Definition: graphics.c:459
image_t * create_image(INTN width, INTN height)
Allocates and initializes an image.
Definition: graphics.c:184
#define COLOR
shortcut macro: indicates pixel data is intended to be used as paint color
Definition: graphics.h:20
EFI_STATUS set_graphics_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, int mode)
Sets the graphics mode.
Definition: graphics.c:640
void load_image_assets(UINTN count, image_asset_t *assets)
Loads a list of image assets.
Definition: graphics.c:530
Logging facility, supports verbosity levels.
UINT16 glyph_count
the number of glyphs in this list
Definition: graphics.h:118
GFX_BUFFER create_graphics_fs_buffer()
Creates a full-screen graphics buffer.
Definition: graphics.c:926
UINTN graphics_fs_pages
number of pages for output buffer
Definition: graphics.c:28
void set_graphics_cos_func(trig_func *f)
Sets the cos() function pointer to use in graphics operations.
Definition: graphics.c:50
EFI_STATUS draw_filled_rect(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN x, UINTN y, UINTN width, UINTN height, COLOR *color)
Draws an unbuffered rectangle to the screen.
Definition: graphics.c:594
image_t ** image
the asset's content
Definition: graphics.h:80
void free_image_assets(UINTN count, image_asset_t *assets)
Frees a list of image assets.
Definition: graphics.c:544
UINTN graphics_fs_width
screen width, in pixels
Definition: graphics.c:25
COLOR interpolate_4px(COLOR *corners, UINTN row_width, float x, float y)
Performs bilinear interpolation of a pixel value within a square of 4 surrounding pixels...
Definition: graphics.c:326
GFX_BUFFER graphics_fs_buffer
full-screen output buffer
Definition: graphics.c:27
void set_graphics_sin_func(trig_func *f)
Sets the sin() function pointer to use in graphics operations.
Definition: graphics.c:40
model for group of command line arguments
Definition: cmdline.h:50
Command line parameter parser.
void shutdown_graphics()
Shuts down the graphics features.
Definition: graphics.c:1002
double trig_func(double)
data type for trigonometry function pointers
Definition: graphics.h:59
#define SPRITE
shortcut macro: indicates pixel data is intended to be as a drawable image
Definition: graphics.h:21
data type for individual 8x15 font glyphs
Definition: graphics.h:108
image_t * parse_pbm_image_data(file_contents_t *contents)
Parses a PBM (black/white bitmap) image.
Definition: graphics.c:291
data type for image assets
Definition: graphics.h:78
CHAR16 * filename
the asset's filename
Definition: graphics.h:81
image_t * parse_ppm_image_data(file_contents_t *contents)
Parses a PPM (color) image.
Definition: graphics.c:269