Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pixel_format_optimizer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef PAGESPEED_KERNEL_IMAGE_PIXEL_FORMAT_OPTIMIZER_H_
20 #define PAGESPEED_KERNEL_IMAGE_PIXEL_FORMAT_OPTIMIZER_H_
21 
22 #include <cstddef>
29 
30 namespace pagespeed {
31 
32 namespace image_compression {
47  public:
49  virtual ~PixelFormatOptimizer();
50 
53 
54  virtual ScanlineStatus ReadNextScanlineWithStatus(void** out_scanline_bytes);
55 
57  virtual bool Reset();
58 
60  virtual size_t GetBytesPerScanline() {
61  return bytes_per_row_;
62  }
63 
66  virtual bool HasMoreScanLines() {
67  return (output_row_ < GetImageHeight());
68  }
69 
71  virtual size_t GetImageHeight() {
72  return reader_->GetImageHeight();
73  }
74 
76  virtual size_t GetImageWidth() {
77  return reader_->GetImageWidth();
78  }
79 
81  virtual PixelFormat GetPixelFormat() {
82  return pixel_format_;
83  }
84 
86  virtual bool IsProgressive() {
87  return reader_->IsProgressive();
88  }
89 
92  virtual ScanlineStatus InitializeWithStatus(const void* image_buffer,
93  size_t buffer_length);
94 
95  private:
97  size_t bytes_per_row_;
98  PixelFormat pixel_format_;
99  size_t output_row_;
100  bool strip_alpha_;
101  bool was_initialized_;
102 
105 
107  size_t input_row_;
108 
111 
112  net_instaweb::MessageHandler* message_handler_;
113 
114 
115 };
116 
117 }
118 
119 }
120 
121 #endif
virtual PixelFormat GetPixelFormat()
Returns the pixel format of the image.
Definition: pixel_format_optimizer.h:81
Definition: scanline_status.h:93
virtual size_t GetImageWidth()
Returns the width of the image.
Definition: pixel_format_optimizer.h:76
Definition: pixel_format_optimizer.h:46
virtual ScanlineStatus InitializeWithStatus(const void *image_buffer, size_t buffer_length)
Definition: scoped_ptr.h:30
virtual ScanlineStatus ReadNextScanlineWithStatus(void **out_scanline_bytes)
Definition: message_handler.h:39
virtual size_t GetImageHeight()
Returns the height of the image.
Definition: pixel_format_optimizer.h:71
virtual size_t GetBytesPerScanline()
Returns number of bytes required to store a scanline.
Definition: pixel_format_optimizer.h:60
ScanlineStatus Initialize(ScanlineReaderInterface *reader)
PixelFormatOptimizer acquires ownership of reader, even in case of failure.
virtual bool Reset()
Resets the resizer to its initial state. Always returns true.
virtual bool HasMoreScanLines()
Definition: pixel_format_optimizer.h:66
virtual bool IsProgressive()
Returns true if the image is encoded in progressive / interlacing format.
Definition: pixel_format_optimizer.h:86