cad-editor/src/io
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Hakan Seven f2ad1cc0c8 feat(thumbnail): on-screen framing + PNG/RLE8 preview, far smaller files
The embedded DWG preview was the whole drawing fit to a canvas, encoded
as a 24-bit uncompressed DIB (~180 KB at 256²) — the bulk of the gap
between an OCS-saved file and AutoCAD's. Three changes:

- Frame it like the screen. `from_scene` now projects every wire vertex
  through the live camera into a viewport-aspect canvas, so the thumbnail
  is the current pan / zoom / rotation and only the visible region, not
  the full extent. Off-screen / clipped segments don't draw (a `None`
  projection or NaN separator breaks the polyline run). Works for any
  view. `stamp_thumbnail` passes the model pane's pixel size and the
  target version.

- PNG for R2013+ (AC1027+). A line drawing on a flat background is almost
  one colour, so PNG collapses to a few KB. PNG previews are only valid
  from R2013, so older targets keep a BMP.

- BMP is now 8-bit palettised, BI_RLE8-compressed (was 24-bit raw). The
  long single-colour runs of a preview compress to a handful of KB; a
  view with >256 colours (rare) falls back to the 24-bit DIB. A full
  256-entry palette is written so the reader's `(1<<bpp)*4` pixel-data
  offset lands correctly.

Net: the preview drops from ~120 KB to ~2-5 KB on every version.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 14:09:38 +03:00
..
file_association.rs fix(linux): set the Wayland window app_id so the dock shows the icon 2026-07-16 10:47:11 +03:00
linetypes.rs fix(linetype): draw embedded shapes without the .shx; fix rotation unit 2026-07-23 07:23:10 +03:00
mod.rs feat(shape): render SHAPE entities from their compiled SHX shape file 2026-07-23 03:53:41 +03:00
obj.rs feat(render): double-single vertices for the mesh pipeline 2026-06-23 18:28:52 +03:00
paper_sizes.rs chore: post-merge cleanup for #287/#289 2026-07-06 01:22:10 +03:00
patterns.rs refactor: move resource/IO root modules under io/ 2026-06-26 23:06:40 +03:00
pdf_export.rs feat(dialogs): reopen file pickers in the last-used directory 2026-07-21 09:27:44 +03:00
plot_style.rs perf(hash): swap std HashMap/HashSet for rustc-hash FxHash 2026-06-05 00:35:53 +03:00
print_to_printer.rs perf(scene): return the memoized wire set by Arc, not by deep copy 2026-07-22 12:56:36 -07:00
single_instance.rs feat(open): open drawings in the running editor 2026-07-15 15:18:16 +03:00
step.rs refactor(scene): group modules into role-based subfolders 2026-06-16 11:33:46 +03:00
stl.rs refactor(scene): group modules into role-based subfolders 2026-06-16 11:33:46 +03:00
thumbnail.rs feat(thumbnail): on-screen framing + PNG/RLE8 preview, far smaller files 2026-07-23 14:09:38 +03:00
update_check.rs refactor: move resource/IO root modules under io/ 2026-06-26 23:06:40 +03:00
xref.rs fix(xref): blocks respect their internal draw order 2026-07-21 15:53:28 +03:00