Skip to main content

Crate fre_sys

Crate fre_sys 

Source
Expand description

§fre-sys

Rust bindings for the AIR Native Extension (ANE) C API (FlashRuntimeExtensions.h).

§Examples

use fre_sys::*;
#[allow(unsafe_op_in_unsafe_fn, non_snake_case, unused_variables)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn Initializer (
    ext_data_to_set: *mut FREData,
    ctx_initializer_to_set: *mut FREContextInitializer,
    ctx_finalizer_to_set: *mut Option<FREContextFinalizer>,
) {
    *ctx_initializer_to_set = ctx_initializer;
}
#[allow(unsafe_op_in_unsafe_fn, unused_variables)]
unsafe extern "C" fn ctx_initializer (
    ext_data: FREData,
    ctx_type: FREStr,
    ctx: FREContext,
    num_funcs_to_set: *mut u32,
    funcs_to_set: *mut *const FRENamedFunction,
) {
    *num_funcs_to_set = 1;
    *funcs_to_set = std::mem::transmute(&FUNC);
}
#[repr(transparent)]
struct Function (FRENamedFunction);
unsafe impl Sync for Function {}
static FUNC: Function = Function(FRENamedFunction {
    name: c"hello_extension".as_ptr() as FREStr,
    functionData: std::ptr::null_mut(),
    function: hello,
});
unsafe extern "C" fn hello(_: FREContext, _: FREData, _: u32, _: *const FREObject) -> FREObject {
    let bytes = "Hello! Flash Runtime.".as_bytes();
    let mut str_obj = std::ptr::null_mut();
    _ = unsafe {FRENewObjectFromUTF8(bytes.len() as u32, bytes.as_ptr(), &mut str_obj)};
    str_obj
}

Structs§

FREBitmapData
A non-owning descriptor for bitmap data.
FREBitmapData2
A non-owning descriptor for bitmap data.
FREByteArray
A non-owning descriptor for bytes.
FRENamedFunction
A non-owning descriptor for a registered native function.
FREObjectType
These values must not be changed.
FRERenderMode
Declared as [uint8_t] instead of the C enum storage type, because the runtime writes only one byte in practice.
FREResult
These values must not be changed.

Functions§

FREAcquireBitmapData
Referenced data is valid only for duration of the call to a registered function.
FREAcquireBitmapData2
Referenced data is valid only for duration of the call to a registered function.
FREAcquireByteArray
Referenced data is valid only for duration of the call to a registered function.
FREAcquireNativeWindowHandle
Referenced handle is valid only for duration of the call to a registered function.
FRECallObjectMethod
Parameters
FREDispatchStatusEventAsync
Causes a StatusEvent to be dispatched from the associated ExtensionContext object.
FREGetArrayElementAt
If an Array is sparse and an element that isn’t defined is requested, the return value will be FREResult::FRE_OK but the handle value will be invalid.
FREGetArrayLength
Returns
FREGetContextAS3Data
Returns
FREGetContextNativeData
Returns
FREGetFREContextFromExtensionContext
Get the FREContext object associated with any ExtensionContext object. Note that the FREContext object may become invalid based on what happens with the other ExtensionContext, so this value should not be cached between function calls.
FREGetNativeContext3DHandle
Access the native context type for a Context3D object. The type depends on the render mode: currently this is only valid for OpenGL ES rendering and will return an EGLContext object. This object should be valid until the Context3D object is disposed, or the device/application loses the graphics context.
FREGetObjectAsBool
Returns
FREGetObjectAsDouble
Returns
FREGetObjectAsInt32
Returns
FREGetObjectAsUTF8
Retrieves a string representation of the object referred to by the given object. The referenced string is immutable and valid only for duration of the call to a registered function. If the caller wishes to keep the string, they must keep a copy of it.
FREGetObjectAsUint32
Returns
FREGetObjectProperty
Parameters
FREGetObjectType
Returns
FREGetRenderMode
Returns the current render mode and mechanism for AIR
FREInvalidateBitmapDataRect
BitmapData must be acquired to call this. Clients must invalidate any region they modify in order to notify AIR of the changes. Only invalidated regions are redrawn.
FREMediaBufferLock
Locks a MediaBuffer bitmap and returns information about the data storage.
FREMediaBufferUnlock
Unlocks a MediaBuffer bitmap.
FRENewByteArray
Creates a new byte array using optional input information (length and optional byte)
FRENewObject
Parameters
FRENewObjectFromBool
Returns
FRENewObjectFromDouble
Returns
FRENewObjectFromInt32
Returns
FRENewObjectFromUTF8
Creates a new String object that contains a copy of the specified string.
FRENewObjectFromUint32
Returns
FREReleaseBitmapData
Release data that has been acquired with an earlier call to FREAcquireBitmapData or FREAcquireBitmapData2
FREReleaseByteArray
Returns
FREReleaseNativeWindowHandle
Returns
FRESetArrayElementAt
Returns
FRESetArrayLength
Returns
FRESetContextAS3Data
Returns
FRESetContextNativeData
Returns
FRESetObjectProperty
Parameters
FRESetRenderSource
Sets a MediaBuffer object as the rendering source for a DisplayObject.
FRETrace
Outputs a trace to the AS3 debugger.

Type Aliases§

FREBoolean
32-bit integer representation of an ActionScript Boolean.
FREBytes
Pointer to a byte buffer.
FREContext
Handle to an extension context managed by the runtime.
FREContextFinalizer
Defines the signature for the finalizer that is called each time an ExtensionContext instance is disposed.
FREContextInitializer
Defines the signature for the initializer that is called each time a new AS3 ExtensionContext object is created.
FREData
Handle to user-defined data owned and managed by extensions.
FREFinalizer
Called iff the extension is unloaded from the process. Extensions are not guaranteed to be unloaded; the runtime process may exit without doing so.
FREFunction
Defines the signature for native calls that can be invoked via an instance of the AS3 ExtensionContext class.
FREHandle
Opaque pointer to an unspecified data type.
FREInitializer
The initialization function provided by each extension must conform to the following signature.
FRENativeWindow
Handle to a native window; the underlying type is platform-specific.
FREObject
Handle to an AS3 object.
FREStr
Borrowed pointer to UTF-8 string.