|
@@ -0,0 +1,71 @@
|
|
1
|
+function getFore(foreground){
|
|
2
|
+ var foreground = foreground.value;
|
|
3
|
+ var source = 'images/' + foreground;
|
|
4
|
+ document.getElementById("fore").innerHTML = foreground;
|
|
5
|
+ document.getElementById("msi-fore").src = source;
|
|
6
|
+}
|
|
7
|
+
|
|
8
|
+function getBack(background){
|
|
9
|
+ var background = background.value;
|
|
10
|
+ var source = '\'url(images/' + background + ")\'";
|
|
11
|
+ document.getElementById("back").innerHTML = source;
|
|
12
|
+ document.getElementById("1").style.backgroundImage = "url('back.png')";
|
|
13
|
+
|
|
14
|
+}
|
|
15
|
+
|
|
16
|
+$(document).ready(function() {
|
|
17
|
+ $("img").mousemove(function(event) {
|
|
18
|
+ var x = event.pageX - this.offsetLeft;
|
|
19
|
+ var y = event.pageY - this.offsetTop;
|
|
20
|
+ //alert("X Coordinate: " + x + " Y Coordinate: " + y);
|
|
21
|
+ var circle = 20*20*3.14;
|
|
22
|
+ $('div.movestatus').text(circle);
|
|
23
|
+ x += " " + y;
|
|
24
|
+ $('div.back').text(x);
|
|
25
|
+ });
|
|
26
|
+});
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+function edit(){
|
|
31
|
+// var c = document.getElementById("myCanvas");
|
|
32
|
+// var ctx = c.getContext("2d");
|
|
33
|
+// var img = document.getElementById("msi-fore");
|
|
34
|
+// ctx.drawImage(img, 0, 0);
|
|
35
|
+// var imgData = ctx.getImageData(0, 0, c.width, c.height);
|
|
36
|
+// // invert colors
|
|
37
|
+// var i;
|
|
38
|
+// for (i = 0; i < imgData.data.length; i += 4){
|
|
39
|
+// document.getElementById("dimensions").innerHTML = i;
|
|
40
|
+// if(i == x){
|
|
41
|
+// imgData.data[i+3] = 0;
|
|
42
|
+// }
|
|
43
|
+// }
|
|
44
|
+// ctx.putImageData(imgData, 0, 0);
|
|
45
|
+// };
|
|
46
|
+
|
|
47
|
+// A. Buscar mejorar la extraccion de coordenadas de x y y.
|
|
48
|
+// B. Carcular cada esquina del circulo
|
|
49
|
+// C. dibujar la imagen
|
|
50
|
+
|
|
51
|
+ var c = document.getElementById("myCanvas");
|
|
52
|
+ var ctx = c.getContext("2d");
|
|
53
|
+ var img = document.getElementById("msi-fore");
|
|
54
|
+ ctx.drawImage(img, 0, 0);
|
|
55
|
+ var imgData = ctx.getImageData(60, 60, 200, 200);
|
|
56
|
+ // invert colors
|
|
57
|
+ var i;
|
|
58
|
+ for (i = 0; i < imgData.data.length; i += 4){
|
|
59
|
+
|
|
60
|
+ if(i > 150000){
|
|
61
|
+ imgData.data[i+3] = 60;}
|
|
62
|
+
|
|
63
|
+ }
|
|
64
|
+ document.getElementById("dimensions").innerHTML = i;
|
|
65
|
+ ctx.putImageData(imgData, 60, 60);
|
|
66
|
+};
|
|
67
|
+
|
|
68
|
+function clean(){
|
|
69
|
+ document.getElementById("myCanvas").innerHTML = "<canvas></canvas>";
|
|
70
|
+}
|
|
71
|
+
|