]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/msw/dibutils.h
corrected a bug in dc which resetted the port , exchanged the wxchoice implementation
[wxWidgets.git] / include / wx / msw / dibutils.h
index b43d4fab2f19748ae867075544b2dc6443f35866..bb9845f2c601f9d1a86f80fd29830b4a5da6eb2f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Microsoft, Julian Smart
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Microsoft, Julian Smart
-// Licence:    wxWindows license
+// Licence:    wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 /***************************************************************************
 /////////////////////////////////////////////////////////////////////////////
 
 /***************************************************************************
@@ -40,83 +40,84 @@ typedef     HANDLE             HDIB;
    External function declarations
  **************************************************************************/
 
    External function declarations
  **************************************************************************/
 
-void        ClearSystemPalette(void);
-PDIB        DibOpenFile(LPSTR szFile);  
-int                    DibWriteFile(LPSTR szFile, LPBITMAPINFOHEADER lpbi);
-BOOL        DibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage);
-PDIB        DibCreate(int bits, int dx, int dy);
-BOOL        DibMapToPalette(PDIB pdib, HPALETTE hpal);
-HPALETTE MakePalette(const BITMAPINFO FAR* Info, UINT flags);
+void        wxClearSystemPalette(void);
+PDIB        wxDibOpenFile(LPTSTR szFile);  
+int                    wxDibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi);
+BOOL        wxDibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage);
+PDIB        wxDibCreate(int bits, int dx, int dy);
+BOOL        wxDibMapToPalette(PDIB pdib, HPALETTE hpal);
+HPALETTE wxMakePalette(const BITMAPINFO FAR* Info, UINT flags);
 
 /****************************************************************************
    Internal function declarations
  ***************************************************************************/
 
 
 /****************************************************************************
    Internal function declarations
  ***************************************************************************/
 
-PDIB        DibReadBitmapInfo(HFILE fh);
+PDIB        wxDibReadBitmapInfo(HFILE fh);
 
 /****************************************************************************
    DIB macros.
  ***************************************************************************/
 
 #ifdef  WIN32
 
 /****************************************************************************
    DIB macros.
  ***************************************************************************/
 
 #ifdef  WIN32
-        #define HandleFromDib(lpbi) GlobalHandle(lpbi)
+        #define wxHandleFromDib(lpbi) GlobalHandle(lpbi)
 #else
 #else
-    #define HandleFromDib(lpbi) (HANDLE)GlobalHandle(SELECTOROF(lpbi))
+    #define wxHandleFromDib(lpbi) (HANDLE)GlobalHandle(SELECTOROF(lpbi))
 #endif
 
 #endif
 
-#define DibFromHandle(h)        (PDIB)GlobalLock(h)
+#define wxDibFromHandle(h)        (PDIB)GlobalLock(h)
 
 
-#define DibFree(pdib)           GlobalFreePtr(pdib)
+#define wxDibFree(pdib)           GlobalFreePtr(pdib)
 
 
-#define WIDTHBYTES(i)           ((unsigned)((i+31)&(~31))/8)  /* ULONG aligned ! */
+#define wxWIDTHBYTES(i)           ((unsigned)((i+31)&(~31))/8)  /* ULONG aligned ! */
 
 
-#define DibWidth(lpbi)          (UINT)(((LPBITMAPINFOHEADER)(lpbi))->biWidth)
-#define DibHeight(lpbi)         (UINT)(((LPBITMAPINFOHEADER)(lpbi))->biHeight)
-#define DibBitCount(lpbi)       (UINT)(((LPBITMAPINFOHEADER)(lpbi))->biBitCount)
-#define DibCompression(lpbi)    (DWORD)(((LPBITMAPINFOHEADER)(lpbi))->biCompression)
+#define wxDibWidth(lpbi)          (UINT)(((LPBITMAPINFOHEADER)(lpbi))->biWidth)
+#define wxDibHeight(lpbi)         (UINT)(((LPBITMAPINFOHEADER)(lpbi))->biHeight)
+#define wxDibBitCount(lpbi)       (UINT)(((LPBITMAPINFOHEADER)(lpbi))->biBitCount)
+#define wxDibCompression(lpbi)    (DWORD)(((LPBITMAPINFOHEADER)(lpbi))->biCompression)
 
 
-#define DibWidthBytesN(lpbi, n) (UINT)WIDTHBYTES((UINT)(lpbi)->biWidth * (UINT)(n))
-#define DibWidthBytes(lpbi)     DibWidthBytesN(lpbi, (lpbi)->biBitCount)
+#define wxDibWidthBytesN(lpbi, n) (UINT)wxWIDTHBYTES((UINT)(lpbi)->biWidth * (UINT)(n))
+#define wxDibWidthBytes(lpbi)     wxDibWidthBytesN(lpbi, (lpbi)->biBitCount)
 
 
-#define DibSizeImage(lpbi)      ((lpbi)->biSizeImage == 0 \
-                                    ? ((DWORD)(UINT)DibWidthBytes(lpbi) * (DWORD)(UINT)(lpbi)->biHeight) \
+#define wxDibSizeImage(lpbi)      ((lpbi)->biSizeImage == 0 \
+                                    ? ((DWORD)(UINT)wxDibWidthBytes(lpbi) * (DWORD)(UINT)(lpbi)->biHeight) \
                                     : (lpbi)->biSizeImage)
 
                                     : (lpbi)->biSizeImage)
 
