2008/04/11 13:04
2008/04/11 13:04 2008/04/11 13:04
Jacob Seidelin은 <canvas> 객체를 여러 파일로 저장 할 수 있는 라이브러리를 공개하였습니다.

사용자 삽입 이미지

  1. /*
  2. * Canvas2Image.saveAsXXXX = function(oCanvasElement, bReturnImgElement, iWidth, iHeight) { ... }
  3. */
  4.  
  5. var oCanvas = document.getElementById("thecanvas");
  6.  
  7. Canvas2Image.saveAsPNG(oCanvas)// will prompt the user to save the image as PNG.
  8.  
  9. Canvas2Image.saveAsJPEG(oCanvas); // will prompt the user to save the image as JPEG.
  10.                                   // Only supported by Firefox.
  11.  
  12. Canvas2Image.saveAsBMP(oCanvas)// will prompt the user to save the image as BMP.
  13.  
  14.  
  15. // returns an <img /> element containing the converted PNG image
  16. var oImgPNG = Canvas2Image.saveAsPNG(oCanvas, true);   
  17.  
  18. // returns an <img /> element containing the converted JPEG image (Only supported by Firefox)
  19. var oImgJPEG = Canvas2Image.saveAsJPEG(oCanvas, true);
  20.                                                        
  21. // returns an <img /> element containing the converted BMP image
  22. var oImgBMP = Canvas2Image.saveAsBMP(oCanvas, true);
  23.  
  24.  
  25. // all the functions also takes width and height arguments.
  26. // These can be used to scale the resulting image:
  27.  
  28. // saves a PNG image scaled to 100x100
  29. Canvas2Image.saveAsPNG(oCanvas, false, 100, 100);
canvas 객체이기에 당연히 IE 6,7에서는 안됩니다;
 
데모는 여기서 확인하실수 있습니다. http://www.nihilogic.dk/labs/canvas2image/
이올린에 북마크하기(0) 이올린에 추천하기(0)
Trackback Address :: http://blog.phpdic.com/trackback/27
Tracked from 시리니 | 2008/05/02 22:54 | DEL
제목이 거 참 구수하군요. (이 숨길 수 없는 사투리 본능이란... 훗. -_ㅠ) &amp;nbsp; Internet Explorer 에서는 절대로 가능하지 않거나, 혹은 일부만 지원 되는 것. 그리고 IE 를 제외한 나머지 최신의 브라우저에서는 대게의 경우 잘 지원하는 것. 이렇게 말씀드리면 열 손가락이 부족할 정도로 많다고 하실지 모르겠습니다. ^^;;; 오늘은 그 중 하나인 Canvas 에 대해서 한 번 같이 알아보고자 합니다. &amp;nb...
[로그인][오픈아이디란?]
Name
Password
Homepage

Secret
◀  *    1   ...   2    3    4    5    6    7    8    9    10   ...   30    *  ▶