TBD

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