gre.set layer attrs


Set properties for a layer instance associated with a particular screen.   The layer_name specifies either the fully qualified name of a layer instance using the ScreenName.LayerName naming convention or, if only the layer name is specified, the name will refer to a layer instance associated with the current screen

       x, y, width, height, alpha, hidden, xoffset, yoffset, scroll_enabled, geometry, effect

The scroll enablement value can only be set if the layer had scrolling enabled in Designer.

Parameters: layer_name The model full path of the layer to change properties on tag_table A table with tags as the keys and the new values stored as the table's key values Example:

function set_layer_hidden()
    local data = {}
    data.hidden = 1
    gre.set_layer_attrs("my_layer", data)

Render Effects

The attribute contains a table with the name and attributes for the specific render effect being applied. Currently the following effects are defined:

blur, geometry


This effect will add a blur to the contents of the layer. The following blur attributes are defined:

Parameters: passes This is a number value which is the number of blur passes composite This is a boolean value. When true the blur will be applied to the final composition of this layer with the framebuffer content. If false the blur is only applied to the layer content. radius This is a number value which defined the radius of the blur effect in pixels Example:

function cbBlurEffect(mapargs)
    local attrs = {}
    local effect = {}

    effect["name"] = "blur"
    effect["passes"] = 2
    effect["radius"] = 1
    effect["composite"] = false
    attrs["effect"] = effect

This effect will allow custom OpenGL ES geometry to be applied to the rendering of the control or layer. This includes custom vertices and UV coordinates. The following attributes are defined:

Parameters: width The viewport width for the content height The viewport height for the content type The type of primitive to render: fan | triangles nvert The number of vertex coordinates. Options are 2 (x,y) and 3 (x, y, z) nuv The number of UV coordinates. Options are 2 or 0 data The table containing the vertex data Example:

function cbSetGeometry(mapargs)
    local gdata = {}
    local dz = 0.0
    local offset = mapargs.offset
    local dz2 = -offset
    local w
    local h = 240

    dz2 = -offset
    w = 320 - offset
    gdata = {
      {x=w/2, y=h/2, z=dz2, u=0.5, v=0.5},

      {x=w, y=0, z=dz, u=1.0, v=0},
      {x=w/2, y=0, z=dz2, u=0.5, v=0},
      {x=0, y=0, z=dz, u=0, v=0},

      {x=0, y=h, z=dz, u=0, v=1.0},
      {x=w/2, y=h, z=dz2, u=0.5, v=1.0},
      {x=w, y=h, z=dz, u=1.0, v=1.0},

      {x=w, y=0, z=dz, u=1.0, v=0},

    local attrs = {}
    attrs["geometry"] = {
        width = w,
        height = h,
        type = "fan",
        nvert = 3,
        nuv = 2,
        data = gdata
Was this article helpful?
0 out of 0 found this helpful