foobar2000 SDK  2015-08-03
Data Structures | Functions
GDIUtils.h File Reference

Go to the source code of this file.

Data Structures

class  CAltFontCtrl< TCtrl >
 
class  CBackBuffer
 
class  CBackBufferScope
 
class  CDCBrush
 
class  CDCPen
 
class  CFontScaled
 
class  DCClipRgnScope
 

Functions

static HBITMAP CreateDIB16 (CSize size)
 
static HBITMAP CreateDIB24 (CSize size)
 
static HBITMAP CreateDIB8 (CSize size, const COLORREF palette[256])
 
static void CreatePreferencesHeaderFont (CFont &out, CWindow source)
 
static void CreatePreferencesHeaderFont2 (CFont &out, CWindow source)
 
static void CreateScaledFont (CFont &out, CFontHandle in, double scale)
 
static void CreateScaledFontEx (CFont &out, CFontHandle in, double scale, int weight)
 
static HBRUSH MakeTempBrush (HDC dc, COLORREF color) throw ()
 

Function Documentation

static HBITMAP CreateDIB16 ( CSize  size)
static

Definition at line 15 of file GDIUtils.h.

15  {
16  struct {
17  BITMAPINFOHEADER bmi;
18  } bi = {};
19  bi.bmi.biSize = sizeof(bi.bmi);
20  bi.bmi.biWidth = size.cx;
21  bi.bmi.biHeight = size.cy;
22  bi.bmi.biPlanes = 1;
23  bi.bmi.biBitCount = 16;
24  bi.bmi.biCompression = BI_RGB;
25  void * bitsPtr;
26  return CreateDIBSection(NULL, reinterpret_cast<const BITMAPINFO*>(&bi), DIB_RGB_COLORS,&bitsPtr,0,0);
27 }
static HBITMAP CreateDIB24 ( CSize  size)
static

Definition at line 1 of file GDIUtils.h.

1  {
2  struct {
3  BITMAPINFOHEADER bmi;
4  } bi = {};
5  bi.bmi.biSize = sizeof(bi.bmi);
6  bi.bmi.biWidth = size.cx;
7  bi.bmi.biHeight = size.cy;
8  bi.bmi.biPlanes = 1;
9  bi.bmi.biBitCount = 24;
10  bi.bmi.biCompression = BI_RGB;
11  void * bitsPtr;
12  return CreateDIBSection(NULL, reinterpret_cast<const BITMAPINFO*>(&bi), DIB_RGB_COLORS,&bitsPtr,0,0);
13 }
static HBITMAP CreateDIB8 ( CSize  size,
const COLORREF  palette[256] 
)
static

Definition at line 29 of file GDIUtils.h.

29  {
30  struct {
31  BITMAPINFOHEADER bmi;
32  COLORREF colors[256];
33  } bi = { };
34  for(int c = 0; c < 256; ++c ) bi.colors[c] = palette[c];
35  bi.bmi.biSize = sizeof(bi.bmi);
36  bi.bmi.biWidth = size.cx;
37  bi.bmi.biHeight = size.cy;
38  bi.bmi.biPlanes = 1;
39  bi.bmi.biBitCount = 8;
40  bi.bmi.biCompression = BI_RGB;
41  bi.bmi.biClrUsed = 256;
42  void * bitsPtr;
43  return CreateDIBSection(NULL, reinterpret_cast<const BITMAPINFO*>(&bi), DIB_RGB_COLORS,&bitsPtr,0,0);
44 }
static void CreatePreferencesHeaderFont ( CFont &  out,
CWindow  source 
)
static

Definition at line 65 of file GDIUtils.h.

65  {
66  CreateScaledFontEx(out, source.GetFont(), 1.3, FW_BOLD);
67 }
static void CreateScaledFontEx(CFont &out, CFontHandle in, double scale, int weight)
Definition: GDIUtils.h:55
static void CreatePreferencesHeaderFont2 ( CFont &  out,
CWindow  source 
)
static

Definition at line 69 of file GDIUtils.h.

69  {
70  CreateScaledFontEx(out, source.GetFont(), 1.1, FW_BOLD);
71 }
static void CreateScaledFontEx(CFont &out, CFontHandle in, double scale, int weight)
Definition: GDIUtils.h:55
static void CreateScaledFont ( CFont &  out,
CFontHandle  in,
double  scale 
)
static

Definition at line 46 of file GDIUtils.h.

46  {
47  LOGFONT lf;
48  WIN32_OP_D( in.GetLogFont(lf) );
49  int temp = pfc::rint32(scale * lf.lfHeight);
50  if (temp == 0) temp = pfc::sgn_t(lf.lfHeight);
51  lf.lfHeight = temp;
52  WIN32_OP_D( out.CreateFontIndirect(&lf) != NULL );
53 }
int sgn_t(const T &p_val)
Definition: primitives.h:669
void SHARED_EXPORT scale(const audio_sample *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
p_source/p_output can point to same buffer
t_int32 rint32(double p_val)
Definition: other.cpp:209
static void CreateScaledFontEx ( CFont &  out,
CFontHandle  in,
double  scale,
int  weight 
)
static

Definition at line 55 of file GDIUtils.h.

55  {
56  LOGFONT lf;
57  WIN32_OP_D( in.GetLogFont(lf) );
58  int temp = pfc::rint32(scale * lf.lfHeight);
59  if (temp == 0) temp = pfc::sgn_t(lf.lfHeight);
60  lf.lfHeight = temp;
61  lf.lfWeight = weight;
62  WIN32_OP_D( out.CreateFontIndirect(&lf) != NULL );
63 }
int sgn_t(const T &p_val)
Definition: primitives.h:669
void SHARED_EXPORT scale(const audio_sample *p_source, t_size p_count, audio_sample *p_output, audio_sample p_scale)
p_source/p_output can point to same buffer
t_int32 rint32(double p_val)
Definition: other.cpp:209
static HBRUSH MakeTempBrush ( HDC  dc,
COLORREF  color 
)
throw (
)
static

Definition at line 120 of file GDIUtils.h.

120  {
121  SetDCBrushColor(dc, color); return (HBRUSH) GetStockObject(DC_BRUSH);
122 }