blob: 85090722f900b6a33ae20e881e41c7c7beabeb7b [file] [log] [blame]
license.botf003cfe2008-08-24 09:55:55 +09001// Copyright (c) 2006-2008 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.
initial.commit3f4a7322008-07-27 06:49:38 +09004
5#ifndef BASE_GFX_SKIA_UTILS_H__
6#define BASE_GFX_SKIA_UTILS_H__
7
8#include "SkColor.h"
9#include "SkShader.h"
10
11struct SkIRect;
12struct SkPoint;
13struct SkRect;
14typedef unsigned long DWORD;
15typedef DWORD COLORREF;
16typedef struct tagPOINT POINT;
17typedef struct tagRECT RECT;
18
19namespace gfx {
20
21// Converts a Skia point to a Windows POINT.
22POINT SkPointToPOINT(const SkPoint& point);
23
24// Converts a Windows RECT to a Skia rect.
25SkRect RECTToSkRect(const RECT& rect);
26
27// Converts a Windows RECT to a Skia rect.
28// Both use same in-memory format. Verified by COMPILE_ASSERT() in
29// skia_utils.cc.
30inline const SkIRect& RECTToSkIRect(const RECT& rect) {
31 return reinterpret_cast<const SkIRect&>(rect);
32}
33
34// Converts a Skia rect to a Windows RECT.
35// Both use same in-memory format. Verified by COMPILE_ASSERT() in
36// skia_utils.cc.
37inline const RECT& SkIRectToRECT(const SkIRect& rect) {
38 return reinterpret_cast<const RECT&>(rect);
39}
40
41// Creates a vertical gradient shader. The caller owns the shader.
42SkShader* CreateGradientShader(int start_point,
43 int end_point,
44 SkColor start_color,
45 SkColor end_color);
46
47// Converts COLORREFs (0BGR) to the ARGB layout Skia expects.
48SkColor COLORREFToSkColor(COLORREF color);
49
50// Converts ARGB to COLORREFs (0BGR).
51COLORREF SkColorToCOLORREF(SkColor color);
52
53} // namespace gfx
54
55#endif
license.botf003cfe2008-08-24 09:55:55 +090056