Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
read_image.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_READ_IMAGE_H_
20 #define PAGESPEED_KERNEL_IMAGE_READ_IMAGE_H_
21 
22 #include <cstddef>
26 
27 namespace net_instaweb {
28 class MessageHandler;
29 }
30 
31 namespace pagespeed {
32 
33 namespace image_compression {
34 
35 class MultipleFrameReader;
36 class MultipleFrameWriter;
37 class ScanlineReaderInterface;
38 class ScanlineWriterInterface;
39 
41 using pagespeed::image_compression::QuirksMode;
42 using pagespeed::image_compression::QUIRKS_CHROME;
43 
45 
48 
51 ScanlineReaderInterface* CreateScanlineReader(ImageFormat image_type,
52  const void* image_buffer,
53  size_t buffer_length,
54  MessageHandler* handler,
55  ScanlineStatus* status);
56 
57 inline ScanlineReaderInterface* CreateScanlineReader(ImageFormat image_type,
58  const void* image_buffer,
59  size_t buffer_length,
60  MessageHandler* handler) {
61  ScanlineStatus status;
62  return CreateScanlineReader(image_type, image_buffer, buffer_length,
63  handler, &status);
64 }
65 
70 ScanlineWriterInterface* CreateScanlineWriter(
71  ImageFormat image_type,
72  PixelFormat pixel_format,
73  size_t width,
74  size_t height,
75  const void* config,
76  GoogleString* image_data,
77  MessageHandler* handler,
78  ScanlineStatus* status);
79 
80 inline ScanlineWriterInterface* CreateScanlineWriter(ImageFormat image_type,
81  PixelFormat pixel_format,
82  size_t width,
83  size_t height,
84  const void* config,
85  GoogleString* image_data,
86  MessageHandler* handler) {
87  ScanlineStatus status;
88  return CreateScanlineWriter(image_type, pixel_format, width, height,
89  config, image_data, handler, &status);
90 }
91 
93 
100 MultipleFrameReader* CreateImageFrameReader(
101  ImageFormat image_type,
102  const void* image_buffer,
103  size_t buffer_length,
104  QuirksMode quirks_mode,
105  MessageHandler* handler,
106  ScanlineStatus* status);
107 
110 inline MultipleFrameReader* CreateImageFrameReader(
111  ImageFormat image_type,
112  const void* image_buffer,
113  size_t buffer_length,
114  MessageHandler* handler,
115  ScanlineStatus* status) {
116  return CreateImageFrameReader(image_type, image_buffer, buffer_length,
117  QUIRKS_CHROME, handler, status);
118 }
119 
126 MultipleFrameWriter* CreateImageFrameWriter(
127  ImageFormat image_type,
128  const void* config,
129  GoogleString* image_data,
130  MessageHandler* handler,
131  ScanlineStatus* status);
132 
134 
153 bool ReadImage(ImageFormat image_type,
154  const void* image_buffer,
155  size_t buffer_length,
156  void** pixels,
157  PixelFormat* pixel_format,
158  size_t* width,
159  size_t* height,
160  size_t* stride,
161  MessageHandler* handler);
162 
163 }
164 
165 }
166 
167 #endif
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: message_handler.h:39