MMDIB.INT 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Tel.: +0351-8012255 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 20.01.1998 - 18:00:00 $ =}
  24. {========================================================================}
  25. unit MMDIB;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. {$IFDEF WIN32}
  30. Windows,
  31. {$ELSE}
  32. WinProcs,
  33. WinTypes,
  34. {$ENDIF}
  35. MMSystem,
  36. MMUtils;
  37. const
  38. BFT_ICON = $4349; { 'IC' }
  39. BFT_BITMAP = $4d42; { 'BM' }
  40. BFT_CURSOR = $5450; { 'PT' }
  41. BI_BITFIELDS = 3;
  42. HALFTONE = COLORONCOLOR;
  43. { flags for _lseek }
  44. SEEK_CUR = 1;
  45. SEEK_END = 2;
  46. SEEK_SET = 0;
  47. { flags for orientation }
  48. TOPDOWN = -1;
  49. BOTTOMUP = 1;
  50. type
  51. PRGBQUAD = ^TRGBQUAD;
  52. PDIB = PBitmapInfoHeader;
  53. HDIB = THandle;
  54. (************************************************************************)
  55. procedure ClearSystemPalette;
  56. function CreateSystemColorPalette: PLogPalette;
  57. function LoadPalette(FName: string): PLOGPALETTE;
  58. function SavePalette(FName: string; pLogPal: PLOGPALETTE): Boolean;
  59. (************************************************************************)
  60. function DIB_Create(bits, orientation, width, height: integer; AllocBits: Boolean): PDIB;
  61. function DIB_ReadBitmapInfo(fh: THandle): PDIB;
  62. function DIB_OpenFile(szFile: PChar): PDIB;
  63. function DIB_SetUsage(pbi: PDIB; hPal: HPALETTE; wUsage: UINT): Boolean;
  64. procedure DIB_MapToPalette(var pbi: PDIB; hpal: HPALETTE);
  65. procedure DIB_Display(pbi: PDIB; DC: HDC; aRect: TRect);
  66. function DIB_BitmapToDIB(Handle: HBitmap; Palette: HPalette;
  67. Bits, Orientation: integer): PDIB;
  68. procedure DIB_DIBToBitmap(pbi: PDIB; var Bitmap: HBitmap;
  69. var Pal: HPalette);
  70. (************************************************************************)
  71. function IsWinDIB(pbi: PBITMAPINFOHEADER): Boolean;
  72. function HandleFrom_DIB(lpbi: PDIB): THandle;
  73. function DIB_FromHandle(h: THandle): PDIB;
  74. procedure DIB_Free(lpbi: PDIB);
  75. function DIB_Width(lpbi: PDIB): integer;
  76. function DIB_Height(lpbi: PDIB): integer;
  77. function DIB_BitCount(lpbi: PDIB): integer;
  78. function DIB_Compression(lpbi: PDIB): Longint;
  79. function DIB_NumColors(lpbi: PDIB): Longint;
  80. function DIB_WidthBytesN(lpbi: PDIB; n: integer): Longint;
  81. function DIB_WidthBytes(lpbi: PDIB): Longint;
  82. function DIB_BISize(lpbi: PDIB): integer;
  83. function DIB_SizeImage(lpbi: PDIB): Longint;
  84. function DIB_Size(lpbi: PDIB): Longint;
  85. function DIB_PaletteSize(lpbi: PDIB): Longint;
  86. function DIB_FlipY(lpbi: PDIB; y: integer): integer;
  87. function DIB_Colors(lpbi: PDIB): PRGBQUAD;
  88. function DIB_Ptr(lpbi: PDIB): Pointer;
  89. function DIB_XYN(lpbi: PDIB; pb: Pointer; x,y,n: integer): Pointer;
  90. function DIB_XY(lpbi: PDIB;x,y: integer): Pointer;
  91. function DIB_Info(pDIB: PDIB): PBitmapInfo;
  92. implementation