1 /*****************************************************************************/
5 /* Bitmap definition for the sp65 sprite and bitmap utility */
9 /* (C) 2012, Ullrich von Bassewitz */
10 /* Roemerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
50 /*****************************************************************************/
52 /*****************************************************************************/
56 /* Safety limit for the size of the bitmap in pixels */
57 #define BM_MAX_SIZE 4194304UL
60 typedef enum BitmapType BitmapType;
69 /* Bitmap structure */
70 typedef struct Bitmap Bitmap;
73 /* Type of the bitmap */
76 /* Name of the bitmap. This is used for error messages and should be
77 * something that allows the user to identify which bitmap the message
78 * refers to. For bitmaps loaded from a file, using the file name is
83 /* Pointer to some format specific data. May be used by the frontend.
84 * The data is free'd as a block when calling FreeBitmap.
88 /* Size of the bitmap */
92 /* Palette for monochrome and indexed bitmap types, otherwise NULL */
95 /* Pixel data, dynamically allocated */
101 /*****************************************************************************/
103 /*****************************************************************************/
107 Bitmap* NewBitmap (unsigned Width, unsigned Height);
108 /* Create a new bitmap. The type is set to unknown and the palette to NULL */
110 void FreeBitmap (Bitmap* B);
111 /* Free a dynamically allocated bitmap */
113 int ValidBitmapSize (unsigned Width, unsigned Height);
114 /* Return true if this is a valid size for a bitmap */
116 Color GetPixelColor (const Bitmap* B, unsigned X, unsigned Y);
117 /* Get the color for a given pixel. For indexed bitmaps, the palette entry
121 Pixel GetPixel (const Bitmap* B, unsigned X, unsigned Y);
122 /* Return a pixel from the bitmap. The returned value may either be a color
123 * or a palette index, depending on the type of the bitmap.
128 /* End of bitmap.h */