photo_markup 1.0.2
photo_markup: ^1.0.2 copied to clipboard
Draw boxes, arrows, freehand strokes and text over a photo, read it back as resolution-independent vector data, and flatten it to a JPEG or PNG.
Changelog #
1.0.2 #
Packaging only — no library changes. The public API is byte-for-byte identical to 1.0.1.
analysis_options.yamlnow spells out theanalyzer: exclude:block thatflutter pub get(3.45 and later) otherwise writes into it. The tool rewrote the file in place on every fetch, which left the working tree dirty and madepub publish --dry-runfail with checked-in files are modified in git. Listing the entries keeps that migration from re-arming.- Releases now publish from GitHub Actions on a
v*tag, using pub.dev's OIDC automated publishing rather than a long-lived credential. The tag is verified against the pubspec version and the CHANGELOG before anything is uploaded.
1.0.1 #
Documentation only — no library changes.
- The README screenshot and its links to
example/andLICENSEnow use absolute URLs. pub.dev can only rewrite a relative path once its analysis of a version has run, and until then it drops the image and the links, so 1.0.0 rendered them as bare text.
1.0.0 #
Initial release.
PhotoMarkupEditor— full-screen editor with box, ellipse, arrow, freehand and text tools, pinch-zoom and pan, undo/redo, and a color and stroke-width picker.PhotoMarkupViewer— read-only overlay of aMarkupDocumentover a photo.MarkupEditorController— widget-free editor state with an in-memory undo/redo history, usable on its own.MarkupPainter— the singleCustomPaintershared by the editor, the viewer and the flattener, so all three render identically.MarkupFlattener— composites annotations over the source photo and encodes to JPEG or PNG. Never modifies the original and never upscales. Output is capped atdefaultTargetWidth(2048 px) unless atargetWidthis given — passdouble.infinityfor full source resolution — and JPEG encoding runs on a background isolate so it does not block the UI thread.MarkupCodec— forward-tolerant JSON serialization (v: 1), in both directions. Unknown annotation types, unknown fields and out-of-range values are preserved or clamped instead of throwing, and everything it does not understand is carried through decode (Annotation.extras,MarkupDocument.extras,MarkupDocument.unsupportedItems) and re-emitted in place on encode, so an older build can re-save a newer document losslessly.PhotoMarkupStrings— every user-visible string, overridable for localization.
Annotation coordinates are normalized to 0.0..1.0, and stroke widths and font
sizes are fractions of the image's shorter side, so markup is resolution
independent. Annotation and MarkupDocument are deeply immutable and compare
by value, so hosts can diff them and de-duplicate ValueNotifier updates.
Other correctness notes for this first release:
- The editor holds a clone of the decoded image and disposes only that clone, so annotating a photo that is also on screen elsewhere cannot break the other widget.
- Text labels anchored near an edge slide back inside the canvas instead of wrapping one character per line, and are clipped to the photo's bounds.
MarkupEditorControllercaps undo history at 50 steps (maxHistory).PhotoMarkupViewerhas nofitparameter: the overlay always covers the photo's box, so any other fit would misregister the markup. Wrap the widget in aFittedBoxto scale photo and markup together.
Known limitations #
MarkupTool.selectis declared but not implemented — individual annotations cannot yet be selected, moved, resized or deleted. The only removal action is Clear all.- The web has no isolates, so JPEG encoding runs inline there and a large flatten will still stall the frame.
PhotoMarkupEditortakesinitialAnnotationsrather than a whole document, so a round trip through the editor preserves per-annotation passthrough but not document-level passthrough.