* ps: add a write feature for PostScript tokens
Numbers, strings, matrices, path data and Flate, so apps can emit a
PostScript or EPS program without owning the token serializer. Path and
paint operators can use the Language Reference names or the one-letter
names a bound prolog defines. Container concerns stay in craft-eps.
Part of #778 and #790.
* ps: tighten write-feature number trimming and Flate bounds
- Require flate2 1.1.10 so inflate rejects an incomplete zlib stream.
- Trim trailing zeros only when the token has a decimal point, so
places=0 keeps integer zeros at the 1e15 boundary.
- Use saturating_add when bounding inflate, so max = u64::MAX does not
overflow.
mjpeg::Decoder called craft_jpeg::decode with no Adobe transform, so a
packet with numeric component ids and APP14 transform 0 (RGB as stored)
was converted as YCbCr and came out in the wrong colours. The decoder
now reads the transform with craft_jpeg::adobe_transform, as the JPEG
image readers do. A regression test injects APP14 transforms 0 and 1;
it fails without the fix.
* svg: let SvgWriter name the encoding and write a DOCTYPE subset
VectorCraft's SVG document wrapper needs a Latin-1 declaration and a
<!DOCTYPE svg [ <!ENTITY …> ]> internal subset, including a minified
form with no extra newlines. The existing declaration was UTF-8 only,
and craft-xml's doctype helper writes only <!DOCTYPE name>.
Part of #778 and #789.
* svg: expose SvgWriter::as_str for a second pass on open markup
A consumer that rewrites character references or hashes the document
around a metadata element needs the text of an unclosed root. finish()
would close it first.
The geometry reader (craft_svg::paths) is the only part of the crate that
needs vectorcraft-geom and vectorcraft-pathops, and the tree is the only part
that needs craft-image-codecs. Both are now optional: paths is a default
feature and tree turns it on, so existing users build the same crate, while
an app that only needs SVG text, guards, path data, colours and the writer can
turn default features off and take no app crates or image codecs.
parse_color_alpha is parse_color keeping the alpha of #rgba, #rrggbbaa and
the fourth value of rgb()/hsl(). parse_color now calls it and still drops it.
Refs #778, #789
* feat: add craft-mcp-server (JSON-RPC 2.0 MCP protocol)
Port from solidcraft: MCP server machinery any app may share,
independent of transport and tools.
- JSON-RPC 2.0 over stdio (newline-delimited)
- MCP lifecycle: initialize, initialized, ping, notifications
- Tools: register, list, call with schema validation
- Resources: register, list, get by URI or template
- Prompts: register, list, get with argument completion
- Content blocks: text, image (base64), progress tokens
No external dependencies beyond serde_json.
Follows craft-libs safety pattern: #![deny(clippy::unwrap_used, ...)]
* retrigger CI
* retrigger CI
* Record MCP server dependencies in workspace lockfile
* chore: update rustls-webpki 0.103.15→0.103.16 and zip 9.1.0→9.1.3
A BMP stores its resolution in biXPelsPerMeter and biYPelsPerMeter
(BITMAPINFOHEADER and later). The image crate writes 0 there and nothing
read the fields, so a 300 ppi image saved as BMP reopened at 72 ppi and an
opened BMP's resolution was lost (storytold/photocraft#13630).
decode now reads the fields into Metadata::dpi, encode writes
Metadata::dpi into them whatever embed_metadata says, and
caps(Format::Bmp).dpi is true. encode_bmp_indexed_with_dpi is the palette
writer with a resolution; encode_bmp_indexed keeps its signature and output.
- unpack: checked sample, row-bit and output products, capped at MAX_SAMPLES before allocating
- every chunk is charged what its decoder may allocate (lossless: coded rows + 1/8; lossy: the
32-pixel MCU-padded tile) against the aggregate budget before decoding, the lossless decoder
is held to that, and truncated capacity is released
- the lossy encoded-size floor allows 64 x spp samples per two-bit block (chroma subsampling)
A behind-text shape's fallback `z-index` was the negated `z`, which
reverses the order of overlapping behind-text shapes. It is now `z`
shifted below zero within signed 32-bit range, so a higher `z` still
stacks higher; other shapes' `z-index` is capped at `i32::MAX`.
A part shorter than its compression's scan-line group (a one-row ZIP16 part) only decodes its
own rows, so the all-channel block bound is min(scan_lines_per_block, layer_h) rows.
Removes the duplicated Timecode type and BCD decoder (Sonar duplication 28%) and the copied
frame-rate plausibility check; capture_info is tested against the full reader's CinemaTags.
A shape guarded by `mc:AlternateContent` with no fallback is skipped by
a reader that doesn't know `wps`, and dropped on that reader's next save:
worse than refusing the file. Such shapes are written bare again; only
shapes with a VML form are guarded.
The VML fallback also keeps the shape's own stacking order (a floating
object in its text box moved `self.z` on), its wrap distances, its hidden
flag and its text box's text direction.
One opcode-list envelope implementation: opcode_raw::Records walks the records (stopping at a
truncated one) for both the strict opcode_raw::parse and the typed opcodes::parse_list, and
opcodes::write_list encodes through opcode_raw::encode instead of truncating lengths with as.
An Exif signature inside a COM segment was taken for the EXIF APP1, and the copy was checked
only against the end of the file, so a replacement longer than the APP1 overwrote the next
marker. Walk the header segments to the first EXIF APP1 and copy only within its declared length.
- uncompressed rows go through crate::unpack (read_u16s / unpack_msb), as in dng.rs
- lossy JPEG tiles (34892) use tiffraw::lossy_jpeg_with_tile (zune-jpeg) with its tile-size checks
- line-dng now implies dng instead of pulling in image
- tests: every layout and compression read against the full reader, refusals, unpack depths