Namespace

Runtime\PS\GD

Package gd implements PHP's image functions over the standard library's image packages and golang.org/x/image.

Description

Package gd implements PHP's image functions over the standard library's image packages and golang.org/x/image.

The surface is the one a ported image class actually calls: decode, create, resample, draw, write. Not every one of ext/gd, and not everything ext/gd would let you register: a binding is here because something needs it, and the text family is absent because nothing did.

This package registers imagetypes and never omits it, because ported code branches on it, but one decoder set sits behind it and it always reports the same three formats.

image.Decode reads whichever formats the process registered, and the registration is an init: png and jpeg arrive with the encoders this package calls by name, and gif has nothing here to reach for. A program decides what it links and the phpscript main package names all three and a host embedding this one answers imagecreatefromgif() once it does the same.

A GD image reaches a script as a *Image, the way fopen returns a stream. A colour reaches it as an int packed the way libgd packs one, 0xAARRGGBB with alpha in the top byte and a script holds a colour in a variable and passes it to any drawing call.

Package
stdlib/ps/gdgodoc