Skip to content

Improve drawing logic and add docs for onyx-sdk#279

Merged
Ethran merged 9 commits into
mainfrom
dev
Jun 30, 2026
Merged

Improve drawing logic and add docs for onyx-sdk#279
Ethran merged 9 commits into
mainfrom
dev

Conversation

@Ethran

@Ethran Ethran commented Jun 29, 2026

Copy link
Copy Markdown
Owner

No description provided.

Ethran added 9 commits June 29, 2026 21:18
### Drawing & Core
- **NeoFountainPenV2Wrapper**:
    - Replaced manual pen lifecycle and drawing calls with `NeoPenRender` to ensure strokes match the firmware's live rendering.
    - Switched to `FountainShapes.createNeoPenV2` for pen creation to include necessary width compensation, smoothing, and fast-mode configurations.
    - Updated `drawStroke` to use the SDK's full render pipeline, fixing an issue where the trailing "prediction" segment of a stroke was omitted.
    - Introduced `copyAndNormalizePressure` to prevent mutating the caller's `TouchPoint` data, avoiding cumulative pressure degradation on redraws.

### Documentation
- **onyx-neo-fountain-pen-v2.md**: Added a detailed technical guide explaining the Onyx pen SDK rendering pipeline, decompiled insights, and the requirements for pixel-identical offline redraws.
### Drawing & Core
- **NeoFountainPenV2Wrapper**:
    - Replaced manual pen lifecycle and drawing calls with `NeoPenRender` to ensure strokes match the firmware's live rendering.
    - Switched to `FountainShapes.createNeoPenV2` for pen creation to include necessary width compensation, smoothing, and fast-mode configurations.
    - Updated `drawStroke` to use the SDK's full render pipeline, fixing an issue where the trailing "prediction" segment of a stroke was omitted.
    - Introduced `copyAndNormalizePressure` to prevent mutating the caller's `TouchPoint` data, avoiding cumulative pressure degradation on redraws.

### Documentation
- **onyx-neo-fountain-pen-v2.md**: Added a detailed technical guide explaining the Onyx pen SDK rendering pipeline, decompiled insights, and the requirements for pixel-identical offline redraws.
…ring logic.

### Documentation
- **Pressure & Line Width**: Created `onyx-pressure-sensitivity-and-line-width.md` to map official UI sliders (mm and percentage) to `NeoPenConfig` fields and `EACStrokeStyle` parameters used by the firmware.
- **Fountain V2 & Rendering**:
    - Expanded `onyx-neo-fountain-pen-v2.md` to explain the architectural split between live firmware rendering (via SurfaceFlinger) and offline SDK rendering (in-process).
    - Documented that velocity-modulated pens can use 0-based monotonic timestamps instead of absolute wall-clock time, as the native layer only processes deltas.
- **Finger & Input Handling**:
    - Updated `onyx-finger-scribble.md` with details on `BaseHandler` behavior, where the framework automatically pauses hardware handwriting and forces a repaint upon finger contact.
    - Documented `RawInputReader` internals, including hardware-level erasing flags and the interaction between limit rects and the native input mask.
- **Eraser & System Logic**:
    - Confirmed via `framework.jar` that the system handler early-returns for eraser strokes (style 5), explaining why native eraser paths require specific activation to be visible.
    - Verified the 500ms default repaint latency logic in `BaseHandler` following stylus-up events.
  DeviceCompat.delayBeforeResumingDrawing(isErasing: Boolean = false) now returns 500 ms for erase regardless of device (matching NoteConstant.ERASE_DELAY_RESUME_PEN_TIME), keeping 500 color / 300 mono for normal pen resume.
  Non-erase callers (resetScreenFreeze, etc.) are unchanged.
  Point 2 — serialized post → delay → re-enable (no cross-thread race)
  - CanvasRefreshManager.refreshAfterErase(dirty) runs the whole sequence on one coroutine: isRawDrawingRenderEnabled = false → post the erased bitmap and await it actually landing on the surface (via a CompletableDeferred
  completed in drawCanvasToView's finally) → 500 ms erase settle → isRawDrawingRenderEnabled = true.
  - drawCanvasToView gained an optional onPosted callback to make the post awaitable; awaitDrawCanvasToView wraps it.
  - OnyxInputHandler.onRawErasingList now posts a quick indicator-clear (plain drawCanvasToView, no Jump to bottom (ctrl+End) ↓  the single serialized refreshAfterErase over the union of the indicator track and the erased
@Ethran Ethran merged commit f7e0fa5 into main Jun 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant