Process Hacker
graph.c File Reference
#include <phgui.h>
#include <graph.h>

Go to the source code of this file.

Macros

#define _PH_GRAPH_PRIVATE
 
#define COLORREF_TO_BITS(Color)   (_byteswap_ulong(Color) >> 8)
 

Typedefs

typedef struct _PHP_GRAPH_CONTEXT PHP_GRAPH_CONTEXT
 
typedef struct _PHP_GRAPH_CONTEXT * PPHP_GRAPH_CONTEXT
 

Functions

LRESULT CALLBACK PhpGraphWndProc (_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
BOOLEAN PhGraphControlInitialization (VOID)
 
VOID PhDrawGraph (_In_ HDC hdc, _In_ PPH_GRAPH_DRAW_INFO DrawInfo)
 Draws a graph.
 
FORCEINLINE VOID PhpGetGraphPoint (_In_ PPH_GRAPH_DRAW_INFO DrawInfo, _In_ ULONG Index, _Out_ PULONG H1, _Out_ PULONG H2)
 
VOID PhDrawGraphDirect (_In_ HDC hdc, _In_ PVOID Bits, _In_ PPH_GRAPH_DRAW_INFO DrawInfo)
 Draws a graph directly to memory.
 
VOID PhSetGraphText (_In_ HDC hdc, _Inout_ PPH_GRAPH_DRAW_INFO DrawInfo, _In_ PPH_STRINGREF Text, _In_ PRECT Margin, _In_ PRECT Padding, _In_ ULONG Align)
 Sets the text in a graphing information structure.
 
VOID PhpCreateGraphContext (_Out_ PPHP_GRAPH_CONTEXT *Context)
 
VOID PhpFreeGraphContext (_Inout_ _Post_invalid_ PPHP_GRAPH_CONTEXT Context)
 
VOID PhpUpdateDrawInfo (_In_ HWND hwnd, _In_ PPHP_GRAPH_CONTEXT Context)
 
VOID PhpDrawGraphControl (_In_ HWND hwnd, _In_ PPHP_GRAPH_CONTEXT Context)
 
VOID PhInitializeGraphBuffers (_Out_ PPH_GRAPH_BUFFERS Buffers)
 Initializes a graph buffer management structure.
 
VOID PhDeleteGraphBuffers (_Inout_ PPH_GRAPH_BUFFERS Buffers)
 Frees resources used by a graph buffer management structure.
 
VOID PhGetDrawInfoGraphBuffers (_Inout_ PPH_GRAPH_BUFFERS Buffers, _Inout_ PPH_GRAPH_DRAW_INFO DrawInfo, _In_ ULONG DataCount)
 Sets up a graphing information structure with information from a graph buffer management structure.
 
VOID PhInitializeGraphState (_Out_ PPH_GRAPH_STATE State)
 
VOID PhDeleteGraphState (_Inout_ PPH_GRAPH_STATE State)
 
VOID PhGraphStateGetDrawInfo (_Inout_ PPH_GRAPH_STATE State, _In_ PPH_GRAPH_GETDRAWINFO GetDrawInfo, _In_ ULONG DataCount)
 

Variables

RECT PhNormalGraphTextMargin = { 5, 5, 5, 5 }
 
RECT PhNormalGraphTextPadding = { 3, 3, 3, 3 }
 

Macro Definition Documentation

#define _PH_GRAPH_PRIVATE

Definition at line 23 of file graph.c.

#define COLORREF_TO_BITS (   Color)    (_byteswap_ulong(Color) >> 8)

Definition at line 27 of file graph.c.

Typedef Documentation

typedef struct _PHP_GRAPH_CONTEXT PHP_GRAPH_CONTEXT
typedef struct _PHP_GRAPH_CONTEXT * PPHP_GRAPH_CONTEXT

Function Documentation

VOID PhDeleteGraphBuffers ( _Inout_ PPH_GRAPH_BUFFERS  Buffers)

Frees resources used by a graph buffer management structure.

Parameters
BuffersThe buffer management structure.

Definition at line 1369 of file graph.c.

VOID PhDeleteGraphState ( _Inout_ PPH_GRAPH_STATE  State)

Definition at line 1431 of file graph.c.

VOID PhDrawGraph ( _In_ HDC  hdc,
_In_ PPH_GRAPH_DRAW_INFO  DrawInfo 
)

Draws a graph.

Parameters
hdcThe DC to draw to.
DrawInfoA structure which contains graphing information.
Remarks
This function is extremely slow. Use PhDrawGraphDirect() whenever possible.

Definition at line 99 of file graph.c.

VOID PhDrawGraphDirect ( _In_ HDC  hdc,
_In_ PVOID  Bits,
_In_ PPH_GRAPH_DRAW_INFO  DrawInfo 
)

Draws a graph directly to memory.

Parameters
hdcThe DC to draw to. This is only used when drawing text.
BitsThe bits in a bitmap.
DrawInfoA structure which contains graphing information.
Remarks
The following information is fixed:
  • The graph is fixed to the origin (0, 0).
  • The total size of the bitmap is assumed to be Width and Height in DrawInfo.
  • Step is fixed at 2.
  • If PH_GRAPH_USE_LINE_2 is specified in Flags, PH_GRAPH_OVERLAY_LINE_2 is never used.

Definition at line 413 of file graph.c.

VOID PhGetDrawInfoGraphBuffers ( _Inout_ PPH_GRAPH_BUFFERS  Buffers,
_Inout_ PPH_GRAPH_DRAW_INFO  DrawInfo,
_In_ ULONG  DataCount 
)

Sets up a graphing information structure with information from a graph buffer management structure.

Parameters
BuffersThe buffer management structure.
DrawInfoThe graphing information structure.
DataCountThe number of data points currently required. The buffers are resized if needed.

Definition at line 1386 of file graph.c.

BOOLEAN PhGraphControlInitialization ( VOID  )

Definition at line 66 of file graph.c.

VOID PhGraphStateGetDrawInfo ( _Inout_ PPH_GRAPH_STATE  State,
_In_ PPH_GRAPH_GETDRAWINFO  GetDrawInfo,
_In_ ULONG  DataCount 
)

Definition at line 1440 of file graph.c.

VOID PhInitializeGraphBuffers ( _Out_ PPH_GRAPH_BUFFERS  Buffers)

Initializes a graph buffer management structure.

Parameters
BuffersThe buffer management structure.

Definition at line 1354 of file graph.c.

VOID PhInitializeGraphState ( _Out_ PPH_GRAPH_STATE  State)

Definition at line 1421 of file graph.c.

VOID PhpCreateGraphContext ( _Out_ PPHP_GRAPH_CONTEXT Context)

Definition at line 750 of file graph.c.

VOID PhpDrawGraphControl ( _In_ HWND  hwnd,
_In_ PPHP_GRAPH_CONTEXT  Context 
)

Definition at line 936 of file graph.c.

VOID PhpFreeGraphContext ( _Inout_ _Post_invalid_ PPHP_GRAPH_CONTEXT  Context)

Definition at line 784 of file graph.c.

FORCEINLINE VOID PhpGetGraphPoint ( _In_ PPH_GRAPH_DRAW_INFO  DrawInfo,
_In_ ULONG  Index,
_Out_ PULONG  H1,
_Out_ PULONG  H2 
)

Definition at line 359 of file graph.c.

LRESULT CALLBACK PhpGraphWndProc ( _In_ HWND  hwnd,
_In_ UINT  uMsg,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)

Definition at line 984 of file graph.c.

VOID PhpUpdateDrawInfo ( _In_ HWND  hwnd,
_In_ PPHP_GRAPH_CONTEXT  Context 
)

Definition at line 918 of file graph.c.

VOID PhSetGraphText ( _In_ HDC  hdc,
_Inout_ PPH_GRAPH_DRAW_INFO  DrawInfo,
_In_ PPH_STRINGREF  Text,
_In_ PRECT  Margin,
_In_ PRECT  Padding,
_In_ ULONG  Align 
)

Sets the text in a graphing information structure.

Parameters
hdcThe DC to perform calculations from.
DrawInfoA structure which contains graphing information. The structure is modified to contain the new text information.
TextThe text.
MarginThe margins of the text box from the edges of the graph.
PaddingThe padding within the text box.
AlignThe alignment of the text box.

Definition at line 703 of file graph.c.

Variable Documentation

RECT PhNormalGraphTextMargin = { 5, 5, 5, 5 }

Definition at line 63 of file graph.c.

RECT PhNormalGraphTextPadding = { 3, 3, 3, 3 }

Definition at line 64 of file graph.c.