| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef picture_utils_DEFINED | 8 #ifndef picture_utils_DEFINED |
| 9 #define picture_utils_DEFINED | 9 #define picture_utils_DEFINED |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * we should add the implementation to src/core/SkString.cpp, write tests fo
r it, | 31 * we should add the implementation to src/core/SkString.cpp, write tests fo
r it, |
| 32 * and remove it from elsewhere. | 32 * and remove it from elsewhere. |
| 33 */ | 33 */ |
| 34 void replace_char(SkString* str, const char oldChar, const char newChar); | 34 void replace_char(SkString* str, const char oldChar, const char newChar); |
| 35 | 35 |
| 36 // Creates a posix style filepath by concatenating name onto dir with a | 36 // Creates a posix style filepath by concatenating name onto dir with a |
| 37 // forward slash into path. | 37 // forward slash into path. |
| 38 // TODO(epoger): delete in favor of SkOSPath::SkPathJoin()? | 38 // TODO(epoger): delete in favor of SkOSPath::SkPathJoin()? |
| 39 void make_filepath(SkString* path, const SkString&, const SkString& name); | 39 void make_filepath(SkString* path, const SkString&, const SkString& name); |
| 40 | 40 |
| 41 // Returns the last part of the path (file name or leaf directory name) | |
| 42 // | |
| 43 // This basically just looks for a foward slash or backslash (windows | |
| 44 // only). | |
| 45 // TODO(epoger): delete in favor of SkOSPath::SkBasename()? | |
| 46 void get_basename(SkString* basename, const SkString& path); | |
| 47 | |
| 48 // Returns true if the string ends with % | 41 // Returns true if the string ends with % |
| 49 bool is_percentage(const char* const string); | 42 bool is_percentage(const char* const string); |
| 50 | 43 |
| 51 // Prepares the bitmap so that it can be written. | 44 // Prepares the bitmap so that it can be written. |
| 52 // | 45 // |
| 53 // Specifically, it configures the bitmap, allocates pixels and then | 46 // Specifically, it configures the bitmap, allocates pixels and then |
| 54 // erases the pixels to transparent black. | 47 // erases the pixels to transparent black. |
| 55 void setup_bitmap(SkBitmap* bitmap, int width, int height); | 48 void setup_bitmap(SkBitmap* bitmap, int width, int height); |
| 56 | 49 |
| 57 /** | 50 /** |
| 58 * Write a bitmap file to disk. | 51 * Write a bitmap file to disk. |
| 59 * | 52 * |
| 60 * @param bm the bitmap to record | 53 * @param bm the bitmap to record |
| 61 * @param dirPath directory within which to write the image file | 54 * @param dirPath directory within which to write the image file |
| 62 * @param subdirOrNull subdirectory within dirPath, or NULL to just write in
to dirPath | 55 * @param subdirOrNull subdirectory within dirPath, or NULL to just write in
to dirPath |
| 63 * @param baseName last part of the filename | 56 * @param baseName last part of the filename |
| 64 * | 57 * |
| 65 * @return true if written out successfully | 58 * @return true if written out successfully |
| 66 */ | 59 */ |
| 67 bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath, | 60 bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath, |
| 68 const char *subdirOrNull, const SkString& baseName
); | 61 const char *subdirOrNull, const SkString& baseName
); |
| 69 | 62 |
| 70 } // namespace sk_tools | 63 } // namespace sk_tools |
| 71 | 64 |
| 72 #endif // picture_utils_DEFINED | 65 #endif // picture_utils_DEFINED |
| OLD | NEW |