Class: GL2D

Mobizen.Device.Screen.GL2D

new Mobizen.Device.Screen.GL2D(canvas)

Name Type Description
canvas Mobizen.Device.Screen.View#canvas

Members

effect string

Type Definitions

canvas Mobizen.Device.Screen.View#canvas Mobizen.Device.Screen.View#_canvas

gl WebGLContext

Get A WebGL context

kernels kernels

Define several convolution kernels

Properties:
Name Type Description
normal array

matrix

gaussianBlur array

matrix

gaussianBlur2 array

matrix

gaussianBlur3 array

matrix

unsharpen array

matrix

sharpness array

matrix

sharpen array

matrix

edgeDetect array

matrix

edgeDetect2 array

matrix

edgeDetect3 array

matrix

edgeDetect4 array

matrix

edgeDetect5 array

matrix

edgeDetect6 array

matrix

sobelHorizontal array

matrix

sobelVertical array

matrix

previtHorizontal array

matrix

previtVertical array

matrix

boxBlur array

matrix

triangleBlur array

matrix

emboss array

matrix

Methods

drawImage(image, x, y, width, height)

Name Type Description
image HTMLElement
x number
y number
width number
height number

getImageData(x, y, width, height){object}

Name Type Description
x number
y number
width number
height number
Returns:
Type Description
object raw image data

putImageData(image, x, y)

Name Type Description
image HTMLElement
x number
y number

resizeCanvas(effect){boolean}

Name Type Description
effect string
Returns:
Type Description
boolean

virtual scale(x, y)

Name Type Description
x number
y number

inner create3DContext(canvas){WebGLContext}

Creates a webgl context.

Name Type Description
canvas Canvas

The canvas tag to get context from. If one is not passed in one will be created.

Returns:
Type Description
WebGLContext The created context.

inner createShaderScript(gl, script){WebGLShader}

Loads a shader from a script.

Name Type Description
gl WebGLContext

The WebGLContext to use.

script string

id The id of the script object.

Throws:
Will throw an error if the id argument is not accepted.
Returns:
Type Description
WebGLShader The created shader.

inner createTexture(gl)

Name Type Description
gl WebGLContext

inner getWebGLContext(canvas){WebGLRenderingContext}

Creates a webgl context. If creation fails it will change the contents of the container of the <canvas> tag to an error message with the correct links for WebGL.

Name Type Description
canvas HTMLElement

The canvas element to create a context from.

Throws:
Will throw an error if the browser is not suport WebGL.
Returns:
Type Description
WebGLRenderingContext The created context.

inner loadProgram(gl, shaders){program}

Creates a program, attaches shaders, binds attrib locations, links the program and calls useProgram.

Name Type Description
gl WebGLContext

The WebGLContext to use.

shaders !Array.<!WebGLShader>

0 The shaders to attach

Throws:
Will throw an error if the program is not linked.
Returns:
Type Description
program

inner loadShader(gl, shader, shader){WebGLShader}

Loads a shader.

Name Type Description
gl WebGLContext

The WebGLContext to use.

shader string

source The shader source.

shader number

type The type of shader.

Throws:
Will throw an error if the shader is not compiled.
Returns:
Type Description
WebGLShader The created shader.

inner setupProgram(gl, canvas, effect){object}

Name Type Description
gl WebGLContext
canvas HTMLElement
effect string
Returns:
Type Description
object program
comments powered by Disqus