-#define DibSize(lpbi)           ((lpbi)->biSize + (lpbi)->biSizeImage + (int)(lpbi)->biClrUsed * sizeof(RGBQUAD))
-#define DibPaletteSize(lpbi)    (DibNumColors(lpbi) * sizeof(RGBQUAD))
+#define wxDibSize(lpbi)           ((lpbi)->biSize + (lpbi)->biSizeImage + (int)(lpbi)->biClrUsed * sizeof(RGBQUAD))
+#define wxDibPaletteSize(lpbi)    (wxDibNumColors(lpbi) * sizeof(RGBQUAD))
 
 
-#define DibFlipY(lpbi, y)       ((int)(lpbi)->biHeight-1-(y))
+#define wxDibFlipY(lpbi, y)       ((int)(lpbi)->biHeight-1-(y))
 
 //HACK for NT BI_BITFIELDS DIBs
 #ifdef WIN32
 
 //HACK for NT BI_BITFIELDS DIBs
 #ifdef WIN32
-    #define DibPtr(lpbi)            ((lpbi)->biCompression == BI_BITFIELDS \
-                                       ? (LPVOID)(DibColors(lpbi) + 3) \
-                                       : (LPVOID)(DibColors(lpbi) + (UINT)(lpbi)->biClrUsed))
+    #define wxDibPtr(lpbi)            ((lpbi)->biCompression == BI_BITFIELDS \
+                                       ? (LPVOID)(wxDibColors(lpbi) + 3) \
+                                       : (LPVOID)(wxDibColors(lpbi) + (UINT)(lpbi)->biClrUsed))
 #else
 #else
-        #define DibPtr(lpbi)            (LPVOID)(DibColors(lpbi) + (UINT)(lpbi)->biClrUsed)
+        #define wxDibPtr(lpbi)            (LPVOID)(wxDibColors(lpbi) + (UINT)(lpbi)->biClrUsed)
 #endif
 
 #endif
 
-#define DibColors(lpbi)         ((RGBQUAD FAR *)((LPBYTE)(lpbi) + (int)(lpbi)->biSize))
+#define wxDibColors(lpbi)         ((RGBQUAD FAR *)((LPBYTE)(lpbi) + (int)(lpbi)->biSize))
 
 
-#define DibNumColors(lpbi)      ((lpbi)->biClrUsed == 0 && (lpbi)->biBitCount <= 8 \
+#define wxDibNumColors(lpbi)      ((lpbi)->biClrUsed == 0 && (lpbi)->biBitCount <= 8 \
                                     ? (int)(1 << (int)(lpbi)->biBitCount)          \
                                     : (int)(lpbi)->biClrUsed)
 
                                     ? (int)(1 << (int)(lpbi)->biBitCount)          \
                                     : (int)(lpbi)->biClrUsed)
 
-#define DibXYN(lpbi,pb,x,y,n)   (LPVOID)(                                     \
+#define wxDibXYN(lpbi,pb,x,y,n)   (LPVOID)(                                     \
                                 (BYTE _huge *)(pb) +                          \
                                 (UINT)((UINT)(x) * (UINT)(n) / 8u) +          \
                                 (BYTE _huge *)(pb) +                          \
                                 (UINT)((UINT)(x) * (UINT)(n) / 8u) +          \
-                                ((DWORD)DibWidthBytesN(lpbi,n) * (DWORD)(UINT)(y)))
+                                ((DWORD)wxDibWidthBytesN(lpbi,n) * (DWORD)(UINT)(y)))
 
 
-#define DibXY(lpbi,x,y)         DibXYN(lpbi,DibPtr(lpbi),x,y,(lpbi)->biBitCount)
+#define wxDibXY(lpbi,x,y)         wxDibXYN(lpbi,wxDibPtr(lpbi),x,y,(lpbi)->biBitCount)
 
 
-#define FixBitmapInfo(lpbi)     if ((lpbi)->biSizeImage == 0)                 \
-                                                                                               (lpbi)->biSizeImage = DibSizeImage(lpbi); \
+#define wxFixBitmapInfo(lpbi)     if ((lpbi)->biSizeImage == 0)                 \
+                                                                                               (lpbi)->biSizeImage = wxDibSizeImage(lpbi); \
                                 if ((lpbi)->biClrUsed == 0)                   \
                                 if ((lpbi)->biClrUsed == 0)                   \
-                                    (lpbi)->biClrUsed = DibNumColors(lpbi);   \
-                                if ((lpbi)->biCompression == BI_BITFIELDS && (lpbi)->biClrUsed == 0) \
-                                    ; // (lpbi)->biClrUsed = 3;                    
+                                    (lpbi)->biClrUsed = wxDibNumColors(lpbi);
 
 
-#define DibInfo(pDIB)     ((BITMAPINFO FAR *)(pDIB))
+//                                if ((lpbi)->biCompression == BI_BITFIELDS && (lpbi)->biClrUsed == 0)
+//                                    ; // (lpbi)->biClrUsed = 3;                    
+
+#define wxDibInfo(pDIB)     ((BITMAPINFO FAR *)(pDIB))
 
 /***************************************************************************/
 
 
 /***************************************************************************/