RokDock includes a built-in 9-patch image editor for creating and editing stretchable .9.png assets used in Roku SceneGraph development.
The 9-Patch Editor: shape canvas with zone guides (center), property panels (left), and live 1080p/720p previews (right).
A 9-patch (or nine-patch) is a PNG image with a 1-pixel border that defines stretchable regions and content padding. Roku SceneGraph uses 9-patch images for scalable UI elements like buttons, frames, and dialog backgrounds. The border pixels encode which parts of the image stretch and where content sits.
Open from Tools > 9-Patch Editor in the menu bar. The editor opens in a separate window. It also opens on its own outside the dock, via its installer shortcut or with RokDock --tool ninepatch [path]. There is no file association for 9-patch images: open the editor first, then import the image. See Launching Tools Directly.
The editor uses a three-panel layout:
- Left panel (240px): Shape and zone configuration with collapsible sections
- Center: Editor viewport with canvas, zoom controls, and pixel inspector
- Right panel: Live 1080p and 720p previews with export buttons
- New (
Ctrl+N): creates a new blank 9-patch with default rectangle shape (120x60px) - Import (
Ctrl+O): loads a PNG/JPEG image or existing.9.pngfile - Undo (
Ctrl+Z): reverts last change - Redo (
Ctrl+YorCtrl+Shift+Z): reapplies last undone change - Filename: displays the imported filename (right side of toolbar)
All sections are collapsible. Numeric inputs show 720p equivalents below each value.
Controls the base shape when creating from scratch. When editing an imported image, these controls are disabled (dimmed) but remain visible.
- Type: Rectangle or Ellipse
- Width: 4-2,000px (slider range 4-800)
- Height: 4-2,000px (slider range 4-800)
- Radius: 0-500px (slider range 0-400) - hidden for Ellipse
- Padding: 0-200px (slider range 0-100) - outer padding around the shape
Toggle on/off to enable or disable fill.
- Color: color picker (default: white
#FFFFFF) - Opacity: 0-100% (default: 100%)
Collapsed by default. Toggle on/off.
- Color: color picker (default: black
#000000) - Opacity: 0-100% (default: 100%)
- Width: 0-100px (slider range 0-50)
Collapsed by default. Toggle on/off.
- Color: color picker (default: black
#000000) - Opacity: 0-100% (default: 50%)
- X Offset: -200 to +200px (slider -100 to +100, default: 0px)
- Y Offset: -200 to +200px (slider -100 to +100, default: 4px)
- Blur: 0-200px (slider 0-100, default: 8px)
Define stretch and padding zones for the 9-patch image.
Auto-detect button: analyzes the image to automatically generate zones.
- For rectangles and rounded rectangles in shape mode: calculates zones analytically from the shape geometry and shadow envelope.
- For ellipses in shape mode and for all imported images: scans opaque pixels to find the widest fully-opaque row/column spans.
Stretch X / Stretch Y zones (add/remove dynamically):
- Each zone has Start and End values (range sliders plus number inputs)
- Minimum 1px between start and end
- Add button creates a new zone at approximately 50% of the dimension
Padding X / Padding Y:
- Start and End values define the content padding region
All zone inputs support mouse wheel adjustment (+/-1 per notch, +/-10 with Shift held).
- Checkerboard transparency background
- Pixel-perfect rendering at current zoom level
- Click-and-drag to pan when zoomed in
When guides are visible:
- Stretch zones: colored dashed lines with circular drag handles (green, cyan, orange, pink cycle)
- Padding zones: blue dashed lines with drag handles
- Drag handles to adjust zone boundaries in real-time
- Cursor changes to
ew-resize(horizontal) orns-resize(vertical) over handles
Floating dock at bottom center:
- Zoom pill: displays current percentage
- Zoom slider: 10-1000% range
- 1:1 button: resets to 100% and centers canvas
- Fit to window: calculates optimal zoom with margin
- Show/Hide guides: toggles zone overlay visibility
Ctrl + mouse wheelzooms in/out (~15% per step, multiplicative)- Snaps to 100% when within +/-3%
Appears in the zoom dock when hovering over the canvas:
- Shows pixel coordinates (X, Y)
- Displays RGBA values
- Color swatch preview
Before any asset is loaded, the viewport shows: "No Asset Loaded" with hint text "Adjust shape parameters in the left panel, or import an existing image."
The preview panel header contains two toggles:
- Art: shows or hides fake poster art inside the frame preview to simulate content behind a frame asset.
- Dark / Light: toggles the preview background between dark and light.
- Export button: exports the 1080p file only. To export both resolutions at once, use
Ctrl+Sor File > Export 9-Patch (see Export) - Button preview: 189x45px stretched sample with placeholder label
- Frame preview: 147x221px stretched sample with optional poster art
- Export button: exports the 720p file only (opens a separate save dialog)
- Button preview: 126x30px (2/3 scale)
- Frame preview: 98x147px (2/3 scale)
- All zone coordinates automatically scaled by 2/3
Previews update in real-time as zones are edited. A red warning appears if the target preview size is smaller than the image's minimum stretchable size.
- Accepts PNG, JPG, and JPEG files
.9.pngfiles: automatically detects and populates stretch and padding zones from the 9-patch border markers, then strips the 1px border for editing- Regular images: zones start empty; use auto-detect or add manually
Paired export (Ctrl+S, or File > Export 9-Patch): opens a single Save dialog defaulting to {basename}_fhd.9.png. After you confirm the 1080p filename, the 720p file is saved automatically alongside it with _fhd replaced by _hd in the filename. You are not prompted a second time.
Single-resolution export: the 1080p export button saves only the 1080p file (defaulting to {basename}_fhd.9.png), and the 720p export button saves only the 720p file (defaulting to {basename}_hd.9.png). Each opens its own Save dialog.
Both variants:
- Strip any existing
_fhdor_hdsuffix from the source filename before building the default name. - Add a standard 9-patch 1px border with zone markers:
- Top edge: horizontal stretch (stretch X) markers
- Left edge: vertical stretch (stretch Y) markers
- Bottom edge: horizontal content (padding) markers
- Right edge: vertical content (padding) markers
All changes are tracked: shape parameters, fill/border/shadow toggles, zone edits, auto-detect operations, and imports. History is capped at 100 steps per session. History resets on New.
Right-click in the editor for:
- Import Image...
- Export 9-Patch...
- Undo (
Ctrl+Z) - Redo (
Ctrl+Y)
| Shortcut | Action |
|---|---|
Ctrl+N |
New |
Ctrl+O |
Import image |
Ctrl+S |
Export (paired 1080p + 720p) |
Ctrl+Z |
Undo |
Ctrl+Y / Ctrl+Shift+Z |
Redo |
Ctrl + scroll |
Zoom in/out |
All pixel values in the left panel display their 720p equivalent below the input, calculated as round(value * 2/3). This helps you design for both resolutions simultaneously.
The editor follows the app's current light/dark theme mode.
- Settings - general app configuration
- Keyboard Shortcuts - full shortcut reference