halcanary | 96287f7 | 2015-05-07 11:46:59 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkJpegInfo_DEFINED |
| 8 | #define SkJpegInfo_DEFINED |
| 9 | |
halcanary | 7a14b31 | 2015-10-01 07:28:13 -0700 | [diff] [blame] | 10 | #include "SkSize.h" |
| 11 | |
halcanary | 96287f7 | 2015-05-07 11:46:59 -0700 | [diff] [blame] | 12 | class SkData; |
| 13 | |
| 14 | struct SkJFIFInfo { |
halcanary | 7a14b31 | 2015-10-01 07:28:13 -0700 | [diff] [blame] | 15 | SkISize fSize; |
halcanary | 96287f7 | 2015-05-07 11:46:59 -0700 | [diff] [blame] | 16 | enum Type { |
| 17 | kGrayscale, |
| 18 | kYCbCr, |
| 19 | } fType; |
| 20 | }; |
| 21 | |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 22 | /** Returns true iff the data seems to be a valid JFIF JPEG image. |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 23 | If so and if info is not nullptr, populate info. |
halcanary | 96287f7 | 2015-05-07 11:46:59 -0700 | [diff] [blame] | 24 | |
| 25 | JPEG/JFIF References: |
| 26 | http://www.w3.org/Graphics/JPEG/itu-t81.pdf |
| 27 | http://www.w3.org/Graphics/JPEG/jfif3.pdf |
| 28 | */ |
| 29 | bool SkIsJFIF(const SkData* skdata, SkJFIFInfo* info); |
| 30 | |
| 31 | #endif // SkJpegInfo_DEFINED |