# Class TBufferPanel

Description
Hierarchy
Fields
Methods
Properties

## Unit

uCEFBufferPanel

## Declaration

`type TBufferPanel = class(TCustomPanel)`

## Description

TBufferPanel is used by VCL and LCL applications with browsers in OSR mode to draw the browser contents. See the SimpleOSRBrowser demo for more details.

## Hierarchy

- TCustomPanel
- TBufferPanel

## Overview

### Fields

| `FScanlineSize: integer;`
| `FTransparent: boolean;`
| `FOnPaintParentBkg: TNotifyEvent;`
| `FForcedDeviceScaleFactor: single;`
| `FDeviceScaleFactor: single;`
| `FCopyOriginalBuffer: boolean;`
| `FMustInitBuffer: boolean;`
| `FBuffer: TBitmap;`
| `FOrigBuffer: TCEFBitmapBitBuffer;`
| `FOrigPopupBuffer: TCEFBitmapBitBuffer;`
| `FOrigPopupScanlineSize: integer;`
| `FSyncObj: THandle;`
| `FIMEHandler: TCEFOSRIMEHandler;`
| `FOnIMECancelComposition: TNotifyEvent;`
| `FOnIMECommitText: TOnIMECommitTextEvent;`
| `FOnIMESetComposition: TOnIMESetCompositionEvent;`
| `FOnCustomTouch: TOnHandledMessageEvent;`
| `FOnPointerDown: TOnHandledMessageEvent;`
| `FOnPointerUp: TOnHandledMessageEvent;`
| `FOnPointerUpdate: TOnHandledMessageEvent;`

### Methods

| `procedure CreateSyncObj;`
| `procedure DestroySyncObj;`
| `procedure DestroyBuffer;`
| `function GetBufferBits: pointer;`
| `function GetBufferWidth: integer;`
| `function GetBufferHeight: integer;`
| `function GetOrigBufferWidth: integer;`
| `function GetOrigBufferHeight: integer;`
| `function GetScreenScale: single; virtual;`
| `function GetRealScreenScale(var aResultScale : single) : boolean; virtual;`
| `function GetOrigPopupBufferBits: pointer;`
| `function GetOrigPopupBufferWidth: integer;`
| `function GetOrigPopupBufferHeight: integer;`
| `function GetParentFormHandle: TCefWindowHandle;`
| `function GetParentForm: TCustomForm;`
| `procedure SetTransparent(aValue : boolean);`
| `function CopyBuffer: boolean;`
| `function SaveBufferToFile(const aFilename : string) : boolean;`
| `procedure Paint; override;`
| `procedure CreateParams(var Params: TCreateParams); override;`
| `procedure WndProc(var aMessage: TMessage); override;`
| `procedure WMCEFInvalidate(var aMessage: TMessage); message CEF_INVALIDATE;`
| `procedure WMEraseBkgnd(var aMessage : TWMEraseBkgnd); message WM_ERASEBKGND;`
| `procedure WMTouch(var aMessage: TMessage); message WM_TOUCH;`
| `procedure WMPointerDown(var aMessage: TMessage); message WM_POINTERDOWN;`
| `procedure WMPointerUpdate(var aMessage: TMessage); message WM_POINTERUPDATE;`
| `procedure WMPointerUp(var aMessage: TMessage); message WM_POINTERUP;`
| `procedure WMIMEStartComp(var aMessage: TMessage);`
| `procedure WMIMEEndComp(var aMessage: TMessage);`
| `procedure WMIMESetContext(var aMessage: TMessage);`
| `procedure WMIMEComposition(var aMessage: TMessage);`
| `procedure DoOnIMECancelComposition; virtual;`
| `procedure DoOnIMECommitText(const aText : ustring; const replacement_range : PCefRange; relative_cursor_pos : integer); virtual;`
| `procedure DoOnIMESetComposition(const aText : ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : TCefRange); virtual;`
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `procedure AfterConstruction; override;`
| `function SaveToFile(const aFilename : string) : boolean;`
| `function InvalidatePanel: boolean;`
| `function BeginBufferDraw: boolean;`
| `procedure EndBufferDraw;`
| `procedure BufferDraw(x, y : integer; const aBitmap : TBitmap); overload;`
| `procedure BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect); overload;`
| `function UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;`
| `function UpdateOrigBufferDimensions(aWidth, aHeight : integer) : boolean;`
| `function UpdateOrigPopupBufferDimensions(aWidth, aHeight : integer) : boolean;`
| `procedure UpdateDeviceScaleFactor;`
| `function BufferIsResized(aUseMutex : boolean = True) : boolean;`
| `procedure CreateIMEHandler;`
| `procedure ChangeCompositionRange(const selection_range : TCefRange; const character_bounds : TCefRectDynArray);`
| `procedure DrawOrigPopupBuffer(const aSrcRect, aDstRect : TRect);`

