fix(bridge): decode item and land art without GDI+ (#39, 2 of 2)

On a Linux/Mono shard the Asset Bridge's item and land art failed: the vendored
Art.LoadStatic/LoadLand build a 16bpp Bitmap (Settings.PixelFormat) and
libgdiplus 6.1 cannot create one, so every static and land picture threw
[GDI+ NotImplemented] before a pixel was read. PR 1 moved the body catalogue off
System.Drawing; this finishes the migration for the art plane, so Windows and
Linux now share one managed path and the whole Asset Bridge needs no libgdiplus.

- BridgeArtMul: a hand-written art.mul static + land decoder to ARGB1555,
  mirroring Art.LoadStatic's run loop and LoadLand's 44x44 diamond, with the
  record/canvas bounds the vendored writers lack (no System.Drawing, no Bitmap).
- BridgeArt: Render now decodes through BridgeArtMul and hues through BridgeHue
  (over hues.mul + the tiledata PartialHue flag) into BridgePng, via a shared
  TryArtPixels helper the parity harness drives. The GDI+ Bitmap/ApplyTo/dispose
  path, the imaging gate, and the Files.CacheData re-check in TryHue are gone,
  because a key now decodes its own fresh buffer that nothing else aliases.
- BridgeAssets: retire BitmapToPng (its last caller) and the imaging probe/field
  machinery; assets.sources no longer carries an imaging field. No decode goes
  through System.Drawing any more, so the NO_IMAGING refusal is retired with the
  GDI+ it guarded. Files.CacheData stays off, now only so the parity oracle's
  vendored decode hands back fresh bitmaps.
- BridgeArtParity: a [BridgeArtParity] GM command / BRIDGE_ART_PARITY=1 boot run
  that compares the managed decode+hue against the vendored one pixel for pixel.

Overlay-only; no wire change beyond the retired imaging field, no PROTOCOL_VERSION
bump. The website tolerates the field's absence (its NO_IMAGING branch is guarded
by `sources.imaging &&`); the dead NO_IMAGING UI/model in module-uo and the
installer doctor libgdiplus row are removed in a tracked follow-up.

Verified on this machine. Windows (vendored GDI+ oracle available): the parity
harness compared every served picture and every one is pixel-identical to the
vendored decode — 43,433/43,433 (39,189 statics + 4,244 land) with no hue, then
39,189/39,189 again hued in each item's PartialHue mode, 0 mismatched. On WSL2
Ubuntu 24.04 / Mono 6.8 / libgdiplus 6.1 (the live-host match) the vendored
oracle threw NotImplemented and the managed path produced all 43,433 + 39,189.
dotnet build 0/0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HJEmcaKvWQ8LsnXHKha5y
This commit is contained in:
2026-11-26 02:13:59 -06:00
parent db87b20fae
commit cac66a6b83
5 changed files with 888 additions and 284 deletions

View File

@@ -147,7 +147,19 @@ namespace Server.Custom.Bridge
}
catch (NotImplementedException)
{
// libgdiplus cannot create/lock the 16bpp bitmap — the #39 condition itself.
// libgdiplus 6.1 cannot create/lock the 16bpp bitmap — the #39 condition itself.
available = false;
return false;
}
catch (DllNotFoundException)
{
// No libgdiplus at all on this host: System.Drawing cannot run. Oracle unavailable.
available = false;
return false;
}
catch (TypeInitializationException)
{
// The System.Drawing static ctor failed (usually wrapping the DllNotFoundException).
available = false;
return false;
}
@@ -174,7 +186,7 @@ namespace Server.Custom.Bridge
/// <summary>
/// Reads a 16bpp ARGB1555 bitmap into a <c>ushort[]</c> with <c>Marshal.Copy</c> — no
/// <c>unsafe</c> block, exactly as <c>BridgeAssets.BitmapToPng</c> reads its source.
/// <c>unsafe</c> block, the same read <see cref="BridgeArtParity"/> makes of its oracle.
/// </summary>
private static ushort[] ToArgb1555(Bitmap bmp)
{