1 // Copyright (c) 2012 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. 4 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ 6 #define CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ 7 8 #include "third_party/skia/include/core/SkColor.h" 9 10 typedef struct _GdkColor GdkColor; 11 typedef struct _GdkPixbuf GdkPixbuf; 12 13 class SkBitmap; 14 15 namespace libgtk2ui { 16 17 // Converts GdkColors to the ARGB layout Skia expects. 18 SkColor GdkColorToSkColor(GdkColor color); 19 20 // Converts ARGB to GdkColor. 21 GdkColor SkColorToGdkColor(SkColor color); 22 23 const SkBitmap GdkPixbufToImageSkia(GdkPixbuf* pixbuf); 24 25 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so 26 // it is an expensive operation. The returned GdkPixbuf will have a refcount of 27 // 1, and the caller is responsible for unrefing it when done. 28 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); 29 30 } // namespace libgtk2ui 31 32 #endif // CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ 33