### Properties

| `property ScanlineSize : integer read FScanlineSize;`
| `property BufferWidth : integer read GetBufferWidth;`
| `property BufferHeight : integer read GetBufferHeight;`
| `property BufferBits : pointer read GetBufferBits;`
| `property ScreenScale : single read GetScreenScale;`
| `property ForcedDeviceScaleFactor : single read FForcedDeviceScaleFactor write FForcedDeviceScaleFactor;`
| `property MustInitBuffer : boolean read FMustInitBuffer write FMustInitBuffer;`
| `property Buffer : TBitmap read FBuffer;`
| `property OrigBuffer : TCEFBitmapBitBuffer read FOrigBuffer;`
| `property OrigBufferWidth : integer read GetOrigBufferWidth;`
| `property OrigBufferHeight : integer read GetOrigBufferHeight;`
| `property OrigPopupBuffer : TCEFBitmapBitBuffer read FOrigPopupBuffer;`
| `property OrigPopupBufferWidth : integer read GetOrigPopupBufferWidth;`
| `property OrigPopupBufferHeight : integer read GetOrigPopupBufferHeight;`
| `property OrigPopupBufferBits : pointer read GetOrigPopupBufferBits;`
| `property OrigPopupScanlineSize : integer read FOrigPopupScanlineSize;`
| `property ParentFormHandle : TCefWindowHandle read GetParentFormHandle;`
| `property ParentForm : TCustomForm read GetParentForm;`
| `property DockManager;`
| `property Canvas;`
| `property OnIMECancelComposition : TNotifyEvent read FOnIMECancelComposition write FOnIMECancelComposition;`
| `property OnIMECommitText : TOnIMECommitTextEvent read FOnIMECommitText write FOnIMECommitText;`
| `property OnIMESetComposition : TOnIMESetCompositionEvent read FOnIMESetComposition write FOnIMESetComposition;`
| `property OnCustomTouch : TOnHandledMessageEvent read FOnCustomTouch write FOnCustomTouch;`
| `property OnPointerDown : TOnHandledMessageEvent read FOnPointerDown write FOnPointerDown;`
| `property OnPointerUp : TOnHandledMessageEvent read FOnPointerUp write FOnPointerUp;`
| `property OnPointerUpdate : TOnHandledMessageEvent read FOnPointerUpdate write FOnPointerUpdate;`
| `property OnPaintParentBkg : TNotifyEvent read FOnPaintParentBkg write FOnPaintParentBkg;`
| `property Transparent : boolean read FTransparent write SetTransparent default False;`
| `property CopyOriginalBuffer : boolean read FCopyOriginalBuffer write FCopyOriginalBuffer default False;`
| `property Align;`
| `property Alignment;`
| `property Anchors;`
| `property AutoSize;`
| `property OnUTF8KeyPress;`
| `property BevelInner;`
| `property BevelOuter;`
| `property BevelWidth;`
| `property BiDiMode;`
| `property BorderWidth;`
| `property BorderStyle;`
| `property Caption;`
| `property Color;`
| `property Constraints;`
| `property UseDockManager default True;`
| `property DockSite;`
| `property DoubleBuffered;`
| `property DragCursor;`
| `property DragKind;`
| `property DragMode;`
| `property Enabled;`
| `property FullRepaint;`
| `property Font;`
| `property ParentBiDiMode;`
| `property ParentColor;`
| `property ParentFont;`
| `property ParentShowHint;`
| `property PopupMenu;`
| `property ShowHint;`
| `property TabOrder;`
| `property TabStop;`
| `property Visible;`
| `property OnClick;`
| `property OnConstrainedResize;`
| `property OnContextPopup;`
| `property OnDockDrop;`
| `property OnDockOver;`
| `property OnDblClick;`
| `property OnDragDrop;`
| `property OnDragOver;`
| `property OnEndDock;`
| `property OnEndDrag;`
| `property OnEnter;`
| `property OnExit;`
| `property OnGetSiteInfo;`
| `property OnMouseDown;`
| `property OnMouseMove;`
| `property OnMouseUp;`
| `property OnMouseWheel;`
| `property OnKeyDown;`
| `property OnKeyPress;`
| `property OnKeyUp;`
| `property OnResize;`
| `property OnStartDock;`
| `property OnStartDrag;`
| `property OnUnDock;`
| `property OnMouseEnter;`
| `property OnMouseLeave;`

