1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 et tw=78: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_ImageData_h
8 #define mozilla_dom_ImageData_h
10 #include "nsIDOMCanvasRenderingContext2D.h"
12 #include "mozilla/Attributes.h"
15 #include "nsCycleCollectionParticipant.h"
16 #include "nsTraceRefcnt.h"
22 class ImageData MOZ_FINAL
: public nsISupports
25 ImageData(uint32_t aWidth
, uint32_t aHeight
, JSObject
& aData
)
30 MOZ_COUNT_CTOR(ImageData
);
36 MOZ_COUNT_DTOR(ImageData
);
40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
41 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ImageData
)
43 uint32_t Width() const
47 uint32_t Height() const
51 JSObject
* Data(JSContext
* cx
) const
53 return GetDataObject();
55 JSObject
* GetDataObject() const
57 JS::ExposeObjectToActiveJS(mData
);
61 JSObject
* WrapObject(JSContext
* cx
, JS::Handle
<JSObject
*> scope
);
67 ImageData() MOZ_DELETE
;
69 uint32_t mWidth
, mHeight
;
70 JS::Heap
<JSObject
*> mData
;
74 } // namespace mozilla
76 #endif // mozilla_dom_ImageData_h