pwg_encoder.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PWG_ENCODER_PWG_ENCODER_H_
  5. #define COMPONENTS_PWG_ENCODER_PWG_ENCODER_H_
  6. #include <stdint.h>
  7. #include <string>
  8. #include "ui/gfx/geometry/size.h"
  9. namespace pwg_encoder {
  10. class BitmapImage;
  11. struct PwgHeaderInfo {
  12. PwgHeaderInfo()
  13. : dpi(300, 300),
  14. total_pages(1),
  15. flipx(false),
  16. flipy(false),
  17. color_space(SRGB),
  18. duplex(false),
  19. tumble(false) {}
  20. enum ColorSpace { SGRAY = 18, SRGB = 19 };
  21. gfx::Size dpi;
  22. uint32_t total_pages;
  23. bool flipx;
  24. bool flipy;
  25. ColorSpace color_space;
  26. bool duplex;
  27. bool tumble;
  28. };
  29. class PwgEncoder {
  30. public:
  31. PwgEncoder() = delete;
  32. PwgEncoder(const PwgEncoder&) = delete;
  33. PwgEncoder& operator=(const PwgEncoder&) = delete;
  34. static std::string GetDocumentHeader();
  35. // Given an image, create a PWG of the image and put the compressed image data
  36. // in the returned string, or return an empty string on failure.
  37. static std::string EncodePage(const BitmapImage& image,
  38. const PwgHeaderInfo& pwg_header_info);
  39. };
  40. } // namespace pwg_encoder
  41. #endif // COMPONENTS_PWG_ENCODER_PWG_ENCODER_H_