## Description

### Fields

| `FScanlineSize: integer;`
This item has no description.

| `FTransparent: boolean;`
This item has no description.

| `FOnPaintParentBkg: TNotifyEvent;`
This item has no description.

| `FForcedDeviceScaleFactor: single;`
This item has no description.

| `FDeviceScaleFactor: single;`
This item has no description.

| `FCopyOriginalBuffer: boolean;`
This item has no description.

| `FMustInitBuffer: boolean;`
This item has no description.

| `FBuffer: TBitmap;`
This item has no description.

| `FOrigBuffer: TCEFBitmapBitBuffer;`
This item has no description.

| `FOrigPopupBuffer: TCEFBitmapBitBuffer;`
This item has no description.

| `FOrigPopupScanlineSize: integer;`
This item has no description.

| `FSyncObj: THandle;`
This item has no description.

| `FIMEHandler: TCEFOSRIMEHandler;`
This item has no description.

| `FOnIMECancelComposition: TNotifyEvent;`
This item has no description.

| `FOnIMECommitText: TOnIMECommitTextEvent;`
This item has no description.

| `FOnIMESetComposition: TOnIMESetCompositionEvent;`
This item has no description.

| `FOnCustomTouch: TOnHandledMessageEvent;`
This item has no description.

| `FOnPointerDown: TOnHandledMessageEvent;`
This item has no description.

| `FOnPointerUp: TOnHandledMessageEvent;`
This item has no description.

| `FOnPointerUpdate: TOnHandledMessageEvent;`
This item has no description.

### Methods

| `procedure CreateSyncObj;`
This item has no description.

| `procedure DestroySyncObj;`
This item has no description.

| `procedure DestroyBuffer;`
This item has no description.

| `function GetBufferBits: pointer;`
This item has no description.

| `function GetBufferWidth: integer;`
This item has no description.

| `function GetBufferHeight: integer;`
This item has no description.

| `function GetOrigBufferWidth: integer;`
This item has no description.

| `function GetOrigBufferHeight: integer;`
This item has no description.

| `function GetScreenScale: single; virtual;`
This item has no description.

| `function GetRealScreenScale(var aResultScale : single) : boolean; virtual;`
This item has no description.

| `function GetOrigPopupBufferBits: pointer;`
This item has no description.

| `function GetOrigPopupBufferWidth: integer;`
This item has no description.

| `function GetOrigPopupBufferHeight: integer;`
This item has no description.

| `function GetParentFormHandle: TCefWindowHandle;`
This item has no description.

| `function GetParentForm: TCustomForm;`
This item has no description.

| `procedure SetTransparent(aValue : boolean);`
This item has no description.

| `function CopyBuffer: boolean;`
This item has no description.

| `function SaveBufferToFile(const aFilename : string) : boolean;`
This item has no description.

| `procedure Paint; override;`
This item has no description.

| `procedure CreateParams(var Params: TCreateParams); override;`
This item has no description.

| `procedure WndProc(var aMessage: TMessage); override;`
This item has no description.

| `procedure WMCEFInvalidate(var aMessage: TMessage); message CEF_INVALIDATE;`
This item has no description.

| `procedure WMEraseBkgnd(var aMessage : TWMEraseBkgnd); message WM_ERASEBKGND;`
This item has no description.

