提交 ad5e8783 编写于 作者: I Ian Hickson

more dart:ui dartdocs

上级 9255c950
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/// Built-in types and core primitives for a Flutter application.
///
/// This library exposes the lowest-level services that Flutter frameworks use
/// to bootstrap applications, such as methods to obtain handles for the mojo
/// IPC system, classes for driving the graphics and text layout and rendering
/// subsystems, callbacks for integrating with the engine scheduler and the
/// pointer input system, and functions for image decoding.
library dart_ui; library dart_ui;
import 'dart:async'; import 'dart:async';
......
...@@ -4,21 +4,36 @@ ...@@ -4,21 +4,36 @@
part of dart_ui; part of dart_ui;
/// Opaque handle to raw decoded image data (pixels).
///
/// To obtain an Image object, use the [decodeImageFromDataPipe] or
/// [decodeImageFromList] functions.
///
/// To draw an Image, use one of the methods on the [Canvas] class, such as
/// [drawImage].
abstract class Image extends NativeFieldWrapperClass2 { abstract class Image extends NativeFieldWrapperClass2 {
/// The number of image pixels along the image's horizontal axis.
int get width native "Image_width"; int get width native "Image_width";
/// The number of image pixels along the image's vertical axis.
int get height native "Image_height"; int get height native "Image_height";
/// Release the resources used by this object. The object is no longer usable
/// after this method is called.
void dispose() native "Image_dispose"; void dispose() native "Image_dispose";
String toString() => '[$width\u00D7$height]'; String toString() => '[$width\u00D7$height]';
} }
typedef void _ImageDecoderCallback(Image result); /// Callback signature for [decodeImageFromDataPipe] and [decodeImageFromList].
typedef void ImageDecoderCallback(Image result);
void decodeImageFromDataPipe(int handle, _ImageDecoderCallback callback) /// Convert an image file from a mojo pipe into an [Image] object.
void decodeImageFromDataPipe(int handle, ImageDecoderCallback callback)
native "decodeImageFromDataPipe"; native "decodeImageFromDataPipe";
void decodeImageFromList(Uint8List list, _ImageDecoderCallback callback) /// Convert an image file from a byte array into an [Image] object.
void decodeImageFromList(Uint8List list, ImageDecoderCallback callback)
native "decodeImageFromList"; native "decodeImageFromList";
class Path extends NativeFieldWrapperClass2 { class Path extends NativeFieldWrapperClass2 {
...@@ -335,6 +350,8 @@ abstract class Picture extends NativeFieldWrapperClass2 { ...@@ -335,6 +350,8 @@ abstract class Picture extends NativeFieldWrapperClass2 {
/// canvas the option of just taking a ref. /// canvas the option of just taking a ref.
void playback(Canvas canvas) native "Picture_playback"; void playback(Canvas canvas) native "Picture_playback";
/// Release the resources used by this object. The object is no longer usable
/// after this method is called.
void dispose() native "Picture_dispose"; void dispose() native "Picture_dispose";
} }
......
...@@ -4,10 +4,17 @@ ...@@ -4,10 +4,17 @@
part of dart_ui; part of dart_ui;
/// Signature of callbacks that have no arguments and return no data.
typedef void VoidCallback(); typedef void VoidCallback();
typedef void _FrameCallback(Duration duration);
typedef void _PointerPacketCallback(ByteData serializedPacket); /// Signature for [Window.onBeginFrame].
typedef void _AppLifecycleStateCallback(AppLifecycleState state); typedef void FrameCallback(Duration duration);
/// Signature for [Window.onPointerPacket].
typedef void PointerPacketCallback(ByteData serializedPacket);
/// Signature for [Window.onAppLifecycleStateChanged].
typedef void AppLifecycleStateCallback(AppLifecycleState state);
/// States that an application can be in. /// States that an application can be in.
/// ///
...@@ -103,19 +110,19 @@ class Window { ...@@ -103,19 +110,19 @@ class Window {
/// A callback that is invoked when there is a transition in the application's /// A callback that is invoked when there is a transition in the application's
/// lifecycle (such as pausing or resuming). /// lifecycle (such as pausing or resuming).
_AppLifecycleStateCallback onAppLifecycleStateChanged; AppLifecycleStateCallback onAppLifecycleStateChanged;
/// A callback that is invoked to notify the application that it is an /// A callback that is invoked to notify the application that it is an
/// appropriate time to provide a scene using the [SceneBuilder] API and the /// appropriate time to provide a scene using the [SceneBuilder] API and the
/// [render()] method. When possible, this is driven by the hardware VSync /// [render()] method. When possible, this is driven by the hardware VSync
/// signal. This is only called if [scheduleFrame()] has been called since the /// signal. This is only called if [scheduleFrame()] has been called since the
/// last time this callback was invoked. /// last time this callback was invoked.
_FrameCallback onBeginFrame; FrameCallback onBeginFrame;
/// A callback that is invoked when pointer data is available. The data is /// A callback that is invoked when pointer data is available. The data is
/// provided in the form of a raw byte stream containing an encoded mojo /// provided in the form of a raw byte stream containing an encoded mojo
/// PointerPacket. /// PointerPacket.
_PointerPacketCallback onPointerPacket; PointerPacketCallback onPointerPacket;
/// The route or path that the operating system requested when the application /// The route or path that the operating system requested when the application
/// was launched. /// was launched.
...@@ -140,5 +147,7 @@ class Window { ...@@ -140,5 +147,7 @@ class Window {
void flushRealTimeEvents() native "Scheduler_FlushRealTimeEvents"; void flushRealTimeEvents() native "Scheduler_FlushRealTimeEvents";
} }
/// The [Window] singleton. /// The [Window] singleton. This object exposes the size of the display, the
/// core scheduler API, the input event callback, the graphics drawing API, and
/// other such core services.
final Window window = new Window._(); final Window window = new Window._();
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册