2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Vladimir Vukicevic <vladimir@pobox.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsICanvasElement_h___
|
|
|
|
#define nsICanvasElement_h___
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2009-06-17 13:31:18 -07:00
|
|
|
#include "gfxPattern.h"
|
2007-08-06 13:13:19 -07:00
|
|
|
|
2007-09-25 13:46:08 -07:00
|
|
|
class gfxContext;
|
2007-08-06 13:13:19 -07:00
|
|
|
class nsIFrame;
|
2009-04-08 13:27:20 -07:00
|
|
|
struct gfxRect;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-17 13:31:18 -07:00
|
|
|
// {D31B3CCF-DDA3-49a8-AEF6-B95AF8E09159}
|
2007-03-22 10:30:00 -07:00
|
|
|
#define NS_ICANVASELEMENT_IID \
|
2009-06-17 13:31:18 -07:00
|
|
|
{ 0xd31b3ccf, 0xdda3, 0x49a8, { 0xae, 0xf6, 0xb9, 0x5a, 0xf8, 0xe0, 0x91, 0x59 } }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIRenderingContext;
|
|
|
|
|
2008-04-30 10:04:46 -07:00
|
|
|
class nsICanvasRenderingContextInternal;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
struct _cairo_surface;
|
|
|
|
|
|
|
|
class nsICanvasElement : public nsISupports {
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANVASELEMENT_IID)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ask the canvas Element to return the primary frame, if any
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetPrimaryCanvasFrame (nsIFrame **aFrame) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the size in pixels of this canvas element
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetSize (PRUint32 *width, PRUint32 *height) = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the canvas element to tell the contexts to render themselves
|
2007-09-25 13:46:08 -07:00
|
|
|
* to the given gfxContext at the origin of its coordinate space.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-06-17 13:31:18 -07:00
|
|
|
NS_IMETHOD RenderContexts (gfxContext *ctx, gfxPattern::GraphicsFilter aFilter) = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether the canvas is write-only.
|
|
|
|
*/
|
|
|
|
virtual PRBool IsWriteOnly() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force the canvas to be write-only.
|
|
|
|
*/
|
|
|
|
virtual void SetWriteOnly() = 0;
|
2007-09-25 13:46:08 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the canvas frame to invalidate itself
|
|
|
|
*/
|
|
|
|
NS_IMETHOD InvalidateFrame () = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ask the canvas frame to invalidate a portion of the frame; damageRect
|
2009-04-08 13:27:20 -07:00
|
|
|
* is relative to the origin of the canvas frame in CSS pixels.
|
2007-09-25 13:46:08 -07:00
|
|
|
*/
|
2009-04-08 13:27:20 -07:00
|
|
|
NS_IMETHOD InvalidateFrameSubrect (const gfxRect& damageRect) = 0;
|
2008-04-30 10:04:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the number of contexts in this canvas, and request a context at
|
|
|
|
* an index.
|
|
|
|
*/
|
|
|
|
virtual PRInt32 CountContexts () = 0;
|
|
|
|
virtual nsICanvasRenderingContextInternal *GetContextAtIndex (PRInt32 index) = 0;
|
2009-03-05 05:43:45 -08:00
|
|
|
|
|
|
|
virtual PRBool GetIsOpaque() = 0;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsICanvasElement, NS_ICANVASELEMENT_IID)
|
|
|
|
|
|
|
|
#endif /* nsICanvasElement_h___ */
|