summaryrefslogtreecommitdiff
path: root/include/video_console.h
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-07-14 13:26:42 -0400
committerTom Rini <trini@konsulko.com>2023-07-14 13:26:42 -0400
commitb3bbad816e97538c8c3b8acad7c7e134261cf3a3 (patch)
tree0cfdcc657a9e0b3a5cf91e5fbb3ef2415aa2b12f /include/video_console.h
parentcef36755094f0c5463ff34ac89de8d88ef68982b (diff)
parent04f3dcd503a537fab50329686874559dae8a1a22 (diff)
Merge branch '2023-07-14-expo-initial-config-editor'
To quote the author: This series provides a means to edit board configuration in U-Boot in a graphical manner. It supports multiple menu items and allows moving between them and selecting items. The configuration is defined in a data format so that code is not needed in most cases. This allows the board configuration to be provided in the devicetree. This is still at an early stage, since it only supports menus. Numeric values are not supported. Most importantly it does not yet support loading or saving the configuration selected by the user. To try it out you can use something like: ./tools/expo.py -e test/boot/files/expo_layout.dts \ -l test/boot/files/expo_layout.dts -o cedit.dtb ./u-boot -Tl -c "cedit load hostfs - cedit.dtb; cedit run" Use the arrow keys to move between menus, enter to open a menu, escape to exit. Various minor fixes and improvements are provided in this series: - Update STB TrueType library to latest - Support clearing part of the video display - Support multiple livetrees loaded at runtime - Support loading and allocating a file - Support proper measuring of text in expo - Support simple themes for expo
Diffstat (limited to 'include/video_console.h')
-rw-r--r--include/video_console.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/include/video_console.h b/include/video_console.h
index 3db9a7e1fb9..2694e44f6ec 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -72,6 +72,38 @@ struct vidfont_info {
};
/**
+ * struct vidconsole_colour - Holds colour information
+ *
+ * @colour_fg: Foreground colour (pixel value)
+ * @colour_bg: Background colour (pixel value)
+ */
+struct vidconsole_colour {
+ u32 colour_fg;
+ u32 colour_bg;
+};
+
+/**
+ * struct vidconsole_bbox - Bounding box of text
+ *
+ * This describes the bounding box of something, measured in pixels. The x0/y0
+ * pair is inclusive; the x1/y2 pair is exclusive, meaning that it is one pixel
+ * beyond the extent of the object
+ *
+ * @valid: Values are valid (bounding box is known)
+ * @x0: left x position, in pixels from left side
+ * @y0: top y position, in pixels from top
+ * @x1: right x position + 1
+ * @y1: botton y position + 1
+ */
+struct vidconsole_bbox {
+ bool valid;
+ int x0;
+ int y0;
+ int x1;
+ int y1;
+};
+
+/**
* struct vidconsole_ops - Video console operations
*
* These operations work on either an absolute console position (measured
@@ -178,6 +210,20 @@ struct vidconsole_ops {
* Returns: 0 on success, -ENOENT if no such font
*/
int (*select_font)(struct udevice *dev, const char *name, uint size);
+
+ /**
+ * measure() - Measure the bounds of some text
+ *
+ * @dev: Device to adjust
+ * @name: Font name to use (NULL to use default)
+ * @size: Font size to use (0 to use default)
+ * @text: Text to measure
+ * @bbox: Returns bounding box of text, assuming it is positioned
+ * at 0,0
+ * Returns: 0 on success, -ENOENT if no such font
+ */
+ int (*measure)(struct udevice *dev, const char *name, uint size,
+ const char *text, struct vidconsole_bbox *bbox);
};
/* Get a pointer to the driver operations for a video console device */
@@ -204,6 +250,38 @@ int vidconsole_get_font(struct udevice *dev, int seq,
*/
int vidconsole_select_font(struct udevice *dev, const char *name, uint size);
+/*
+ * vidconsole_measure() - Measuring the bounding box of some text
+ *
+ * @dev: Console device to use
+ * @name: Font name, NULL for default
+ * @size: Font size, ignored if @name is NULL
+ * @text: Text to measure
+ * @bbox: Returns nounding box of text
+ * Returns: 0 if OK, -ve on error
+ */
+int vidconsole_measure(struct udevice *dev, const char *name, uint size,
+ const char *text, struct vidconsole_bbox *bbox);
+
+/**
+ * vidconsole_push_colour() - Temporarily change the font colour
+ *
+ * @dev: Device to adjust
+ * @fg: Foreground colour to select
+ * @bg: Background colour to select
+ * @old: Place to store the current colour, so it can be restored
+ */
+void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg,
+ enum colour_idx bg, struct vidconsole_colour *old);
+
+/**
+ * vidconsole_pop_colour() - Restore the original colour
+ *
+ * @dev: Device to adjust
+ * @old: Old colour to be restored
+ */
+void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old);
+
/**
* vidconsole_putc_xy() - write a single character to a position
*