]> git.draconx.ca Git - rrace.git/blobdiff - src/ewmhicon.h
Separate EWMH colour conversion from icon generation.
[rrace.git] / src / ewmhicon.h
index 1f83853ba4e63761f854abf607b42a59478fb309..e12c14ef9eb41459cdb5157c2e4d60989b5eb21d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * _NET_WM_ICON helpers for slide puzzle game
- * Copyright © 2022 Nick Bowler
+ * Copyright © 2023 Nick Bowler
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -39,13 +39,23 @@ typedef struct {
  */
 #define EWMH_ICON_NELEM (2+16*16 + 2+24*24 + 2+32*32 + 2+48*48)
 
+/*
+ * For each of the n elements of the array pointed to by map, set the
+ * 'pixel' member according to its separated red/green/blue components,
+ * with an alpha value of 255 (opaque).
+ *
+ * The resulting colourmap is suitable for use with ewmh_icon_generate.
+ */
+void ewmh_icon_prepare_cmap(XColor *map, unsigned n);
+
 /*
  * Generate EWMH icon data based on a sequence of tile colours.  Internally,
  * this calls icon_tile16 and friends to draw each of the icon patterns.
  *
  * The sequence specifies the colour of all 9 icon tiles, beginning from the
  * top left in row-major order.  Each value specifies three offsets into
- * the provided colour map, encoded in the same manner as icon_tile16 et al.
+ * the provided colour map, using the 'pixel' members directly as 32-bit
+ * ARGB colour values.
  *
  * Returns a newly-allocated buffer which is suitable for use directly with
  * XChangeProperty, and should be freed by the caller.