API  1.0.0
CABackingStore.j
Go to the documentation of this file.
1 /*
2  * CABackingStore.j
3  * AppKit
4  *
5  * Created by Francisco Tolmasky.
6  * Copyright 2008, 280 North, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
24 #define PIXEL(pixels) pixels + "px";
25 
26 
27 function CABackingStoreGetContext(aBackingStore)
28 {
29  return aBackingStore.context;
30 };
31 
33 {
34 
35 CABackingStoreCreate = function()
36 {
37  var DOMElement = document.createElement("canvas");
38 
39  DOMElement.style.position = "absolute";
40 
41  // FIXME: Consolidate drawImage to support this.
42  return { context:DOMElement.getContext("2d"), buffer:DOMElement, _image:DOMElement };
43 };
44 
45 CABackingStoreSetSize = function(aBackingStore, aSize)
46 {
47  var buffer = aBackingStore.buffer;
48 
49  buffer.width = aSize.width;
50  buffer.height = aSize.height;
51  buffer.style.width = PIXEL(aSize.width);
52  buffer.style.height = PIXEL(aSize.height);
53 };
54 
55 }
56 else
57 {
58 
59 CABackingStoreCreate = function()
60 {
61  var context = CGBitmapGraphicsContextCreate();
62 
63  context.buffer = "";
64 
65  return { context:context };
66 };
67 
68 CABackingStoreSetSize = function(aBackingStore, aSize)
69 {
70 };
71 
72 }
CABackingStoreSetSize
function CPFeatureIsCompatible(aFeature)
function CABackingStoreGetContext(aBackingStore)
CPHTMLCanvasFeature
#define PIXEL(pixels)
function CGBitmapGraphicsContextCreate()
Definition: CGContext.j:136