Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / utility / cloud_print / pwg_encoder.h
blobaaa0084a11c44c6e729b6f22564aed5f56138734
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.
5 #ifndef CHROME_UTILITY_CLOUD_PRINT_PWG_ENCODER_H_
6 #define CHROME_UTILITY_CLOUD_PRINT_PWG_ENCODER_H_
8 #include <string>
10 #include "base/basictypes.h"
12 namespace cloud_print {
14 class BitmapImage;
16 struct PwgHeaderInfo {
17 PwgHeaderInfo()
18 : dpi(300),
19 total_pages(1),
20 flipx(false),
21 flipy(false),
22 color_space(SRGB),
23 duplex(false),
24 tumble(false) {}
25 enum ColorSpace { SGRAY = 18, SRGB = 19 };
26 uint32 dpi;
27 uint32 total_pages;
28 bool flipx;
29 bool flipy;
30 ColorSpace color_space;
31 bool duplex;
32 bool tumble;
35 class PwgEncoder {
36 public:
37 PwgEncoder();
39 void EncodeDocumentHeader(std::string *output) const;
40 bool EncodePage(const BitmapImage& image,
41 const PwgHeaderInfo& pwg_header_info,
42 std::string* output) const;
44 private:
45 void EncodePageHeader(const BitmapImage& image,
46 const PwgHeaderInfo& pwg_header_info,
47 std::string* output) const;
49 template <typename InputStruct, class RandomAccessIterator>
50 void EncodeRow(RandomAccessIterator pos,
51 RandomAccessIterator row_end,
52 bool monochrome,
53 std::string* output) const;
55 template <typename InputStruct>
56 bool EncodePageWithColorspace(const BitmapImage& image,
57 const PwgHeaderInfo& pwg_header_info,
58 std::string* output) const;
60 const uint8* GetRow(const BitmapImage& image, int row, bool flipy) const;
63 } // namespace cloud_print
65 #endif // CHROME_UTILITY_CLOUD_PRINT_PWG_ENCODER_H_