@winput/overlay
v1.0.15
Published
Windows overlay drawing for Bun - create transparent overlays and draw on screen
Maintainers
Readme
@winput/overlay 🎨
Transparent overlay window for on-screen drawing.
Requirements
- OS: Windows 64-bit
- Runtime: Bun (npm not supported)
Installation
bun add @winput/overlayUsage
import { overlay, Pen, PenStyle } from "@winput/overlay";
overlay.show();
const pen = overlay.createPen({ color: { r: 255, g: 0, b: 0 }, width: 3 });
pen.drawLine(100, 100, 500, 100);
pen.drawRect(100, 200, 400, 300);
pen.drawFilledEllipse(300, 400, 100, 80);
overlay.update();
overlay.destroy();API
overlay
| Method | Params | Returns | Description |
| ------------------------------------- | ---------------------------------------------------------------- | ----------------------- | ----------------- |
| show(options?) | OverlayOptions | void | Show overlay |
| hide() | - | void | Hide overlay |
| clear() | - | void | Clear drawings |
| update() | - | void | Process messages |
| destroy() | - | void | Cleanup resources |
| createPen(options, overlayOptions?) | PenOptions, OverlayOptions | Pen | Create pen |
| getWindow() | - | OverlayWindow \| null | Get window |
| isInitialized() | - | boolean | Check init state |
Pen
All methods return Pen for chaining.
| Method | Params | Returns | Description |
| ------------------------------- | ------------------ | ----------------- | ----------------- |
| move(x, y) | number, number | Pen | Move position |
| down() | - | Pen | Start drawing |
| up() | - | Pen | Stop drawing |
| lineTo(x, y) | number, number | Pen | Line to point |
| drawLine(x1, y1, x2, y2) | number×4 | Pen | Draw line |
| drawRect(x, y, w, h) | number×4 | Pen | Rectangle outline |
| drawEllipse(x, y, w, h) | number×4 | Pen | Ellipse outline |
| drawFilledRect(x, y, w, h) | number×4 | Pen | Filled rectangle |
| drawFilledEllipse(x, y, w, h) | number×4 | Pen | Filled ellipse |
| setColor(color) | RGB | Pen | Set RGB color |
| setWidth(width) | number | Pen | Set line width |
| getPosition() | - | Point | Get position |
| destroy() | - | void | Cleanup |
Types
PenOptions
{
color: RGB;
width?: number; // Default: 1
style?: PenStyle; // Default: SOLID
}OverlayOptions
{
transparent?: boolean;
clickThrough?: boolean;
}RGB
{
r: number;
g: number;
b: number;
}Point
{
x: number;
y: number;
}PenStyle
enum PenStyle {
SOLID = 0,
DASH = 1,
DOT = 2,
DASHDOT = 3,
DASHDOTDOT = 4,
}Exports
| Export | Type | Description |
| ---------- | ----------------------- | ------------------ |
| overlay | Overlay | Singleton instance |
| Pen | Pen | Pen class |
| PenStyle | PenStyle | Line styles |
