DOM Canvas 개요

황제낙엽 2016.08.22 10:29 조회 수 : 735

Canvas Description

The HTML5 <canvas> tag is used to draw graphics, on the fly, via scripting (usually JavaScript).

However, the <canvas> element has no drawing abilities of its own (it is only a container for graphics) - you must use a script to actually draw the graphics.

The getContext() method returns an object that provides methods and properties for drawing on the canvas.

This reference will cover the properties and methods of the getContext("2d") object, which can be used to draw text, lines, boxes, circles, and more - on the canvas.

 

What is HTML Canvas?

The HTML <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript).

The <canvas> element is only a container for graphics. You must use a script to actually draw the graphics.

Canvas has several methods for drawing paths, boxes, circles, text, and adding images.

 

 

 

 

context = canvas.getContext(contextId [, ... ] )

Returns an object that exposes an API for drawing on the canvas. The first argument specifies the desired API, either "2d", "bitmaprenderer" or "webgl". Subsequent arguments are handled by that API.

This specification defines the "2d" and "bitmaprenderer" contexts below. There is also a specification that defines a "webgl" context. [WEBGL]

Returns null if the given context ID is not supported, if the canvas has already been initialised with the other context type (e.g. trying to get a "2d" context after getting a "webgl" context).

 

reference -> https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-getcontext

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
128 Web Speech API Example (HTML5 STT & TTS) file 황제낙엽 2025.04.14 731
127 모바일과 데스크톱을 포괄하는 사용자의 터치 이벤트(onPointerTap) 황제낙엽 2025.04.09 648
126 Web RTC 에 관하여 황제낙엽 2024.11.20 626
125 div와 span의 차이점 (from Bing) 황제낙엽 2023.06.16 685
124 flexbox (flexible box layout) 황제낙엽 2023.02.27 641
123 characters from ISO 8859-1 황제낙엽 2020.11.10 36946
122 HTML FRAMESET 태그 예제 황제낙엽 2020.11.06 718
121 스마트 기기에서 여러 단말기의 해상도에 대응하기 위해 사용하는 HTML viewport meta tag 황제낙엽 2020.11.06 644
120 네이버의 무료 나눔 글꼴 황제낙엽 2020.05.06 1762
119 서버의 이미지나 txt 파일을 웹브라우저에서 다운로드하기 황제낙엽 2019.05.13 867
118 When to encode space to plus (+) or %20? (application/x-www-form-urlencoded) 황제낙엽 2019.04.15 917
117 HTTP/2 소개 황제낙엽 2018.10.12 693
116 글자, 문자, 텍스트, 글꼴, 서체, 폰트와 관련한 속성들 / font-size , 크기 단위(em, px, pt, rem), 절대 단위, 상대 단위 황제낙엽 2018.04.18 842
115 Pragma와 Cache-Control 황제낙엽 2018.03.28 845
114 로드밸런싱(L4)+아파치를 운영시 etag제거로 캐시 성능 최적화 file 황제낙엽 2018.03.28 944
113 HTTP 요청 헤더 III - If-Match, If-Modified-Since, If-None-Match file 황제낙엽 2018.03.27 726
112 재미난 로그인 페이지 만들기 file 황제낙엽 2018.03.26 1592
111 HTTP Cache-Control 요청 지시어 황제낙엽 2018.03.09 713
110 내 웹사이트의 속도를 빠르게! file 황제낙엽 2018.03.07 859
109 성능을 위한 초간단 HTTP 304 Not Modified 구현 방법 file 황제낙엽 2018.03.07 816