| `procedure WMTouch(var aMessage: TMessage); message WM_TOUCH;`
This item has no description.

| `procedure WMPointerDown(var aMessage: TMessage); message WM_POINTERDOWN;`
This item has no description.

| `procedure WMPointerUpdate(var aMessage: TMessage); message WM_POINTERUPDATE;`
This item has no description.

| `procedure WMPointerUp(var aMessage: TMessage); message WM_POINTERUP;`
This item has no description.

| `procedure WMIMEStartComp(var aMessage: TMessage);`
This item has no description.

| `procedure WMIMEEndComp(var aMessage: TMessage);`
This item has no description.

| `procedure WMIMESetContext(var aMessage: TMessage);`
This item has no description.

| `procedure WMIMEComposition(var aMessage: TMessage);`
This item has no description.

| `procedure DoOnIMECancelComposition; virtual;`
This item has no description.

| `procedure DoOnIMECommitText(const aText : ustring; const replacement_range : PCefRange; relative_cursor_pos : integer); virtual;`
This item has no description.

| `procedure DoOnIMESetComposition(const aText : ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : TCefRange); virtual;`
This item has no description.

| `constructor Create(AOwner: TComponent); override;`
This item has no description.

| `destructor Destroy; override;`
This item has no description.

| `procedure AfterConstruction; override;`
This item has no description.

| `function SaveToFile(const aFilename : string) : boolean;`
Save the visible web contents as a bitmap file.

| `function InvalidatePanel: boolean;`
Invalidate this panel.

| `function BeginBufferDraw: boolean;`
Acquires the synchronization object before drawing into the background bitmap.

| `procedure EndBufferDraw;`
Releases the synchronization object after drawing into the background bitmap.

| `procedure BufferDraw(x, y : integer; const aBitmap : TBitmap); overload;`
Draws aBitmap into the background bitmap buffer at the specified coordinates. ###### Parameters x x coordinate where the bitmap will be drawn. y y coordinate where the bitmap will be drawn. aBitmap Bitmap that will be drawn into the background bitmap.

| `procedure BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect); overload;`
Draws a part of aBitmap into the background bitmap buffer at the specified rectangle. ###### Parameters aBitmap Bitmap that will be drawn into the background bitmap. aSrcRect Rectangle that defines the area of aBitmap that will be drawn into the background bitmap. aDstRect Rectangle that defines the area of the background bitmap where aBitmap will be drawn.

| `function UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;`
Update the background bitmap size.

| `function UpdateOrigBufferDimensions(aWidth, aHeight : integer) : boolean;`
Update the image size of the original buffer copy.

| `function UpdateOrigPopupBufferDimensions(aWidth, aHeight : integer) : boolean;`
Update the popup image size of the original buffer copy.

| `procedure UpdateDeviceScaleFactor;`
Update the FDeviceScaleFactor value with the current scale.

| `function BufferIsResized(aUseMutex : boolean = True) : boolean;`
Check if the background image buffers have the same dimensions as this panel. Returns true if they have the same size.

| `procedure CreateIMEHandler;`
Creates the IME handler.

| `procedure ChangeCompositionRange(const selection_range : TCefRange; const character_bounds : TCefRectDynArray);`
Calls ChangeCompositionRange in the IME handler.

| `procedure DrawOrigPopupBuffer(const aSrcRect, aDstRect : TRect);`
Copy the contents from the original popup buffer copy to the main buffer copy.

### Properties

| `property ScanlineSize : integer read FScanlineSize;`
Returns the scanline size.

| `property BufferWidth : integer read GetBufferWidth;`
Image width.

| `property BufferHeight : integer read GetBufferHeight;`
Image height.

| `property BufferBits : pointer read GetBufferBits;`
Returns a pointer to the buffer that stores the image.

| `property ScreenScale : single read GetScreenScale;`
Returns the screen scale.

| `property ForcedDeviceScaleFactor : single read FForcedDeviceScaleFactor write FForcedDeviceScaleFactor;`
Screen scale value used instead of the real one.

| `property MustInitBuffer : boolean read FMustInitBuffer write FMustInitBuffer;`
Clear the background image before copying the original buffer contents.

