Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.3 KiB

  1. // Copyright (c) Microsoft Corp. 1993-94
  2. /*==============================================================================
  3. This include file defines the API for the bitmap scaler and padder.
  4. 06-Oct-93 RajeevD Created.
  5. ==============================================================================*/
  6. #ifndef _BMSCALER_
  7. #define _BMSCALER_
  8. #include <ifaxos.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /*==============================================================================
  13. ScalerGetRatios() returns a pointer to a capabilities structure, which points to
  14. the array of scaling ratios available. Each ratio is a pair of UINTs where the
  15. first and second value correspond to input and output respectively. For example,
  16. {2,1} is reduction to 50% and {2,3} is enlargement to 150%.
  17. The three classes of ratios are isotropic, vertical, and horizontal, listed in
  18. that order. The number of ratios in each class is given by the capabilities
  19. structure. Within each class, ratios are ordered monotonically from greatest
  20. enlargement to greatest reduction.
  21. ==============================================================================*/
  22. typedef struct
  23. {
  24. UINT FAR* lpRatios; // array of scaling ratios
  25. WORD cIsotropic; // number of isotropic ratios
  26. WORD cVertical; // number of vertical ratios
  27. WORD cHorizontal; // number of horizontal ratios
  28. WORD iPadder; // index of padding (1:1) ratio
  29. }
  30. SCALE_RATIOS, FAR *LPSCALE_RATIOS;
  31. LPSCALE_RATIOS WINAPI ScalerGetRatios (void);
  32. /*==============================================================================
  33. The SCALE structure specifies the scaling operation to be performed.
  34. The comments enclosed with square brackets apply to vertical scaling.
  35. ==============================================================================*/
  36. typedef struct
  37. #ifdef __cplusplus
  38. FAR SCALE
  39. #endif
  40. {
  41. DWORD nTypeIn; // input encoding: HRAW_DATA [or LRAW_DATA]
  42. DWORD nTypeOut; // output encoding: must be same as input
  43. UINT iRatio; // scaling ratio index from ScalerRatios()
  44. UINT cbLineIn; // input line width in bytes (must be 4x)
  45. UINT cbPadLeft; // output left padding width in bytes [0]
  46. UINT cbPadRight; // output right padding width in bytes [0]
  47. BOOL fPadOnes; // output background color (0 or 1)
  48. }
  49. SCALE, FAR *LPSCALE;
  50. #define SCALE_PAD_ZEROS FALSE
  51. #define SCALE_PAD_ONES TRUE
  52. /*==============================================================================
  53. ScalerTranslate() calculates the output line width for a given input line width
  54. and scaling ratio. This function is useful in determining, for example, the
  55. amount of padding required to preserve DWORD alignment.
  56. ==============================================================================*/
  57. UINT // output width, exclusive of padding
  58. WINAPI
  59. ScalerTranslate
  60. (
  61. LPSCALE lpParam // initialization parameters
  62. );
  63. /*==============================================================================
  64. ScalerInit() initializes the scaler. When queried with a NULL context pointer,
  65. it indicates how much memory must be allocated by the caller. When passed a
  66. pointer to that memory, it initializes the context.
  67. ==============================================================================*/
  68. UINT // size of context in bytes
  69. WINAPI
  70. ScalerInit
  71. (
  72. LPVOID lpContext, // context pointer (NULL on query)
  73. LPSCALE lpParam // initialization parameters
  74. );
  75. /*==============================================================================
  76. ScalerExec() executes the scaling specified in ScalerInit().
  77. In the input buffer, lpbBegData is advanced and wLengthData is decremented as
  78. data is consumed. If the caller wants to retain the input data, both must be
  79. saved and restored.
  80. In the output buffer, wLengthData is incremented as data is appended. A whole
  81. number of scan lines is produced
  82. To flush any output data at the end of a page, pass a NULL input buffer.
  83. Returns when the input buffer is empty or the output buffer full.
  84. ==============================================================================*/
  85. #define OUTPUT_FULL TRUE
  86. #define INPUT_EMPTY FALSE
  87. BOOL // output buffer full?
  88. WINAPI
  89. ScalerExec
  90. (
  91. LPVOID lpContext, // context pointer
  92. LPBUFFER lpbufIn, // input buffer (NULL at end of page)
  93. LPBUFFER lpbufOut // output buffer
  94. );
  95. #ifdef __cplusplus
  96. } // extern "C" {
  97. #endif
  98. #endif // _BMSCALER_