Gjsify LogoGjsify Logo

A pixel buffer suitable for serialization and streaming.

Using GdkPixdata, images can be compiled into an application, making it unnecessary to refer to external image files at runtime.

GdkPixbuf includes a utility named gdk-pixbuf-csource, which can be used to convert image files into GdkPixdata structures suitable for inclusion in C sources. To convert the GdkPixdata structures back into a GdkPixbuf, use gdk_pixbuf_from_pixdata().

record

Hierarchy

  • Pixdata

Index

Constructors

Properties

height: number

Height of the image in pixels

field
length: number

less than 1 to disable length checks, otherwise GDK_PIXDATA_HEADER_LENGTH plus the length of pixel_data

field
magic: number

magic number. A valid GdkPixdata structure must have GDK_PIXBUF_MAGIC_NUMBER here

field
pixdataType: number

information about colorspace, sample width and encoding, in a GdkPixdataType

field
pixelData: Uint8Array

width x height pixels, encoded according to pixdata_type and rowstride

field
rowstride: number

Distance in bytes between rows

field
width: number

Width of the image in pixels

field
name: string

Methods

  • deserialize(stream: Uint8Array): boolean
  • Deserializes (reconstruct) a #GdkPixdata structure from a byte stream.

    The byte stream consists of a straightforward writeout of the GdkPixdata fields in network byte order, plus the pixel_data bytes the structure points to.

    The pixdata contents are reconstructed byte by byte and are checked for validity.

    This function may fail with GDK_PIXBUF_ERROR_CORRUPT_IMAGE or GDK_PIXBUF_ERROR_UNKNOWN_TYPE.

    Parameters

    • stream: Uint8Array

      stream of bytes containing a serialized #GdkPixdata structure.

    Returns boolean

  • serialize(): Uint8Array
  • Serializes a #GdkPixdata structure into a byte stream. The byte stream consists of a straightforward writeout of the #GdkPixdata fields in network byte order, plus the pixel_data bytes the structure points to.

    Returns Uint8Array

  • Generates C source code suitable for compiling images directly into programs.

    GdkPixbuf ships with a program called gdk-pixbuf-csource, which offers a command line interface to this function.

    Parameters

    • name: string

      used for naming generated data structures or macros

    • dumpType: PixdataDumpType

      the kind of C source to be generated

    Returns GLib.String

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method