-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfillpattern.js-e
More file actions
50 lines (39 loc) · 1005 Bytes
/
fillpattern.js-e
File metadata and controls
50 lines (39 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## Copyright (c) 2015, Empirical Modelling Group
## All rights reserved.
##
## See LICENSE.txt
##Taints the canvas if the file is located on another domain.
${{
FillPattern = function (url) {
this.image = new Image();
this.canvasesToRepaint = {};
this.loaded = false;
var me = this;
this.image.onload = function(){
me.loaded = true;
for (var viewName in me.canvasesToRepaint) {
edenUI.plugins.Canvas2D.drawPicture(viewName);
}
}
this.image.src = url;
};
}}$;
/**
* Create FillPattern object based on an image
* @param url URL of the image
*/
func FillPattern {
${{
return new FillPattern(arguments[0]);
}}$;
}
${{
FillPattern.prototype = new EdenUI.plugins.Canvas2D.FillStyle();
FillPattern.prototype.getColour = function (context) {
return context.createPattern(this.image, 'repeat');
}
FillPattern.prototype.toString = function() {
return "FillPattern(\"" + this.image.src + "\")";
}
FillPattern.prototype.getEdenCode = FillPattern.prototype.toString;
}}$;