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.

84 lines
2.2 KiB

  1. /* jpegapi.h -- header file for JPEG image compression interface.
  2. * Written by Ajai Sehgal
  3. * (c) Copyright Microsoft Corporation
  4. *
  5. * 08-27-1997 (kurtgeis) Removed dependency on Gromit/Fletcher funky data
  6. * types and includes.
  7. */
  8. #include "jinclude.h"
  9. #include "jpeglib.h"
  10. #include "jerror.h" /* get library error codes too */
  11. #include "jmemfile.h"
  12. #ifndef __JPEGAPI_H__
  13. #define __JPEGAPI_H__
  14. #define ALIGNIT(ap,t) \
  15. ((((size_t)(ap))+(sizeof(t)<8?3:7)) & (sizeof(t)<8?~3:~7))
  16. class THROWN
  17. {
  18. public:
  19. // Default constructor
  20. THROWN()
  21. {
  22. m_hr = S_OK;
  23. }
  24. // THROWN( HRESULT)
  25. //
  26. // Purpose:
  27. // Construct a throw object for an hresult.
  28. //
  29. THROWN( HRESULT hr )
  30. {
  31. m_hr = hr;
  32. }
  33. HRESULT Hr() { return m_hr; } // The HRESULT thrown
  34. private:
  35. HRESULT m_hr; // Associated HResult;
  36. };
  37. // Destroy the JPEG handle
  38. HRESULT DestroyJPEGCompressHeader(HANDLE hJpegC);
  39. HRESULT DestroyJPEGDecompressHeader(HANDLE hJpegD);
  40. // Takes the parameters for a tile write and creates a JPEG table for it
  41. HRESULT JPEGCompressHeader(BYTE *prgbJPEGBuf, UINT tuQuality, ULONG *pcbOut, HANDLE *phJpegC, J_COLOR_SPACE ColorSpace );
  42. HRESULT JPEGDecompressHeader(BYTE *prgbJPEGBuf, HANDLE *phJpegD, ULONG ulBufferSize );
  43. // Takes a raw RGBA image buffer and spits back a JPEG data stream.
  44. HRESULT JPEGFromRGBA(BYTE *prgbImage, BYTE *prgbJPEGBuf,UINT tuQuality, ULONG *pcbOut, HANDLE hJpegC,J_COLOR_SPACE ColorSpace, UINT nWidth, UINT nHeight );
  45. // Takes a JPEG data stream and spits back a raw RGBA image buffer.
  46. // iraklis's comment: the second argument is the RGBA buffer to be
  47. // loaded with the decompressed tile; we are
  48. // asserting that it is of the right size (i.e. sizeof (TIL))
  49. HRESULT RGBAFromJPEG(BYTE *prgbJPEG, BYTE *prgbImage, HANDLE hJpegD, ULONG ulBufferSize, BYTE bJPEGConversions, ULONG *pulReturnedNumChannels, UINT nWidth, UINT nHeight );
  50. HRESULT
  51. GetJPEGHeaderFields(
  52. HANDLE hJpegC,
  53. UINT *pWidth,
  54. UINT *pHeight,
  55. INT *pNumComponents,
  56. J_COLOR_SPACE *pColorSpace
  57. );
  58. BOOL
  59. WINAPI
  60. Win32DIBFromJPEG(
  61. BYTE *prgbJPEG,
  62. ULONG ulBufferSize,
  63. LPBITMAPINFO pbmi,
  64. HBITMAP *phBitmap ,
  65. PVOID *ppvBits
  66. );
  67. #endif // __JPEGAPI_H__