One of my goals for V4 is that we develop a boargame standard in which to represent game components and game state, as well as to provide a way of associating images with those game components. I’d like to kick this off by considering what the requirements are for defining images.
As I realize it might not be clear what I mean by “defining images”, let me give an example. In V3, single images are associated with piece faces and boards. The images which are displayed by VASSAL are the entire contents of image files which are inside modules. For us, one image file produces one image within the program. ZunTzu does this differently—its design supposes that an image file may contain many subimages that will be cut out and used as piece faces. With ZT, one image file can produce many images within the program. Our buildFile is where the definition of what image files coresspond to what in-program images happens; ZT has a similar thing inside its modules.
What an image definition does is name a region of an image contained within an image file, in order that this subimage may be referred to elsewhere. (We need some synax for talking about this; I’m going to use XML for now. I don’t mean to indicate by this whether we will or will not use XML.)
In the most basic form, where an entire image file is intended to produce one image, we might have this:
The src attribute indicates the name of the file, while the id attribute uniquely identifies the image contained therein. (The idea here is that we can then refer to the image by its id elsewhere,
rather than repeating the details of the image’s source.) I believe a unique id and a source are sufficient to capture how V3 defines images.
One can imagine wanting to define arbitrary rectangular cutouts of a larger image, say, an image containing multiple piece faces. To do that, we must specify the parent image and the coordinates of the rectangle to cut out:
This would give id 43 to the rectangle (10,10)-(60,60) in image 42. (Would w and h be preferable to x1 and y1?)
Furthermore, one can imaging wanting to define a whole grid of subimages in one shot—this is essentially what one side of a countersheet is:
Then, one might refer to such images by their grid coordinates, something like “44.0.0” for the subimage in the first row and first colum of grid 44.
Does this make sense?
Are there any other ways of defining images which would be useful but can’t be done using the concepts above? or that can’t be done succinctly?