| `property Buffer : TBitmap read FBuffer;`
Background bitmap.

| `property OrigBuffer : TCEFBitmapBitBuffer read FOrigBuffer;`
Copy of the raw main bitmap buffer sent by CEF in the TChromiumCore.OnPaint event. OrigBuffer will be transferred to the bitmap buffer before copying the bitmap buffer to the panel.

| `property OrigBufferWidth : integer read GetOrigBufferWidth;`
Image width of the raw main bitmap buffer copy.

| `property OrigBufferHeight : integer read GetOrigBufferHeight;`
Image height of the raw main bitmap buffer copy.

| `property OrigPopupBuffer : TCEFBitmapBitBuffer read FOrigPopupBuffer;`
Copy of the raw popup bitmap buffer sent by CEF in the TChromiumCore.OnPaint event.

| `property OrigPopupBufferWidth : integer read GetOrigPopupBufferWidth;`
Image width of the raw popup bitmap buffer copy.

| `property OrigPopupBufferHeight : integer read GetOrigPopupBufferHeight;`
Image height of the raw popup bitmap buffer copy.

| `property OrigPopupBufferBits : pointer read GetOrigPopupBufferBits;`
Returns a pointer to the raw popup bitmap buffer copye.

| `property OrigPopupScanlineSize : integer read FOrigPopupScanlineSize;`
Returns the scanline size of the raw popup bitmap buffer copy.

| `property ParentFormHandle : TCefWindowHandle read GetParentFormHandle;`
Returns the handle of the parent form.

| `property ParentForm : TCustomForm read GetParentForm;`
Returns the parent form.

| `property DockManager;`
This item has no description.

| `property Canvas;`
This item has no description.

| `property OnIMECancelComposition : TNotifyEvent read FOnIMECancelComposition write FOnIMECancelComposition;`
Event triggered when a WM_IME_ENDCOMPOSITION message is received because the IME ended composition. <see href="https://learn.microsoft.com/en-us/windows/win32/intl/wm-ime-endcomposition">See the WM_IME_ENDCOMPOSITION article.)

| `property OnIMECommitText : TOnIMECommitTextEvent read FOnIMECommitText write FOnIMECommitText;`
Event triggered when a WM_IME_COMPOSITION message is received because the IME changed composition status as a result of a keystroke. This event is triggered after retrieving a composition result of the ongoing composition if it exists. <see href="https://learn.microsoft.com/en-us/windows/win32/intl/wm-ime-composition">See the WM_IME_COMPOSITION article.)

| `property OnIMESetComposition : TOnIMESetCompositionEvent read FOnIMESetComposition write FOnIMESetComposition;`
Event triggered when a WM_IME_COMPOSITION message is received because the IME changed composition status as a result of a keystroke. This event is triggered after retrieving the current composition status of the ongoing composition. <see href="https://learn.microsoft.com/en-us/windows/win32/intl/wm-ime-composition">See the WM_IME_COMPOSITION article.)

| `property OnCustomTouch : TOnHandledMessageEvent read FOnCustomTouch write FOnCustomTouch;`
Event triggered when a WM_TOUCH message is received. It notifies the window when one or more touch points, such as a finger or pen, touches a touch-sensitive digitizer surface. <see href="https://learn.microsoft.com/en-us/windows/win32/wintouch/wm-touchdown">See the WM_TOUCH article.)

| `property OnPointerDown : TOnHandledMessageEvent read FOnPointerDown write FOnPointerDown;`
Event triggered when a WM_POINTERDOWN message is received. Posted when a pointer makes contact over the client area of a window. <see href="https://learn.microsoft.com/en-us/windows/win32/inputmsg/wm-pointerdown">See the WM_POINTERDOWN article.)

| `property OnPointerUp : TOnHandledMessageEvent read FOnPointerUp write FOnPointerUp;`
Event triggered when a WM_POINTERUP message is received. Posted when a pointer that made contact over the client area of a window breaks contact. <see href="https://learn.microsoft.com/en-us/windows/win32/inputmsg/wm-pointerup">See the WM_POINTERUP article.)

