aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx/gfx_resource.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gfx/gfx_resource.h')
-rw-r--r--engines/sci/gfx/gfx_resource.h359
1 files changed, 194 insertions, 165 deletions
diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h
index 8ce4a8ea83..780060bc4f 100644
--- a/engines/sci/gfx/gfx_resource.h
+++ b/engines/sci/gfx/gfx_resource.h
@@ -23,7 +23,9 @@
*
*/
-/* SCI Resource library */
+/** @file gfx_resource.h
+ * SCI Resource library.
+ */
#ifndef SCI_GFX_GFX_RESOURCE_H
#define SCI_GFX_GFX_RESOURCE_H
@@ -44,6 +46,7 @@ namespace Sci {
#define GFXR_DITHER_MODE_D16 0 /* Sierra SCI style */
#define GFXR_DITHER_MODE_F256 1 /* Flat color interpolation */
#define GFXR_DITHER_MODE_D256 2 /* 256 color dithering */
+
/* Dithering patterns */
#define GFXR_DITHER_PATTERN_SCALED 0 /* Dither per pixel on the 320x200 grid */
#define GFXR_DITHER_PATTERN_1 1 /* Dither per pixel on the target */
@@ -64,52 +67,53 @@ namespace Sci {
extern int sci0_palette;
-/* (gfx_pic_0.c) The 16 EGA base colors */
+/** The 16 EGA base colors */
extern Palette* gfx_sci0_image_pal[];
extern gfx_pixmap_color_t gfx_sci0_image_colors[][16];
-/* (gfx_pic_0.c) The 256 interpolated colors (initialized when
-** gfxr_init_pic() is called for the first time, or when gfxr_init_static_palette() is called)
-*/
+/**
+ * The 256 interpolated colors (initialized when gfxr_init_pic() is called
+ * for the first time, or when gfxr_init_static_palette() is called)
+ */
extern Palette* gfx_sci0_pic_colors;
-
struct gfxr_pic0_params_t {
gfx_line_mode_t line_mode; /* one of GFX_LINE_MODE_* */
gfx_brush_mode_t brush_mode;
};
+/** A SCI resource pic */
struct gfxr_pic_t {
- int ID; /* pic number (NOT resource ID, just number) */
+ int ID; /**< pic number (NOT resource ID, just number) */
gfx_mode_t *mode;
- gfx_pixmap_t *visual_map;
- gfx_pixmap_t *priority_map;
- gfx_pixmap_t *control_map;
-
+ gfx_pixmap_t *visual_map; /**< Visual part of pic */
+ gfx_pixmap_t *priority_map; /**< Priority map for pic */
+ gfx_pixmap_t *control_map; /**< Control map for pic */
+
+ /**
+ * Auxiliary map.
+ * Bit 0: Vis
+ * Bit 1: Pri
+ * Bit 2: Ctrl
+ * Bit 3-5: 'filled' (all three bits are set to 1)
+ */
byte aux_map[GFXR_AUX_MAP_SIZE];
- /* Auxiliary map details:
- ** Bit 0: Vis
- ** Bit 1: Pri
- ** Bit 2: Ctrl
- ** Bit 3-5: 'filled' (all three bits are set to 1)
- */
-
// rect_t bounds; // unused
- void *undithered_buffer; /* copies visual_map->index_data before dithering */
+ void *undithered_buffer; /**< copies visual_map->index_data before dithering */
int undithered_buffer_size;
int *priorityTable;
};
-
+/** A animation loop */
struct gfxr_loop_t {
- int cels_nr;
- gfx_pixmap_t **cels;
+ int cels_nr; /**< Number of 'cels' or frames in the animation */
+ gfx_pixmap_t **cels; /**< Pointer to the pixmaps for the cels */
};
-
+/** A graphics view */
struct gfxr_view_t {
int ID;
@@ -122,172 +126,197 @@ struct gfxr_view_t {
int translation[GFX_SCI0_IMAGE_COLORS_NR];
};
+/**
+ * Initializes the static 256 color palette.
+ */
void gfxr_init_static_palette();
-/* Initializes the static 256 color palette
-** Parameters: (void)
-** Returns : (void)
-*/
-
-gfxr_pic_t *gfxr_init_pic(gfx_mode_t *mode, int ID, int sci1);
-/* Initializes a gfxr_pic_t for a specific mode
-** Parameters: (gfx_mode_t *) mode: The specific graphics mode
-** (int) ID: The ID to assign to the resulting pixmaps
-** Returns : (gfxr_pic_t *) The allocated pic resource, or NULL on error.
-** This function allocates memory for use by resource drawer functions.
-*/
-void gfxr_free_pic(gfxr_pic_t *pic);
-/* Uninitializes a pic resource
-** Parameters: (gfxr_pic_t *) pic: The pic to free
-** Returns : (void)
-*/
-
-void gfxr_free_view(gfxr_view_t *view);
-/* Frees all memory associated with a view
-** Paremeters: (gfxr_view_t *) view: The view to free
-** Returns : (void)
-*/
+/** @name Resource picture management functions */
+/** @{ */
+/**
+ * Initializes a gfxr_pic_t for a specific mode.
+ *
+ * This function allocates memory for use by resource drawer functions.
+ *
+ * @param[in] mode The specific graphics mode
+ * @param[in] ID The ID to assign to the resulting pixmaps
+ * @param[in] sci1 true if a SCI1 pic, false otherwise
+ * @return The allocated pic resource, or NULL on error.
+ */
+gfxr_pic_t *gfxr_init_pic(gfx_mode_t *mode, int ID, bool sci1);
+/**
+ * Uninitializes a pic resource.
+ *
+ * @param[in] pic The pic to free
+ */
+void gfxr_free_pic(gfxr_pic_t *pic);
+/**
+ * Frees all memory associated with a view.
+ *
+ * @param[in] view The view to free
+ */
+void gfxr_free_view(gfxr_view_t *view);
+/** @} */
+/** @name SCI0 resource picture operations */
+/** @{ */
-/*********************/
-/* SCI0 operations */
-/*********************/
+/**
+ * Clears all pic buffers of one pic/
+ *
+ * This function should be called before gfxr_draw_pic0, unless cumulative
+ * drawing is intended
+ *
+ * @param[in] pic The picture to clear
+ * @param[in] titlebar_size How much space to reserve for the title bar
+ */
+void gfxr_clear_pic0(gfxr_pic_t *pic, int titlebar_size);
+/**
+ * Draws a pic resource (all formats prior to SCI1.1).
+ *
+ * The result is stored in gfxr_visual_map, gfxr_priority_map, and
+ * gfxr_control_map. The palette entry of gfxr_visual_map is never used.
+ * Note that the picture will not be drawn dithered; use gfxr_dither_pic0
+ * for that.
+ *
+ * @param[in] pic The pic to draw to
+ * @param[in] fill_normally If 1, the pic is drawn normally; if 0, all
+ * fill operations will fill with black
+ * @param[in] default_palette The default palette to use for drawing
+ * @param[in] size Resource size
+ * @param[in] resource Pointer to the resource data
+ * @param[in] style The drawing style
+ * @param[in] resid The resource ID
+ * @param[in] sci1 true if SCI1, false otherwise
+ * @param[in] static_pal The static palette
+ * @param[in] portBounds The bounds of the port being drawn to
+ */
+void gfxr_draw_pic01(gfxr_pic_t *pic, int fill_normally,
+ int default_palette, int size, byte *resource,
+ gfxr_pic0_params_t *style, int resid, int sci1,
+ Palette *static_pal, Common::Rect portBounds);
-void gfxr_clear_pic0(gfxr_pic_t *pic, int titlebar_size);
-/* Clears all pic buffers of one pic
-** Parameters: (gfxr_pic_t) pic: The picture to clear
-** (int) titlebar_size: How much space to reserve for the title bar
-** Returns : (void)
-** This function should be called before gfxr_draw_pic0, unless cumulative
-** drawing is intended
-*/
-
-
-void gfxr_draw_pic01(gfxr_pic_t *pic, int fill_normally, int default_palette,
- int size, byte *resource, gfxr_pic0_params_t *style, int resid, int sci1,
- Palette *static_pal, Common::Rect portBounds);
-/* Draws a pic resource (all formats prior to SCI1.1)
-** Parameters: (gfxr_pic_t *) pic: The pic to draw to
-** (int) fill_normally: If 1, the pic is drawn normally; if 0, all
-** fill operations will fill with black
-** (int) default_palette: The default palette to use for drawing
-** (int) size: Resource size
-** (byte *) resource: Pointer to the resource data
-** (gfxr_pic0_params_t *) style: The drawing style
-** (int) resid: The resource ID
-** (int) sci1: Nonzero if SCI1
-** (Palette *) static_pal: The static palette
-** (int) static_pal_nr: Number of entries in static palette
-** Returns : (void)
-** The result is stored in gfxr_visual_map, gfxr_priority_map, and gfxr_control_map.
-** The palette entry of gfxr_visual_map is never used.
-** Note that the picture will not be drawn dithered; use gfxr_dither_pic0 for that.
-*/
-
-void gfxr_draw_pic11(gfxr_pic_t *pic, int fill_normally, int default_palette,
- int size, byte *resource, gfxr_pic0_params_t *style, int resid,
- Palette *static_pal, Common::Rect portBounds);
-/* Draws a pic resource (SCI1.1)
-** Parameters: (gfxr_pic_t *) pic: The pic to draw to
-** (int) fill_normally: If 1, the pic is drawn normally; if 0, all
-** fill operations will fill with black
-** (int) default_palette: The default palette to use for drawing
-** (int) size: Resource size
-** (byte *) resource: Pointer to the resource data
-** (gfxr_pic0_params_t *) style: The drawing style
-** (int) resid: The resource ID
-** (Palette *) static_pal: The static palette
-** (int) static_pal_nr: Number of entries in static palette
-** Returns : (void)
-** The result is stored in gfxr_visual_map, gfxr_priority_map, and gfxr_control_map.
-** The palette entry of gfxr_visual_map is never used.
-** Note that the picture will not be drawn dithered; use gfxr_dither_pic0 for that.
-*/
+/**
+ * Draws a pic resource (SCI1.1).
+ *
+ * The result is stored in gfxr_visual_map, gfxr_priority_map, and
+ * gfxr_control_map. The palette entry of gfxr_visual_map is never used.
+ * Note that the picture will not be drawn dithered; use gfxr_dither_pic11
+ * for that.
+ *
+ * @param[in] pic The pic to draw to
+ * @param[in] fill_normally If 1, the pic is drawn normally; if 0, all
+ * fill operations will fill with black
+ * @param[in] default_palette The default palette to use for drawing
+ * @param[in] size Resource size
+ * @param[in] resource Pointer to the resource data
+ * @param[in] style The drawing style
+ * @param[in] resid The resource ID
+ * @param[in] static_pal The static palette
+ * @param[in] portBounds Bounds of the port being drawn to
+ */
+void gfxr_draw_pic11(gfxr_pic_t *pic, int fill_normally,
+ int default_palette, int size, byte *resource,
+ gfxr_pic0_params_t *style, int resid, Palette *static_pal,
+ Common::Rect portBounds);
+/**
+ * Removes artifacts from a scaled pic.
+ *
+ * Using information from the (correctly rendered) src pic, this function
+ * implements some heuristics to remove artifacts from dest. Must be used
+ * before dither_pic0 is called, because it operates on the index buffer.
+ *
+ * @param[in] dest The scaled pic
+ * @param[in] src An unscaled pic
+ */
void gfxr_remove_artifacts_pic0(gfxr_pic_t *dest, gfxr_pic_t *src);
-/* Removes artifacts from a scaled pic
-** Parameters: (gfxr_pic_t *) dest: The scaled pic
-** (gfxr_pic_t *) src: An unscaled pic
-** Returns : (void)
-** Using information from the (correctly rendered) src pic, this function implements
-** some heuristics to remove artifacts from dest. Must be used before dither_pic0 is
-** called, because it operates on the index buffer.
-*/
+/**
+ * Dithers a gfxr_visual_map.
+ *
+ * @param[in] pic The pic to dither
+ * @param[in] mode One of GFXR_DITHER_MODE
+ * @param[in] pattern One of GFXR_DITHER_PATTERN
+ */
void gfxr_dither_pic0(gfxr_pic_t *pic, int mode, int pattern);
-/* Dithers a gfxr_visual_map
-** Parameters: (gfxr_pic_t *) pic: The pic to dither
-** (int) mode: One of GFXR_DITHER_MODE
-** (int) pattern: One of GFXR_DITHER_PATTERN
-** Returns : (void)
-*/
+/**
+ * Calculates a SCI0 view.
+ *
+ * @param[in] id Resource ID of the view
+ * @param[in] resource Pointer to the resource to read
+ * @param[in] size Size of the resource
+ * @param[in] palette The palette to use
+ * @return The resulting view
+ */
gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette);
-/* Calculates an SCI0 view
-** Parameters: (int) id: Resource ID of the view
-** (byte *) resource: Pointer to the resource to read
-** (int) size: Size of the resource
-** (int) palette: The palette to use
-** Returns : (gfxr_view_t *) The resulting view
-*/
-
-gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size, bool isSci01);
-/* Calculates n SCI cursor
-** Parameters: (int) id: The cursor's resource ID
-** (byte *) resource: Pointer to the resource data
-** (int) size: Resource size
-** (bool) isSci01: Set to true to load a SCI1 cursor
-** Returns : (gfx_pixmap_t *) A newly allocated pixmap containing an index
-** color representation of the cursor
-*/
-
-/*********************/
-/* SCI1 operations */
-/*********************/
+/**
+ * Calculates a SCI cursor.
+ *
+ * @param[in] id The cursor's resource ID
+ * @param[in] resource Pointer to the resource data
+ * @param[in] size Resource size
+ * @param[in] isSci01 Set to true to load a SCI1 cursor
+ * @return A newly allocated pixmap containing an index color
+ * representation of the cursor
+ */
+gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size,
+ bool isSci01);
+/** @} */
+
+
+/** @name SCI1/1.1 resource picture operations */
+/** @{ */
+
+/**
+ * Reads an SCI1 palette.
+ *
+ * @param[in] id Resource ID for the palette (or the view it was
+ * found in)
+ * @param[in] resource Source data
+ * @param[in] size Size of the memory block pointed to by resource
+ * @return Palette with the colors
+ */
Palette *gfxr_read_pal1(int id, byte *resource, int size);
-/* Reads an SCI1 palette
-** Parameters: (int) id: Resource ID for the palette (or the view it was found in)
-** (int *) colors_nr: Pointer to the variable the number of colors
-** will be stored in
-** (byte *) resource: Source data
-** (int) size: Size of the memory block pointed to by resource
-** Returns : (Palette *) *colors_nr Palette with the colors
-*/
+/**
+ * Reads an SCI1 palette.
+ *
+ * @param[in] file Palette file
+ * @return Palette with the colors
+ */
Palette *gfxr_read_pal1_amiga(Common::File &file);
-/* Reads an SCI1 palette
-** Parameters: (int *) colors_nr: Pointer to the variable the number of colors
-** will be stored in
-** (FILE *) f: Palette file
-** Returns : (Palette *) Palette with the colors
-*/
+/**
+ * Reads an SCI1.1 palette.
+ *
+ * @param[in] id Resource ID for the palette (or the view it was
+ * found in)
+ * @param[in] resource Source data
+ * @param[in] size Size of the memory block pointed to by resource
+ * @return Palette with the colors
+ */
Palette *gfxr_read_pal11(int id, byte *resource, int size);
-/* Reads an SCI1.1 palette
-** Parameters: (int) id: Resource ID for the palette (or the view it was found in)
-** (int *) colors_nr: Pointer to the variable the number of colors
-** will be stored in
-** (byte *) resource: Source data
-** (int) size: Size of the memory block pointed to by resource
-** Returns : (Palette *) Palette with the colors
-*/
+/**
+ * Calculates an SCI1 view.
+ *
+ * @param[in] id Resource ID of the view
+ * @param[in] resource Pointer to the resource to read
+ * @param[in] size Size of the resource
+ * @param[in] static_pal The static palette
+ * @param[in] isSci11 true if SCI1.1, false otherwise
+ * @return The resulting view
+ */
gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, Palette *static_pal, bool isSci11);
-/* Calculates an SCI1 view
-** Parameters: (int) id: Resource ID of the view
-** (byte *) resource: Pointer to the resource to read
-** (int) size: Size of the resource
-** (Palette *) static_pal: The static palette
-** (int) static_pal_nr: Number of entries in static palette
-** Returns : (gfxr_view_t *) The resulting view
-*/
gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *resource, byte *cel_base, int size, gfxr_view_t *view, bool isAmiga, bool isSci11);
-
+/** @} */
} // End of namespace Sci