OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_GDI_UTIL_H_ | 5 #ifndef UI_GFX_GDI_UTIL_H_ |
6 #define UI_GFX_GDI_UTIL_H_ | 6 #define UI_GFX_GDI_UTIL_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ui/gfx/geometry/rect.h" | |
12 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
13 #include "ui/gfx/path.h" | |
14 | 12 |
15 namespace gfx { | 13 namespace gfx { |
16 | 14 |
17 // Creates a BITMAPINFOHEADER structure given the bitmap's size. | |
18 GFX_EXPORT void CreateBitmapHeader(int width, int height, | |
19 BITMAPINFOHEADER* hdr); | |
20 | |
21 // Creates a BITMAPV4HEADER structure given the bitmap's size. You probably | 15 // Creates a BITMAPV4HEADER structure given the bitmap's size. You probably |
22 // only need to use BMP V4 if you need transparency (alpha channel). This | 16 // only need to use BMP V4 if you need transparency (alpha channel). This |
23 // function sets the AlphaMask to 0xff000000. | 17 // function sets the AlphaMask to 0xff000000. |
24 GFX_EXPORT void CreateBitmapV4Header(int width, int height, | 18 GFX_EXPORT void CreateBitmapV4Header(int width, int height, |
25 BITMAPV4HEADER* hdr); | 19 BITMAPV4HEADER* hdr); |
26 | 20 |
27 // Creates a monochrome bitmap header. | |
28 void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); | |
29 | |
30 // Modify the given hrgn by subtracting the given rectangles. | |
31 GFX_EXPORT void SubtractRectanglesFromRegion( | |
32 HRGN hrgn, | |
33 const std::vector<gfx::Rect>& cutouts); | |
34 | |
35 GFX_EXPORT HRGN ConvertPathToHRGN(const gfx::Path& path); | |
36 | |
37 // Calculate scale to fit an entire page on DC. | 21 // Calculate scale to fit an entire page on DC. |
38 GFX_EXPORT float CalculatePageScale(HDC dc, int page_width, int page_height); | 22 GFX_EXPORT float CalculatePageScale(HDC dc, int page_width, int page_height); |
39 | 23 |
40 // Apply scaling to the DC. | 24 // Apply scaling to the DC. |
41 GFX_EXPORT bool ScaleDC(HDC dc, float scale_factor); | 25 GFX_EXPORT bool ScaleDC(HDC dc, float scale_factor); |
42 | 26 |
43 GFX_EXPORT void StretchDIBits(HDC hdc, | 27 GFX_EXPORT void StretchDIBits(HDC hdc, |
44 int dest_x, int dest_y, int dest_w, int dest_h, | 28 int dest_x, int dest_y, int dest_w, int dest_h, |
45 int src_x, int src_y, int src_w, int src_h, | 29 int src_x, int src_y, int src_w, int src_h, |
46 void* pixels, const BITMAPINFO* bitmap_info); | 30 void* pixels, const BITMAPINFO* bitmap_info); |
47 | 31 |
48 } // namespace gfx | 32 } // namespace gfx |
49 | 33 |
50 #endif // UI_GFX_GDI_UTIL_H_ | 34 #endif // UI_GFX_GDI_UTIL_H_ |
OLD | NEW |