ISurface InterfaceAwesomium.NET 1.7.6Awesomium.NET
This interface can be used to provide your own surface implementation and directly handle paint and pixel-scroll events for an IWebView instance.

Namespace: Awesomium.Core
Assembly: Awesomium.Core (in Awesomium.Core.dll) Version: 1.7.6.0
Syntax

public interface ISurface : IDisposable

The ISurface type exposes the following members.

Methods

  NameDescription
Public methodInitialize
Called when the size of the view has changed and the surface needs to be re-initialized.
Public methodPaint
This method is called whenever the IWebView instance this surface is assigned to, wants to paint a certain section of the Surface with a block of pixels. It is your responsibility to copy srcBuffer to the location in this Surface specified by destRect.
Public methodScroll
This method is called whenever the IWebView instance this surface is assigned to, wants to 'scroll' an existing section of the Surface by a certain offset. It your responsibility to translate the pixels within the specified clipping rectangle (clipRect) by the specified offset.
Top
Remarks

Awesomium.NET provides the Surface base class that implements ISurface. In most scenarios, deriving Surface is the suggested way for defining your own surface. Implementing ISurface is useful when you want to implement your surface in a class already deriving another class. What's more, Awesomium.NET already provides predefined surface implementations for most technologies.

Here's a list of predefined surfaces available with Awesomium.NET:

TechnologyType
CoreBitmapSurface
WPFImageSurface
WPFWebViewPresenter
Windows FormsImageSurface
Windows FormsControlSurface
To specify your own surface implementation (either this is an ISurface implementation or a Surface subclass), you need to do any of the following:
  • Assign your surface instance to Surface. The instance assigned, should be able to handle changes in size. In particular, Initialize(IWebView, Int32, Int32) is called every time the size of the view changes.
  • Handle the CreateSurface event and assign your surface to Surface, whenever the event occurs. The event occurs every time the size of the view changes. You can assign the same surface every time, or a new one (if your ISurface implementation cannot handle resizing. All classes deriving Surface that are available with Awesomium.NET, can handle changes in size). Each time CreateSurface occurs, Surface returns the surface previously assigned to the view either through Surface or in an earlier handling of this event, or the default surface for the view if none was previously specified. So even if you do not set Surface when CreateSurface occurs, the view will keep using any previously assigned surface.
Note Note
Surfaces are destroyed either manually when they are not needed or internally, when assigned to a view, when the view they are assigned to, is destroyed.
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Reference