Skip to content

roScreen.GetByteArray() returns Invalid on real hardware, but real pixel data on the Simulator/brs-node #1229

Description

@markwpearce

Summary

Calling GetByteArray() on a real roScreen object (not an roBitmap) returns Invalid on real Roku hardware, instead of an roByteArray. The identical call, on the identical code path, returns real pixel data on both the BrightScript Simulator (desktop app) and headless brs-node/brs-cli.

Reproduction

screen = CreateObject("roScreen", true, 1280, 720)
screen.SetAlphaEnable(true)
' ... draw something opaque, e.g. screen.DrawRect(300, 150, 320, 320, &h00FF00FF) ...
pixel = screen.GetByteArray(460, 310, 1, 1) ' a point known to be inside the drawn rect
' pixel is a real roByteArray with RGBA bytes on the Simulator/brs-node.
' pixel is Invalid on real hardware - indexing it (pixel[1]) crashes with
' "Array operation attempted on variable not DIM'd."

Isolated by

  • roBitmap.GetByteArray() is unaffected on either platform - confirmed via this repo's own Rooibos test suite, which uses it routinely on roBitmap instances.
  • The difference is specific to calling GetByteArray() on a live roScreen.

Environment

  • Real hardware: standard Roku device (Roku OS 15.3.4).
  • Simulator comparison: BrightScript Simulator desktop app (brs-desktop) and headless brs-node/brs-cli, same Roku OS version reported, same channel package.

Found while building a diagnostic test in an open-source game engine (https://github.com/markwpearce/brighterscript-game-engine) - happy to share the exact test source or more detail if useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions