Documentation improvements
This commit is contained in:
@@ -32,6 +32,7 @@ import lime.utils.UInt32Array;
|
||||
@:noDebug
|
||||
#end
|
||||
|
||||
@:dox(hide)
|
||||
@:allow(lime.ui.Window)
|
||||
@:access(lime._internal.backend.native.NativeCFFI)
|
||||
@:access(lime.graphics.opengl)
|
||||
|
||||
@@ -17,6 +17,13 @@ import js.Browser;
|
||||
import flash.display.BitmapData;
|
||||
#end
|
||||
|
||||
|
||||
/**
|
||||
`ImageBuffer` is a simple object for storing image data.
|
||||
|
||||
For higher-level operations, use the `Image` class.
|
||||
**/
|
||||
|
||||
#if !lime_debug
|
||||
@:fileXml('tags="haxe,release"')
|
||||
@:noDebug
|
||||
@@ -32,16 +39,52 @@ import flash.display.BitmapData;
|
||||
class ImageBuffer {
|
||||
|
||||
|
||||
/**
|
||||
The number of bits per pixel in this image data
|
||||
**/
|
||||
public var bitsPerPixel:Int;
|
||||
|
||||
/**
|
||||
The data for this image, represented as a `UInt8Array`
|
||||
**/
|
||||
public var data:UInt8Array;
|
||||
|
||||
/**
|
||||
The `PixelFormat` for this image data
|
||||
**/
|
||||
public var format:PixelFormat;
|
||||
|
||||
/**
|
||||
The height of this image data
|
||||
**/
|
||||
public var height:Int;
|
||||
|
||||
/**
|
||||
Whether the image data has premultiplied alpha
|
||||
**/
|
||||
public var premultiplied:Bool;
|
||||
|
||||
/**
|
||||
The data for this image, represented as a `js.html.CanvasElement`, `js.html.Image` or `flash.display.BitmapData`
|
||||
**/
|
||||
public var src (get, set):Dynamic;
|
||||
|
||||
/**
|
||||
The stride, or number of data values per row in the image data
|
||||
**/
|
||||
public var stride (get, never):Int;
|
||||
|
||||
/**
|
||||
Whether this image data is transparent
|
||||
**/
|
||||
public var transparent:Bool;
|
||||
|
||||
/**
|
||||
The width of this image data
|
||||
**/
|
||||
public var width:Int;
|
||||
|
||||
|
||||
@:noCompletion private var __srcBitmapData:#if flash BitmapData #else Dynamic #end;
|
||||
@:noCompletion private var __srcCanvas:#if (js && html5) CanvasElement #else Dynamic #end;
|
||||
@:noCompletion private var __srcContext:#if (js && html5) CanvasRenderingContext2D #else Dynamic #end;
|
||||
@@ -63,6 +106,14 @@ class ImageBuffer {
|
||||
#end
|
||||
|
||||
|
||||
/**
|
||||
Creates a new `ImageBuffer` instance
|
||||
@param data (Optional) Initial `UInt8Array` data
|
||||
@param width (Optional) An initial `width` value
|
||||
@param height (Optional) An initial `height` value
|
||||
@param bitsPerPixel (Optional) The `bitsPerPixel` of the data (default is 32)
|
||||
@param format (Optional) The `PixelFormat` of this image buffer
|
||||
**/
|
||||
public function new (data:UInt8Array = null, width:Int = 0, height:Int = 0, bitsPerPixel:Int = 32, format:PixelFormat = null) {
|
||||
|
||||
this.data = data;
|
||||
@@ -76,6 +127,13 @@ class ImageBuffer {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Creates a duplicate of this `ImageBuffer`
|
||||
|
||||
If the current `ImageBuffer` has `data` or `src` information, this will be
|
||||
cloned as well.
|
||||
@return A new `ImageBuffer` with duplicate values
|
||||
**/
|
||||
public function clone ():ImageBuffer {
|
||||
|
||||
var buffer = new ImageBuffer (data, width, height, bitsPerPixel);
|
||||
|
||||
@@ -1,9 +1,35 @@
|
||||
package lime.graphics; #if (!lime_doc_gen || lime_opengl || lime_opengles) #if (sys && lime_cffi && lime_opengl && !doc_gen)
|
||||
package lime.graphics; #if (!lime_doc_gen || lime_opengl || lime_opengles) #if (lime_doc_gen || (sys && lime_cffi))
|
||||
|
||||
|
||||
import lime.graphics.opengl.*;
|
||||
|
||||
|
||||
/**
|
||||
The `OpenGLES2RenderContext` allows access to OpenGL ES 2.0 features when OpenGL or
|
||||
OpenGL ES is the render context type of the `Window`.
|
||||
|
||||
Using an OpenGL ES context on a desktop platform enables support for cross-platform
|
||||
code that should run on the majority of desktop and mobile platforms (when using
|
||||
hardware acceleration).
|
||||
|
||||
Platforms supporting an OpenGL ES context are compatible with the Lime
|
||||
`WebGLRenderContext` if you would prefer to write WebGL-style code, or support web
|
||||
browsers with the same code.
|
||||
|
||||
You can convert from `lime.graphics.RenderContext`, `lime.graphics.OpenGLRenderContext`,
|
||||
`lime.graphics.OpenGLES3RenderContext`, `lime.graphics.opengl.GL`, and can convert to
|
||||
`lime.graphics.WebGLRenderContext` directly if desired:
|
||||
|
||||
```
|
||||
var gles2:OpenGLES2RenderContext = window.context;
|
||||
var gles2:OpenGLES2RenderContext = gl;
|
||||
var gles2:OpenGLES2RenderContext = gles3;
|
||||
var gles2:OpenGLES2RenderContext = GL;
|
||||
|
||||
var webgl:WebGLRenderContext = gles2;
|
||||
```
|
||||
**/
|
||||
|
||||
@:forward(ACTIVE_ATTRIBUTES, ACTIVE_TEXTURE, ACTIVE_UNIFORMS, ALIASED_LINE_WIDTH_RANGE,
|
||||
ALIASED_POINT_SIZE_RANGE, ALPHA, ALPHA_BITS, ALWAYS, ARRAY_BUFFER, ARRAY_BUFFER_BINDING,
|
||||
ATTACHED_SHADERS, BACK, BLEND, BLEND_COLOR, BLEND_DST_ALPHA, BLEND_DST_RGB, BLEND_EQUATION,
|
||||
@@ -91,7 +117,7 @@ vertexAttrib3fv, vertexAttrib4f, vertexAttrib4fv, vertexAttribPointer, viewport,
|
||||
EXTENSIONS, type, version)
|
||||
|
||||
|
||||
abstract OpenGLES2RenderContext(OpenGLES3RenderContext) from OpenGLES3RenderContext #if (!lime_doc_gen && lime_opengl) from OpenGLRenderContext #end {
|
||||
abstract OpenGLES2RenderContext(OpenGLES3RenderContext) from OpenGLES3RenderContext #if (!doc_gen && lime_opengl) from OpenGLRenderContext #end {
|
||||
|
||||
|
||||
@:from private static function fromGL (gl:Class<GL>):OpenGLES2RenderContext {
|
||||
@@ -136,7 +162,7 @@ abstract OpenGLES2RenderContext(Dynamic) from Dynamic to Dynamic {
|
||||
}
|
||||
|
||||
|
||||
#if (!lime_doc_gen && lime_opengl)
|
||||
#if (!doc_gen && lime_opengl)
|
||||
@:from private static function fromOpenGLRenderContext (gl:OpenGLRenderContext):OpenGLES2RenderContext {
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package lime.graphics; #if (!lime_doc_gen || lime_opengl || lime_opengles) #if (sys && lime_cffi && lime_opengl && !doc_gen)
|
||||
package lime.graphics; #if (!lime_doc_gen || lime_opengl || lime_opengles) #if (lime_doc_gen || (sys && lime_cffi))
|
||||
|
||||
|
||||
import haxe.Int64;
|
||||
@@ -9,6 +9,37 @@ import lime.utils.DataPointer;
|
||||
import lime.utils.Float32Array;
|
||||
import lime.utils.Int32Array;
|
||||
|
||||
|
||||
/**
|
||||
The `OpenGLES3RenderContext` allows access to OpenGL ES 3.0 features when OpenGL or
|
||||
OpenGL ES is the render context type of the `Window`, and the current context supports
|
||||
GLES3 features.
|
||||
|
||||
Using an OpenGL ES context on a desktop platform enables support for cross-platform
|
||||
code that should run on both desktop and mobile platforms (when using
|
||||
hardware acceleration), though support for OpenGL ES 3.0 features are more limited than
|
||||
GLES2.
|
||||
|
||||
Platforms supporting an OpenGL ES 3.0 context are compatible with the Lime
|
||||
`WebGLRenderContext` as well as the `WebGL2RenderContext` if you would prefer to write
|
||||
WebGL-style code, or support web browsers with the same code. Be aware that not all
|
||||
browsers support WebGL 2, so only plain WebGL might be available.
|
||||
|
||||
You can convert from `lime.graphics.RenderContext`, `lime.graphics.OpenGLRenderContext`,
|
||||
`lime.graphics.opengl.GL`, and can convert to `lime.graphics.OpenGLES2RenderContext`,
|
||||
`lime.graphics.WebGL2RenderContext` or `lime.graphics.WebGLRenderContext` directly
|
||||
if desired:
|
||||
|
||||
```
|
||||
var gles3:OpenGLES3RenderContext = window.context;
|
||||
var gles3:OpenGLES3RenderContext = gl;
|
||||
var gles3:OpenGLES3RenderContext = GL;
|
||||
|
||||
var gles2:OpenGLES2RenderContext = gles3;
|
||||
var webgl2:WebGL2RenderContext = gles3;
|
||||
var webgl:WebGLRenderContext = gles3;
|
||||
**/
|
||||
|
||||
@:forward
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,37 @@
|
||||
package lime.graphics; #if (!lime_doc_gen || lime_opengl) #if (sys && lime_cffi && lime_opengl && !doc_gen)
|
||||
package lime.graphics; #if (!lime_doc_gen || lime_opengl) #if (lime_doc_gen || (sys && lime_cffi))
|
||||
|
||||
|
||||
import lime._internal.backend.native.NativeOpenGLRenderContext;
|
||||
|
||||
|
||||
/**
|
||||
The `OpenGLRenderContext` allows access to OpenGL features when OpenGL is the render
|
||||
context type of the `Window`. Historically, Lime was designed for WebGL render support
|
||||
on all platforms, and support has expanded to provide additional OpenGL ES native APIs.
|
||||
|
||||
Support for desktop OpenGL-specific features is currently sparse, but the
|
||||
`OpenGLRenderContext` provides the platform for us to add additional desktop specific
|
||||
features.
|
||||
|
||||
The `OpenGLRenderContext` is not compatible with mobile or web targets, but it can be
|
||||
converted to an OpenGL ES or a WebGL-style context for cross-platform development.
|
||||
|
||||
You can convert from `lime.graphics.RenderContext` or `lime.graphics.opengl.GL`, and
|
||||
can convert to `lime.graphics.OpenGLES3RenderContext`,
|
||||
`lime.graphics.OpenGLES2RenderContext`, `lime.graphics.WebGL2RenderContext`, or
|
||||
`lime.graphics.WebGLRenderContext` directly if desired:
|
||||
|
||||
```
|
||||
var gl:OpenGLRenderContext = window.context;
|
||||
var gl:OpenGLRenderContext = GL;
|
||||
|
||||
var gles3:OpenGLES3RenderContext = gl;
|
||||
var gles2:OpenGLES2RenderContext = gl;
|
||||
var webgl2:WebGL2RenderContext = gl;
|
||||
var webgl:WebGLRenderContext = gl;
|
||||
```
|
||||
**/
|
||||
|
||||
@:access(lime.graphics.RenderContext)
|
||||
@:forward()
|
||||
|
||||
|
||||
@@ -343,6 +343,30 @@ import lime.utils.Float32Array;
|
||||
import lime.utils.Int32Array;
|
||||
import lime.utils.UInt32Array;
|
||||
|
||||
|
||||
/**
|
||||
The `WebGL2RenderContext` allows access to WebGL 2 features when OpenGL, OpenGL ES
|
||||
or WebGL is the render context type of the `Window`, and the current context supports
|
||||
WebGL 2 features.
|
||||
|
||||
Using a WebGL context on a desktop platform enables support for cross-platform
|
||||
code that should run on all platforms (when using hardware acceleration), though support
|
||||
for WebGL 2 features are more limited than WebGL, and require an OpenGL ES 3.0 compatible
|
||||
desktop or mobile context.
|
||||
|
||||
You can convert from `lime.graphics.RenderContext`, `lime.graphics.OpenGLRenderContext`,
|
||||
`lime.graphics.OpenGLES3RenderContext` or `lime.graphics.opengl.GL`, and can convert to
|
||||
`lime.graphics.WebGLRenderContext` directly if desired:
|
||||
|
||||
```
|
||||
var webgl2:WebGL2RenderContext = window.context;
|
||||
var webgl2:WebGL2RenderContext = gl;
|
||||
var webgl2:WebGL2RenderContext = gles3;
|
||||
var webgl2:WebGL2RenderContext = GL;
|
||||
|
||||
var webgl:WebGLRenderContext = webgl2;
|
||||
**/
|
||||
|
||||
@:access(lime.graphics.RenderContext)
|
||||
|
||||
|
||||
@@ -3200,7 +3224,7 @@ abstract WebGL2RenderContext(Dynamic) from Dynamic to Dynamic {
|
||||
}
|
||||
|
||||
|
||||
#if (!lime_doc_gen && (lime_opengl || lime_opengles))
|
||||
#if (!doc_gen && (lime_opengl || lime_opengles))
|
||||
@:from private static function fromOpenGLES3RenderContext (gl:OpenGLES3RenderContext):WebGL2RenderContext {
|
||||
|
||||
return cast gl;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -650,11 +650,11 @@ class GL {
|
||||
public static inline var TIMEOUT_IGNORED = -1;
|
||||
public static inline var MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247;
|
||||
|
||||
#if (sys && lime_cffi && lime_opengl && !doc_gen)
|
||||
#if lime_opengl
|
||||
public static var context (default, null):OpenGLRenderContext;
|
||||
#elseif mobile
|
||||
public static var context (default, null):OpenGLES2RenderContext;
|
||||
#elseif (js && html5)
|
||||
#elseif lime_opengles
|
||||
public static var context (default, null):OpenGLES3RenderContext;
|
||||
#elseif lime_webgl
|
||||
public static var context (default, null):WebGL2RenderContext;
|
||||
#else
|
||||
public static var context (default, null):Dynamic;
|
||||
|
||||
@@ -10,6 +10,10 @@ import lime.math.Rectangle;
|
||||
import lime.system.Display;
|
||||
import lime.system.DisplayMode;
|
||||
|
||||
#if (js && html5)
|
||||
import js.html.Element;
|
||||
#end
|
||||
|
||||
#if openfl
|
||||
import openfl.display.Stage;
|
||||
#elseif flash
|
||||
@@ -18,10 +22,6 @@ import flash.display.Stage;
|
||||
typedef Stage = Dynamic;
|
||||
#end
|
||||
|
||||
#if (js && html5)
|
||||
import js.html.Element;
|
||||
#end
|
||||
|
||||
#if hl
|
||||
@:keep
|
||||
#end
|
||||
|
||||
Reference in New Issue
Block a user