// Copyright © 2018 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Windows.Controls;
using CefSharp.Structs;
namespace CefSharp.Wpf
{
///
/// Implement this interface to handle Offscreen Rendering (OSR).
/// NOTE: Currently only OnPaint is implemented, at some point expand the API to include all
/// of CefRenderHandler methods http://magpcss.org/ceforum/apidocs3/projects/(default)/CefRenderHandler.html
///
public interface IRenderHandler : IDisposable
{
///
/// Called when an element has been rendered to the shared texture handle.
/// This method is only called when is set to true
///
/// indicates whether the element is the view or the popup widget.
/// contains the set of rectangles in pixel coordinates that need to be repainted
/// is the handle for a D3D11 Texture2D that can be accessed via ID3D11Device using the OpenSharedResource method.
void OnAcceleratedPaint(bool isPopup, Rect dirtyRect, IntPtr sharedHandle);
///
/// Called when an element should be painted. (Invoked from CefRenderHandler.OnPaint)
/// This method is only called when is set to false.
///
/// indicates whether the element is the view or the popup widget.
/// contains the set of rectangles in pixel coordinates that need to be repainted
/// The bitmap will be will be width * height *4 bytes in size and represents a BGRA image with an upper-left origin
/// width
/// height
/// image used as parent for rendered bitmap
void OnPaint(bool isPopup, Rect dirtyRect, IntPtr buffer, int width, int height, Image image);
}
}