blob: bf76ac90d8c0c0ecf030210ec4bb02b0bce8b1db [file] [log] [blame]
[email protected]1a30dd32012-01-28 00:56:431// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]267c03d2011-02-02 23:03:072// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_GFX_GDI_UTIL_H_
6#define UI_GFX_GDI_UTIL_H_
7#pragma once
8
9#include <vector>
10#include <windows.h>
11
[email protected]507bad52011-08-06 04:51:0712#include "ui/base/ui_export.h"
[email protected]08397d52011-02-05 01:53:3813#include "ui/gfx/rect.h"
[email protected]267c03d2011-02-02 23:03:0714
15namespace gfx {
16
17// Creates a BITMAPINFOHEADER structure given the bitmap's size.
[email protected]507bad52011-08-06 04:51:0718UI_EXPORT void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr);
[email protected]267c03d2011-02-02 23:03:0719
20// Creates a BITMAPINFOHEADER structure given the bitmap's size and
21// color depth in bits per pixel.
22void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth,
23 BITMAPINFOHEADER* hdr);
24
25// Creates a BITMAPV4HEADER structure given the bitmap's size. You probably
26// only need to use BMP V4 if you need transparency (alpha channel). This
27// function sets the AlphaMask to 0xff000000.
[email protected]507bad52011-08-06 04:51:0728UI_EXPORT void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr);
[email protected]267c03d2011-02-02 23:03:0729
30// Creates a monochrome bitmap header.
31void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr);
32
33// Modify the given hrgn by subtracting the given rectangles.
[email protected]507bad52011-08-06 04:51:0734UI_EXPORT void SubtractRectanglesFromRegion(
35 HRGN hrgn,
36 const std::vector<gfx::Rect>& cutouts);
[email protected]267c03d2011-02-02 23:03:0737
[email protected]1a30dd32012-01-28 00:56:4338// Calculate scale to fit an entire page on DC.
39double CalculatePageScale(HDC dc, int page_width, int page_height);
40
41// Apply scaling to the DC.
42bool ScaleDC(HDC dc, double scale_factor);
43
[email protected]267c03d2011-02-02 23:03:0744} // namespace gfx
45
46#endif // UI_GFX_GDI_UTIL_H_