| `property OnPointerUpdate : TOnHandledMessageEvent read FOnPointerUpdate write FOnPointerUpdate;`
Event triggered when a WM_POINTERUPDATE message is received. Posted to provide an update on a pointer that made contact over the client area of a window or on a hovering uncaptured pointer over the client area of a window. <see href="https://learn.microsoft.com/en-us/windows/win32/inputmsg/wm-pointerupdate">See the WM_POINTERUPDATE article.)

| `property OnPaintParentBkg : TNotifyEvent read FOnPaintParentBkg write FOnPaintParentBkg;`
Event triggered before the AlphaBlend call that transfer the web contents from the bitmap buffer to the panel when the Transparent property is True.

| `property Transparent : boolean read FTransparent write SetTransparent default False;`
Set Transparent to True to use a WS_EX_TRANSPARENT window style in the panel and to call AlphaBlend in order to transfer the web contents from the bitmap buffer to the panel. If this property is False then BitBlt is used to transfer the web contents from the bitmap buffer to the panel.

| `property CopyOriginalBuffer : boolean read FCopyOriginalBuffer write FCopyOriginalBuffer default False;`
When CopyOriginalBuffer is True then OrigBuffer will be used internally to copy of the raw main bitmap buffer sent by CEF in the TChromiumCore.OnPaint event. OrigBuffer will be transferred to the bitmap buffer before copying the buffer to the panel. This is necessary in GTK applications in order to avoid handling bitmaps in background threads.

| `property Align;`
This item has no description.

| `property Alignment;`
This item has no description.

| `property Anchors;`
This item has no description.

| `property AutoSize;`
This item has no description.

| `property OnUTF8KeyPress;`
This item has no description.

| `property BevelInner;`
This item has no description.

| `property BevelOuter;`
This item has no description.

| `property BevelWidth;`
This item has no description.

| `property BiDiMode;`
This item has no description.

| `property BorderWidth;`
This item has no description.

| `property BorderStyle;`
This item has no description.

| `property Caption;`
This item has no description.

| `property Color;`
This item has no description.

| `property Constraints;`
This item has no description.

| `property UseDockManager default True;`
This item has no description.

| `property DockSite;`
This item has no description.

| `property DoubleBuffered;`
This item has no description.

| `property DragCursor;`
This item has no description.

| `property DragKind;`
This item has no description.

| `property DragMode;`
This item has no description.

| `property Enabled;`
This item has no description.

| `property FullRepaint;`
This item has no description.

| `property Font;`
This item has no description.

| `property ParentBiDiMode;`
This item has no description.

| `property ParentColor;`
This item has no description.

| `property ParentFont;`
This item has no description.

| `property ParentShowHint;`
This item has no description.

| `property PopupMenu;`
This item has no description.

| `property ShowHint;`
This item has no description.

| `property TabOrder;`
This item has no description.

| `property TabStop;`
This item has no description.

| `property Visible;`
This item has no description.

| `property OnClick;`
This item has no description.

| `property OnConstrainedResize;`
This item has no description.

| `property OnContextPopup;`
This item has no description.

| `property OnDockDrop;`
This item has no description.

| `property OnDockOver;`
This item has no description.

| `property OnDblClick;`
This item has no description.

| `property OnDragDrop;`
This item has no description.

| `property OnDragOver;`
This item has no description.

| `property OnEndDock;`
This item has no description.

| `property OnEndDrag;`
This item has no description.

| `property OnEnter;`
This item has no description.

| `property OnExit;`
This item has no description.

| `property OnGetSiteInfo;`
This item has no description.

| `property OnMouseDown;`
This item has no description.

| `property OnMouseMove;`
This item has no description.

| `property OnMouseUp;`
This item has no description.

| `property OnMouseWheel;`
This item has no description.

| `property OnKeyDown;`
This item has no description.

| `property OnKeyPress;`
This item has no description.

| `property OnKeyUp;`
This item has no description.

| `property OnResize;`
This item has no description.

| `property OnStartDock;`
This item has no description.

| `property OnStartDrag;`
This item has no description.

| `property OnUnDock;`
This item has no description.

| `property OnMouseEnter;`
This item has no description.

| `property OnMouseLeave;`
This item has no description.

Generated by PasDoc 0.16.0-snapshot.