@gtkx/cairo 2.0.0-beta.12 → 2.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +27 -6
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +38 -10
- package/dist/context.js.map +1 -1
- package/dist/font-face.d.ts +4 -2
- package/dist/font-face.d.ts.map +1 -1
- package/dist/font-face.js +9 -4
- package/dist/font-face.js.map +1 -1
- package/dist/lib.d.ts +2 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +3 -2
- package/dist/lib.js.map +1 -1
- package/dist/path.d.ts +4 -3
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +8 -4
- package/dist/path.js.map +1 -1
- package/dist/pattern.d.ts +13 -7
- package/dist/pattern.d.ts.map +1 -1
- package/dist/pattern.js +31 -15
- package/dist/pattern.js.map +1 -1
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +14 -10
- package/dist/surface.js.map +1 -1
- package/package.json +3 -3
- package/src/context.ts +44 -12
- package/src/font-face.ts +10 -4
- package/src/lib.ts +4 -1
- package/src/path.ts +10 -4
- package/src/pattern.ts +34 -16
- package/src/surface.ts +17 -10
package/dist/surface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,SAAS,EAET,oBAAoB,EACpB,4BAA4B,EAC5B,SAAS,EACT,CAAC,EACD,UAAU,EAEV,KAAK,GACR,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAA0C,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACH,SAAS,EA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YAAY,OAAgB,EAAE,OAAuB;QACjD,KAAK,EAAE,CAAC;QACR,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,sDAAsD;IACtD,UAAU;QACN,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC5B,+BAA+B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAExE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACpF,CAAC;IAED,0FAA0F;IAC1F,UAAU;QACN,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;QACrC,MAAM,SAAS,GAAG,+BAA+B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAY,CAAC;QAEtF,OAAO,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpD,CAAC;CACJ;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import {\n alloc,\n type ExternalObject,\n getHandle,\n type Handle,\n registerWrapperClass,\n registerWrapperClassResolver,\n setHandle,\n t,\n wrapHandle,\n type WrapperClassResolver,\n write,\n} from \"@gtkx/runtime\";\nimport type { DeviceOffset, DeviceScale, FallbackResolution, InkExtents, RectangleData } from \"./types.js\";\nimport { Context } from \"./context.js\";\nimport { Device } from \"./device.js\";\nimport { type Content, type Format, type Status, SurfaceType } from \"./enums.js\";\nimport { FontOptions } from \"./font-options.js\";\nimport {\n bindCairo,\n type BoundFunction,\n cairoGType,\n DEVICE_T,\n FONT_OPTIONS_T,\n RECTANGLE_T,\n SURFACE_FULL_T,\n SURFACE_T,\n} from \"./lib.js\";\nimport { checkSurface } from \"./status.js\";\n\nconst SURFACE_TYPE = cairoGType(\"cairo_gobject_surface_get_type\");\nconst RECTANGLE_SIZE = 32;\nconst DOUBLE = t.fieldAt(t.float64);\nconst DEVICE_PAIR_ARGS = [SURFACE_T, t.float64, t.float64];\nconst DEVICE_PAIR_OUT_ARGS = [SURFACE_T, t.ref(t.float64), t.ref(t.float64)];\nconst SIMILAR_ARGS = [SURFACE_T, t.int32, t.int32, t.int32];\nconst cairoSurfaceCreateSimilar = bindCairo(\"cairo_surface_create_similar\", SIMILAR_ARGS, SURFACE_FULL_T);\nconst cairoSurfaceCreateSimilarImage = bindCairo(\"cairo_surface_create_similar_image\", SIMILAR_ARGS, SURFACE_FULL_T);\n\nconst cairoSurfaceCreateForRectangle = bindCairo(\n \"cairo_surface_create_for_rectangle\",\n [SURFACE_T, t.float64, t.float64, t.float64, t.float64],\n SURFACE_FULL_T,\n);\n\nconst cairoSurfaceWriteToPng = bindCairo(\"cairo_surface_write_to_png\", [SURFACE_T, t.string(\"borrowed\")], t.int32);\nconst cairoSurfaceStatus = bindCairo(\"cairo_surface_status\", [SURFACE_T], t.int32);\nconst cairoSurfaceFinish = bindCairo(\"cairo_surface_finish\", [SURFACE_T], t.void);\nconst cairoSurfaceFlush = bindCairo(\"cairo_surface_flush\", [SURFACE_T], t.void);\nconst cairoSurfaceGetDevice = bindCairo(\"cairo_surface_get_device\", [SURFACE_T], DEVICE_T);\nconst cairoSurfaceGetFontOptions = bindCairo(\"cairo_surface_get_font_options\", [SURFACE_T, FONT_OPTIONS_T], t.void);\nconst cairoSurfaceGetContent = bindCairo(\"cairo_surface_get_content\", [SURFACE_T], t.int32);\nconst cairoSurfaceMarkDirty = bindCairo(\"cairo_surface_mark_dirty\", [SURFACE_T], t.void);\n\nconst cairoSurfaceMarkDirtyRectangle = bindCairo(\n \"cairo_surface_mark_dirty_rectangle\",\n [SURFACE_T, t.int32, t.int32, t.int32, t.int32],\n t.void,\n);\n\nconst cairoSurfaceSetDeviceOffset = bindCairo(\"cairo_surface_set_device_offset\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceGetDeviceOffset = bindCairo(\"cairo_surface_get_device_offset\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceGetDeviceScale = bindCairo(\"cairo_surface_get_device_scale\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceSetDeviceScale = bindCairo(\"cairo_surface_set_device_scale\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceSetFallbackResolution = bindCairo(\"cairo_surface_set_fallback_resolution\", DEVICE_PAIR_ARGS, t.void);\n\nconst cairoSurfaceGetFallbackResolution = bindCairo(\n \"cairo_surface_get_fallback_resolution\",\n DEVICE_PAIR_OUT_ARGS,\n t.void,\n);\n\nconst cairoSurfaceGetType = bindCairo(\"cairo_surface_get_type\", [SURFACE_T], t.int32);\nconst cairoSurfaceGetReferenceCount = bindCairo(\"cairo_surface_get_reference_count\", [SURFACE_T], t.int32);\nconst cairoSurfaceCopyPage = bindCairo(\"cairo_surface_copy_page\", [SURFACE_T], t.void);\nconst cairoSurfaceShowPage = bindCairo(\"cairo_surface_show_page\", [SURFACE_T], t.void);\nconst cairoSurfaceHasShowTextGlyphs = bindCairo(\"cairo_surface_has_show_text_glyphs\", [SURFACE_T], t.boolean);\n\nconst cairoSurfaceSupportsMimeType = bindCairo(\n \"cairo_surface_supports_mime_type\",\n [SURFACE_T, t.string(\"borrowed\")],\n t.boolean,\n);\n\nconst cairoImageSurfaceCreate = bindCairo(\"cairo_image_surface_create\", [t.int32, t.int32, t.int32], SURFACE_FULL_T);\n\nconst cairoImageSurfaceCreateFromPng = bindCairo(\n \"cairo_image_surface_create_from_png\",\n [t.string(\"borrowed\")],\n SURFACE_FULL_T,\n);\n\nconst cairoImageSurfaceGetWidth = bindCairo(\"cairo_image_surface_get_width\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetHeight = bindCairo(\"cairo_image_surface_get_height\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetFormat = bindCairo(\"cairo_image_surface_get_format\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetStride = bindCairo(\"cairo_image_surface_get_stride\", [SURFACE_T], t.int32);\nconst cairoRecordingSurfaceCreate = bindCairo(\"cairo_recording_surface_create\", [t.int32, RECTANGLE_T], SURFACE_FULL_T);\n\nconst cairoRecordingSurfaceInkExtents = bindCairo(\n \"cairo_recording_surface_ink_extents\",\n [SURFACE_T, t.ref(t.float64), t.ref(t.float64), t.ref(t.float64), t.ref(t.float64)],\n t.void,\n);\n\nconst cairoRecordingSurfaceGetExtents = bindCairo(\n \"cairo_recording_surface_get_extents\",\n [SURFACE_T, RECTANGLE_T],\n t.boolean,\n);\n\nconst wrapSurface = (handle: unknown): Surface => wrapHandle(handle as ExternalObject<Handle>, Surface);\n\nconst readPair = <T>(boundFn: BoundFunction, self: object, build: (first: number, second: number) => T): T => {\n const first = { value: 0 };\n const second = { value: 0 };\n boundFn(getHandle(self), first, second);\n\n return build(first.value, second.value);\n};\n\nconst allocRectangle = (rect: RectangleData): ExternalObject<Handle> => {\n const buffer = alloc(RECTANGLE_SIZE);\n write(buffer, t.float64, 0, rect.x);\n write(buffer, t.float64, 8, rect.y);\n write(buffer, t.float64, 16, rect.width);\n write(buffer, t.float64, 24, rect.height);\n\n return buffer;\n};\n\nconst readRectangle = (buffer: ExternalObject<Handle>): RectangleData => ({\n x: DOUBLE.read(buffer, 0) as number,\n y: DOUBLE.read(buffer, 8) as number,\n width: DOUBLE.read(buffer, 16) as number,\n height: DOUBLE.read(buffer, 24) as number,\n});\n\nconst createRecordingSurface = (content: Content, extents?: RectangleData): ExternalObject<Handle> => {\n const rectangle = extents === undefined ? null : allocRectangle(extents);\n\n return cairoRecordingSurfaceCreate(content, rectangle) as ExternalObject<Handle>;\n};\n\nconst surfaceClassFor: WrapperClassResolver = (handle) => {\n const type = cairoSurfaceGetType(handle) as SurfaceType;\n\n if (type === SurfaceType.IMAGE) {\n return ImageSurface;\n }\n\n if (type === SurfaceType.RECORDING) {\n return RecordingSurface;\n }\n\n return Surface;\n};\n\n/**\n * A cairo surface (`cairo_surface_t`): the target a context draws onto. Surfaces come from the `create*`\n * statics, from `ImageSurface` and `RecordingSurface`, or from GTK, and wrap as the concrete class their\n * backend reports (`instanceof ImageSurface` for an image surface).\n */\nabstract class Surface {\n static {\n registerWrapperClass(this, SURFACE_TYPE);\n registerWrapperClassResolver(this, surfaceClassFor);\n }\n\n /** Creates a surface of the given `content` and size as compatible as possible with `other`. */\n static createSimilar(other: Surface, content: Content, width: number, height: number): Surface {\n const handle = cairoSurfaceCreateSimilar(getHandle(other), content, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(checkSurface(handle));\n }\n\n /** Creates an image surface of the given `format` and size as compatible as possible with `other`. */\n static createSimilarImage(other: Surface, format: Format, width: number, height: number): ImageSurface {\n const handle = cairoSurfaceCreateSimilarImage(\n getHandle(other),\n format,\n width,\n height,\n ) as ExternalObject<Handle>;\n\n return wrapHandle(checkSurface(handle), ImageSurface);\n }\n\n /** Creates a surface that draws onto the given rectangle of `target`. */\n static createForRectangle(target: Surface, x: number, y: number, width: number, height: number): Surface {\n const handle = cairoSurfaceCreateForRectangle(getHandle(target), x, y, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(checkSurface(handle));\n }\n\n /** GType of `CairoSurface`, the boxed type this class is registered under. */\n declare __type__: bigint;\n\n /** Writes the surface to a PNG file at `filename` and returns the resulting status. */\n writeToPng(filename: string): Status {\n return cairoSurfaceWriteToPng(getHandle(this), filename) as Status;\n }\n\n /** Returns the error status of the surface, `Status.SUCCESS` when it is usable. */\n status(): Status {\n return cairoSurfaceStatus(getHandle(this)) as Status;\n }\n\n /** Finishes the surface and drops its backend resources; further drawing reports an error. */\n finish(): void {\n cairoSurfaceFinish(getHandle(this));\n }\n\n /** Performs any pending drawing so the backend storage is up to date. */\n flush(): void {\n cairoSurfaceFlush(getHandle(this));\n }\n\n /** Returns the managed device behind the surface, or null when it has none. */\n getDevice(): Device | null {\n const handle = cairoSurfaceGetDevice(getHandle(this)) as ExternalObject<Handle> | null;\n\n return handle === null ? null : wrapHandle(handle, Device);\n }\n\n /** Returns the font options the surface's backend prefers for rendering text. */\n getFontOptions(): FontOptions {\n const options = FontOptions.create();\n cairoSurfaceGetFontOptions(getHandle(this), getHandle(options));\n\n return options;\n }\n\n /** Returns whether the surface holds color, alpha or both. */\n getContent(): Content {\n return cairoSurfaceGetContent(getHandle(this)) as Content;\n }\n\n /** Tells cairo the surface's storage was modified outside of cairo. */\n markDirty(): void {\n cairoSurfaceMarkDirty(getHandle(this));\n }\n\n /** Tells cairo the given rectangle of the surface's storage was modified outside of cairo. */\n markDirtyRectangle(x: number, y: number, width: number, height: number): void {\n cairoSurfaceMarkDirtyRectangle(getHandle(this), x, y, width, height);\n }\n\n /** Sets the offset added to device coordinates when drawing onto the surface. */\n setDeviceOffset(xOffset: number, yOffset: number): void {\n cairoSurfaceSetDeviceOffset(getHandle(this), xOffset, yOffset);\n }\n\n /** Returns the offset added to device coordinates when drawing onto the surface. */\n getDeviceOffset(): DeviceOffset {\n return readPair(cairoSurfaceGetDeviceOffset, this, (xOffset, yOffset) => ({ xOffset, yOffset }));\n }\n\n /** Returns the scale applied between user and device units. */\n getDeviceScale(): DeviceScale {\n return readPair(cairoSurfaceGetDeviceScale, this, (xScale, yScale) => ({ xScale, yScale }));\n }\n\n /** Sets the scale applied between user and device units. */\n setDeviceScale(xScale: number, yScale: number): void {\n cairoSurfaceSetDeviceScale(getHandle(this), xScale, yScale);\n }\n\n /** Sets the resolution used when vector content has to be rasterized. */\n setFallbackResolution(xPixelsPerInch: number, yPixelsPerInch: number): void {\n cairoSurfaceSetFallbackResolution(getHandle(this), xPixelsPerInch, yPixelsPerInch);\n }\n\n /** Returns the resolution used when vector content has to be rasterized. */\n getFallbackResolution(): FallbackResolution {\n return readPair(cairoSurfaceGetFallbackResolution, this, (xPixelsPerInch, yPixelsPerInch) => ({\n xPixelsPerInch,\n yPixelsPerInch,\n }));\n }\n\n /** Returns the backend type of the surface. */\n getType(): SurfaceType {\n return cairoSurfaceGetType(getHandle(this)) as SurfaceType;\n }\n\n /** Returns the reference count of the surface. */\n getReferenceCount(): number {\n return cairoSurfaceGetReferenceCount(getHandle(this)) as number;\n }\n\n /** Emits the current page and keeps its content for the next one, on paged backends. */\n copyPage(): void {\n cairoSurfaceCopyPage(getHandle(this));\n }\n\n /** Emits the current page and starts a blank one, on paged backends. */\n showPage(): void {\n cairoSurfaceShowPage(getHandle(this));\n }\n\n /** Returns whether the surface supports `Context.showTextGlyphs` natively. */\n hasShowTextGlyphs(): boolean {\n return cairoSurfaceHasShowTextGlyphs(getHandle(this)) as boolean;\n }\n\n /** Returns whether the surface can embed data of the given MIME type. */\n supportsMimeType(mimeType: string): boolean {\n return cairoSurfaceSupportsMimeType(getHandle(this), mimeType) as boolean;\n }\n}\n\n/** A surface backed by an in-memory pixel buffer, the usual target for offscreen drawing. */\nclass ImageSurface extends Surface {\n /** Creates an image surface of the given pixel `format` and size, the same as `new ImageSurface(...)`. */\n static create(format: Format, width: number, height: number): ImageSurface {\n return wrapHandle(checkSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>), this);\n }\n\n /** Loads a PNG file into a new image surface; throws when the file is missing or invalid. */\n static createFromPng(filename: string): ImageSurface {\n return wrapHandle(checkSurface(cairoImageSurfaceCreateFromPng(filename) as ExternalObject<Handle>), this);\n }\n\n /** Creates an image surface of the given pixel `format` and size. */\n constructor(format: Format, width: number, height: number) {\n super();\n setHandle(this, checkSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>));\n }\n\n /** Returns the width of the surface in pixels. */\n getWidth(): number {\n return cairoImageSurfaceGetWidth(getHandle(this)) as number;\n }\n\n /** Returns the height of the surface in pixels. */\n getHeight(): number {\n return cairoImageSurfaceGetHeight(getHandle(this)) as number;\n }\n\n /** Returns the pixel format of the surface. */\n getFormat(): Format {\n return cairoImageSurfaceGetFormat(getHandle(this)) as Format;\n }\n\n /** Returns the number of bytes between the starts of consecutive rows. */\n getStride(): number {\n return cairoImageSurfaceGetStride(getHandle(this)) as number;\n }\n\n /** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */\n getData(): Uint8Array {\n /* TODO: Keep this finished-state check until Cairo stops exposing released image storage.\n * https://github.com/gtkx-org/gtkx/issues/730\n */\n Context.create(this);\n this.flush();\n const totalBytes = this.getStride() * this.getHeight();\n\n if (totalBytes === 0) {\n return new Uint8Array(0);\n }\n\n const getImageData = bindCairo(\n \"cairo_image_surface_get_data\",\n [SURFACE_T],\n t.fixedArray(t.uint8, totalBytes, \"borrowed\", { isBytes: true }),\n );\n\n return getImageData(getHandle(this)) as Uint8Array;\n }\n}\n\n/** A surface that records the drawing operations applied to it, for replaying them onto other surfaces. */\nclass RecordingSurface extends Surface {\n /** Creates a recording surface, the same as `new RecordingSurface(...)`. */\n static create(content: Content, extents?: RectangleData): RecordingSurface {\n return new RecordingSurface(content, extents);\n }\n\n /** Creates a recording surface of the given `content`, bounded to `extents` or unbounded when omitted. */\n constructor(content: Content, extents?: RectangleData) {\n super();\n setHandle(this, checkSurface(createRecordingSurface(content, extents)));\n }\n\n /** Returns the area that has been drawn on so far. */\n inkExtents(): InkExtents {\n const x0 = { value: 0 };\n const y0 = { value: 0 };\n const width = { value: 0 };\n const height = { value: 0 };\n cairoRecordingSurfaceInkExtents(getHandle(this), x0, y0, width, height);\n\n return { x0: x0.value, y0: y0.value, width: width.value, height: height.value };\n }\n\n /** Returns the extents the surface was created with, or null for an unbounded surface. */\n getExtents(): RectangleData | null {\n const buffer = alloc(RECTANGLE_SIZE);\n const isBounded = cairoRecordingSurfaceGetExtents(getHandle(this), buffer) as boolean;\n\n return isBounded ? readRectangle(buffer) : null;\n }\n}\n\nexport { ImageSurface, RecordingSurface, Surface };\n"]}
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,SAAS,EAET,oBAAoB,EACpB,4BAA4B,EAC5B,SAAS,EACT,CAAC,EACD,UAAU,EAEV,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAA0C,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACH,SAAS,EAET,UAAU,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,GACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,YAAY,GAAG,UAAU,CAAC,gCAAgC,CAAC,CAAC;AAClE,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACpC,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AAC3D,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7E,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,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CAAC;QACxB,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC5B,+BAA+B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAExE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACpF,CAAC;IAED,0FAA0F;IAC1F,UAAU;QACN,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;QACrC,MAAM,SAAS,GAAG,+BAA+B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAY,CAAC;QAEtF,OAAO,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpD,CAAC;CACJ;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import {\n alloc,\n type ExternalObject,\n getHandle,\n type Handle,\n registerWrapperClass,\n registerWrapperClassResolver,\n setHandle,\n t,\n wrapHandle,\n type WrapperClassResolver,\n write,\n} from \"@gtkx/runtime\";\nimport { reportExternalMemory } from \"@gtkx/runtime/internal\";\nimport type { DeviceOffset, DeviceScale, FallbackResolution, InkExtents, RectangleData } from \"./types.js\";\nimport { Device } from \"./device.js\";\nimport { type Content, type Format, type Status, SurfaceType } from \"./enums.js\";\nimport { FontOptions } from \"./font-options.js\";\nimport {\n bindCairo,\n type BoundFunction,\n cairoGType,\n DEVICE_T,\n FONT_OPTIONS_T,\n RECTANGLE_T,\n SURFACE_FULL_T,\n SURFACE_T,\n} from \"./lib.js\";\nimport { checkSurface } from \"./status.js\";\n\nconst SURFACE_TYPE = cairoGType(\"cairo_gobject_surface_get_type\");\nconst RECTANGLE_SIZE = 32;\nconst DOUBLE = t.fieldAt(t.float64);\nconst DEVICE_PAIR_ARGS = [SURFACE_T, t.float64, t.float64];\nconst DEVICE_PAIR_OUT_ARGS = [SURFACE_T, t.ref(t.float64), t.ref(t.float64)];\nconst SIMILAR_ARGS = [SURFACE_T, t.int32, t.int32, t.int32];\nconst cairoSurfaceCreateSimilar = bindCairo(\"cairo_surface_create_similar\", SIMILAR_ARGS, SURFACE_FULL_T);\nconst cairoSurfaceCreateSimilarImage = bindCairo(\"cairo_surface_create_similar_image\", SIMILAR_ARGS, SURFACE_FULL_T);\n\nconst cairoSurfaceCreateForRectangle = bindCairo(\n \"cairo_surface_create_for_rectangle\",\n [SURFACE_T, t.float64, t.float64, t.float64, t.float64],\n SURFACE_FULL_T,\n);\n\nconst cairoSurfaceWriteToPng = bindCairo(\"cairo_surface_write_to_png\", [SURFACE_T, t.string(\"borrowed\")], t.int32);\nconst cairoSurfaceStatus = bindCairo(\"cairo_surface_status\", [SURFACE_T], t.int32);\nconst cairoSurfaceFinish = bindCairo(\"cairo_surface_finish\", [SURFACE_T], t.void);\nconst cairoSurfaceFlush = bindCairo(\"cairo_surface_flush\", [SURFACE_T], t.void);\nconst cairoSurfaceGetDevice = bindCairo(\"cairo_surface_get_device\", [SURFACE_T], DEVICE_T);\nconst cairoSurfaceGetFontOptions = bindCairo(\"cairo_surface_get_font_options\", [SURFACE_T, FONT_OPTIONS_T], t.void);\nconst cairoSurfaceGetContent = bindCairo(\"cairo_surface_get_content\", [SURFACE_T], t.int32);\nconst cairoSurfaceMarkDirty = bindCairo(\"cairo_surface_mark_dirty\", [SURFACE_T], t.void);\n\nconst cairoSurfaceMarkDirtyRectangle = bindCairo(\n \"cairo_surface_mark_dirty_rectangle\",\n [SURFACE_T, t.int32, t.int32, t.int32, t.int32],\n t.void,\n);\n\nconst cairoSurfaceSetDeviceOffset = bindCairo(\"cairo_surface_set_device_offset\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceGetDeviceOffset = bindCairo(\"cairo_surface_get_device_offset\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceGetDeviceScale = bindCairo(\"cairo_surface_get_device_scale\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceSetDeviceScale = bindCairo(\"cairo_surface_set_device_scale\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceSetFallbackResolution = bindCairo(\"cairo_surface_set_fallback_resolution\", DEVICE_PAIR_ARGS, t.void);\n\nconst cairoSurfaceGetFallbackResolution = bindCairo(\n \"cairo_surface_get_fallback_resolution\",\n DEVICE_PAIR_OUT_ARGS,\n t.void,\n);\n\nconst cairoSurfaceGetType = bindCairo(\"cairo_surface_get_type\", [SURFACE_T], t.int32);\nconst cairoSurfaceGetReferenceCount = bindCairo(\"cairo_surface_get_reference_count\", [SURFACE_T], t.int32);\nconst cairoSurfaceCopyPage = bindCairo(\"cairo_surface_copy_page\", [SURFACE_T], t.void);\nconst cairoSurfaceShowPage = bindCairo(\"cairo_surface_show_page\", [SURFACE_T], t.void);\nconst cairoSurfaceHasShowTextGlyphs = bindCairo(\"cairo_surface_has_show_text_glyphs\", [SURFACE_T], t.boolean);\n\nconst cairoSurfaceSupportsMimeType = bindCairo(\n \"cairo_surface_supports_mime_type\",\n [SURFACE_T, t.string(\"borrowed\")],\n t.boolean,\n);\n\nconst cairoImageSurfaceCreate = bindCairo(\"cairo_image_surface_create\", [t.int32, t.int32, t.int32], SURFACE_FULL_T);\n\nconst cairoImageSurfaceCreateFromPng = bindCairo(\n \"cairo_image_surface_create_from_png\",\n [t.string(\"borrowed\")],\n SURFACE_FULL_T,\n);\n\nconst cairoImageSurfaceGetWidth = bindCairo(\"cairo_image_surface_get_width\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetHeight = bindCairo(\"cairo_image_surface_get_height\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetFormat = bindCairo(\"cairo_image_surface_get_format\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetStride = bindCairo(\"cairo_image_surface_get_stride\", [SURFACE_T], t.int32);\nconst cairoRecordingSurfaceCreate = bindCairo(\"cairo_recording_surface_create\", [t.int32, RECTANGLE_T], SURFACE_FULL_T);\n\nconst cairoRecordingSurfaceInkExtents = bindCairo(\n \"cairo_recording_surface_ink_extents\",\n [SURFACE_T, t.ref(t.float64), t.ref(t.float64), t.ref(t.float64), t.ref(t.float64)],\n t.void,\n);\n\nconst cairoRecordingSurfaceGetExtents = bindCairo(\n \"cairo_recording_surface_get_extents\",\n [SURFACE_T, RECTANGLE_T],\n t.boolean,\n);\n\nconst wrapSurface = (handle: unknown): Surface => wrapHandle(handle as ExternalObject<Handle>, Surface);\n\nconst ownSurface = (handle: ExternalObject<Handle>): ExternalObject<Handle> => {\n const surface = checkSurface(handle);\n\n if (cairoSurfaceGetType(surface) === SurfaceType.IMAGE) {\n const bytes = (cairoImageSurfaceGetStride(surface) as number) * (cairoImageSurfaceGetHeight(surface) as number);\n reportExternalMemory(surface, bytes);\n }\n\n return surface;\n};\n\nconst readPair = <T>(boundFn: BoundFunction, self: object, build: (first: number, second: number) => T): T => {\n const first = { value: 0 };\n const second = { value: 0 };\n boundFn(getHandle(self), first, second);\n\n return build(first.value, second.value);\n};\n\nconst allocRectangle = (rect: RectangleData): ExternalObject<Handle> => {\n const buffer = alloc(RECTANGLE_SIZE);\n write(buffer, t.float64, 0, rect.x);\n write(buffer, t.float64, 8, rect.y);\n write(buffer, t.float64, 16, rect.width);\n write(buffer, t.float64, 24, rect.height);\n\n return buffer;\n};\n\nconst readRectangle = (buffer: ExternalObject<Handle>): RectangleData => ({\n x: DOUBLE.read(buffer, 0) as number,\n y: DOUBLE.read(buffer, 8) as number,\n width: DOUBLE.read(buffer, 16) as number,\n height: DOUBLE.read(buffer, 24) as number,\n});\n\nconst createRecordingSurface = (content: Content, extents?: RectangleData): ExternalObject<Handle> => {\n const rectangle = extents === undefined ? null : allocRectangle(extents);\n\n return cairoRecordingSurfaceCreate(content, rectangle) as ExternalObject<Handle>;\n};\n\nconst surfaceClassFor: WrapperClassResolver = (handle) => {\n const type = cairoSurfaceGetType(handle) as SurfaceType;\n\n if (type === SurfaceType.IMAGE) {\n return ImageSurface;\n }\n\n if (type === SurfaceType.RECORDING) {\n return RecordingSurface;\n }\n\n return Surface;\n};\n\n/**\n * A cairo surface (`cairo_surface_t`): the target a context draws onto. Surfaces come from the `create*`\n * statics, from `ImageSurface` and `RecordingSurface`, or from GTK, and wrap as the concrete class their\n * backend reports (`instanceof ImageSurface` for an image surface).\n */\nabstract class Surface {\n static {\n registerWrapperClass(this, SURFACE_TYPE);\n registerWrapperClassResolver(this, surfaceClassFor);\n }\n\n /** Creates a surface of the given `content` and size as compatible as possible with `other`. */\n static createSimilar(other: Surface, content: Content, width: number, height: number): Surface {\n const handle = cairoSurfaceCreateSimilar(getHandle(other), content, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(ownSurface(handle));\n }\n\n /** Creates an image surface of the given `format` and size as compatible as possible with `other`. */\n static createSimilarImage(other: Surface, format: Format, width: number, height: number): ImageSurface {\n const handle = cairoSurfaceCreateSimilarImage(\n getHandle(other),\n format,\n width,\n height,\n ) as ExternalObject<Handle>;\n\n return wrapHandle(ownSurface(handle), ImageSurface);\n }\n\n /** Creates a surface that draws onto the given rectangle of `target`. */\n static createForRectangle(target: Surface, x: number, y: number, width: number, height: number): Surface {\n const handle = cairoSurfaceCreateForRectangle(getHandle(target), x, y, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(checkSurface(handle));\n }\n\n /** GType of `CairoSurface`, the boxed type this class is registered under. */\n declare __type__: bigint;\n\n /** Writes the surface to a PNG file at `filename` and returns the resulting status. */\n writeToPng(filename: string): Status {\n return cairoSurfaceWriteToPng(getHandle(this), filename) as Status;\n }\n\n /** Returns the error status of the surface, `Status.SUCCESS` when it is usable. */\n status(): Status {\n return cairoSurfaceStatus(getHandle(this)) as Status;\n }\n\n /** Finishes the surface and drops its backend resources; further drawing reports an error. */\n finish(): void {\n cairoSurfaceFinish(getHandle(this));\n }\n\n /** Performs any pending drawing so the backend storage is up to date. */\n flush(): void {\n cairoSurfaceFlush(getHandle(this));\n }\n\n /** Returns the managed device behind the surface, or null when it has none. */\n getDevice(): Device | null {\n const handle = cairoSurfaceGetDevice(getHandle(this)) as ExternalObject<Handle> | null;\n\n return handle === null ? null : wrapHandle(handle, Device);\n }\n\n /** Returns the font options the surface's backend prefers for rendering text. */\n getFontOptions(): FontOptions {\n const options = FontOptions.create();\n cairoSurfaceGetFontOptions(getHandle(this), getHandle(options));\n\n return options;\n }\n\n /** Returns whether the surface holds color, alpha or both. */\n getContent(): Content {\n return cairoSurfaceGetContent(getHandle(this)) as Content;\n }\n\n /** Tells cairo the surface's storage was modified outside of cairo. */\n markDirty(): void {\n cairoSurfaceMarkDirty(getHandle(this));\n }\n\n /** Tells cairo the given rectangle of the surface's storage was modified outside of cairo. */\n markDirtyRectangle(x: number, y: number, width: number, height: number): void {\n cairoSurfaceMarkDirtyRectangle(getHandle(this), x, y, width, height);\n }\n\n /** Sets the offset added to device coordinates when drawing onto the surface. */\n setDeviceOffset(xOffset: number, yOffset: number): void {\n cairoSurfaceSetDeviceOffset(getHandle(this), xOffset, yOffset);\n }\n\n /** Returns the offset added to device coordinates when drawing onto the surface. */\n getDeviceOffset(): DeviceOffset {\n return readPair(cairoSurfaceGetDeviceOffset, this, (xOffset, yOffset) => ({ xOffset, yOffset }));\n }\n\n /** Returns the scale applied between user and device units. */\n getDeviceScale(): DeviceScale {\n return readPair(cairoSurfaceGetDeviceScale, this, (xScale, yScale) => ({ xScale, yScale }));\n }\n\n /** Sets the scale applied between user and device units. */\n setDeviceScale(xScale: number, yScale: number): void {\n cairoSurfaceSetDeviceScale(getHandle(this), xScale, yScale);\n }\n\n /** Sets the resolution used when vector content has to be rasterized. */\n setFallbackResolution(xPixelsPerInch: number, yPixelsPerInch: number): void {\n cairoSurfaceSetFallbackResolution(getHandle(this), xPixelsPerInch, yPixelsPerInch);\n }\n\n /** Returns the resolution used when vector content has to be rasterized. */\n getFallbackResolution(): FallbackResolution {\n return readPair(cairoSurfaceGetFallbackResolution, this, (xPixelsPerInch, yPixelsPerInch) => ({\n xPixelsPerInch,\n yPixelsPerInch,\n }));\n }\n\n /** Returns the backend type of the surface. */\n getType(): SurfaceType {\n return cairoSurfaceGetType(getHandle(this)) as SurfaceType;\n }\n\n /** Returns the reference count of the surface. */\n getReferenceCount(): number {\n return cairoSurfaceGetReferenceCount(getHandle(this)) as number;\n }\n\n /** Emits the current page and keeps its content for the next one, on paged backends. */\n copyPage(): void {\n cairoSurfaceCopyPage(getHandle(this));\n }\n\n /** Emits the current page and starts a blank one, on paged backends. */\n showPage(): void {\n cairoSurfaceShowPage(getHandle(this));\n }\n\n /** Returns whether the surface supports `Context.showTextGlyphs` natively. */\n hasShowTextGlyphs(): boolean {\n return cairoSurfaceHasShowTextGlyphs(getHandle(this)) as boolean;\n }\n\n /** Returns whether the surface can embed data of the given MIME type. */\n supportsMimeType(mimeType: string): boolean {\n return cairoSurfaceSupportsMimeType(getHandle(this), mimeType) as boolean;\n }\n}\n\n/** A surface backed by an in-memory pixel buffer, the usual target for offscreen drawing. */\nclass ImageSurface extends Surface {\n /** Creates an image surface of the given pixel `format` and size, the same as `new ImageSurface(...)`. */\n static create(format: Format, width: number, height: number): ImageSurface {\n return wrapHandle(ownSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>), this);\n }\n\n /** Loads a PNG file into a new image surface; throws when the file is missing or invalid. */\n static createFromPng(filename: string): ImageSurface {\n return wrapHandle(ownSurface(cairoImageSurfaceCreateFromPng(filename) as ExternalObject<Handle>), this);\n }\n\n /** Creates an image surface of the given pixel `format` and size. */\n constructor(format: Format, width: number, height: number) {\n super();\n setHandle(this, ownSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>));\n }\n\n /** Returns the width of the surface in pixels. */\n getWidth(): number {\n return cairoImageSurfaceGetWidth(getHandle(this)) as number;\n }\n\n /** Returns the height of the surface in pixels. */\n getHeight(): number {\n return cairoImageSurfaceGetHeight(getHandle(this)) as number;\n }\n\n /** Returns the pixel format of the surface. */\n getFormat(): Format {\n return cairoImageSurfaceGetFormat(getHandle(this)) as Format;\n }\n\n /** Returns the number of bytes between the starts of consecutive rows. */\n getStride(): number {\n return cairoImageSurfaceGetStride(getHandle(this)) as number;\n }\n\n /** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */\n getData(): Uint8Array {\n this.flush();\n const totalBytes = this.getStride() * this.getHeight();\n\n if (totalBytes === 0) {\n return new Uint8Array(0);\n }\n\n const getImageData = bindCairo(\n \"cairo_image_surface_get_data\",\n [SURFACE_T],\n t.fixedArray(t.uint8, totalBytes, \"borrowed\", { isBytes: true }),\n );\n\n return getImageData(getHandle(this)) as Uint8Array;\n }\n}\n\n/** A surface that records the drawing operations applied to it, for replaying them onto other surfaces. */\nclass RecordingSurface extends Surface {\n /** Creates a recording surface, the same as `new RecordingSurface(...)`. */\n static create(content: Content, extents?: RectangleData): RecordingSurface {\n return new RecordingSurface(content, extents);\n }\n\n /** Creates a recording surface of the given `content`, bounded to `extents` or unbounded when omitted. */\n constructor(content: Content, extents?: RectangleData) {\n super();\n setHandle(this, checkSurface(createRecordingSurface(content, extents)));\n }\n\n /** Returns the area that has been drawn on so far. */\n inkExtents(): InkExtents {\n const x0 = { value: 0 };\n const y0 = { value: 0 };\n const width = { value: 0 };\n const height = { value: 0 };\n cairoRecordingSurfaceInkExtents(getHandle(this), x0, y0, width, height);\n\n return { x0: x0.value, y0: y0.value, width: width.value, height: height.value };\n }\n\n /** Returns the extents the surface was created with, or null for an unbounded surface. */\n getExtents(): RectangleData | null {\n const buffer = alloc(RECTANGLE_SIZE);\n const isBounded = cairoRecordingSurfaceGetExtents(getHandle(this), buffer) as boolean;\n\n return isBounded ? readRectangle(buffer) : null;\n }\n}\n\nexport { ImageSurface, RecordingSurface, Surface };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/cairo",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.13",
|
|
4
4
|
"description": "Cairo drawing for GTKX applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"node": ">=26.7.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@gtkx/runtime": "2.0.0-beta.
|
|
47
|
+
"@gtkx/runtime": "^2.0.0-beta.13"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@gtkx/vitest": "2.0.0-beta.
|
|
50
|
+
"@gtkx/vitest": "2.0.0-beta.13",
|
|
51
51
|
"@types/node": "^26.5.1"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
package/src/context.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
t,
|
|
10
10
|
wrapHandle,
|
|
11
11
|
} from "@gtkx/runtime";
|
|
12
|
+
import { releaseHandle } from "@gtkx/runtime/internal";
|
|
12
13
|
import type {
|
|
13
14
|
Antialias,
|
|
14
15
|
Content,
|
|
@@ -47,6 +48,7 @@ import {
|
|
|
47
48
|
FONT_OPTIONS_T,
|
|
48
49
|
GLYPH_T,
|
|
49
50
|
MATRIX_T,
|
|
51
|
+
PATH_FULL_T,
|
|
50
52
|
PATH_T,
|
|
51
53
|
PATTERN_FULL_T,
|
|
52
54
|
PATTERN_T,
|
|
@@ -57,7 +59,7 @@ import {
|
|
|
57
59
|
TEXT_EXTENTS_T,
|
|
58
60
|
} from "./lib.js";
|
|
59
61
|
import { allocMatrix, Matrix } from "./matrix.js";
|
|
60
|
-
import {
|
|
62
|
+
import { Path, wrapPath } from "./path.js";
|
|
61
63
|
import { Pattern } from "./pattern.js";
|
|
62
64
|
import { ScaledFont } from "./scaled-font.js";
|
|
63
65
|
import { checkStatus } from "./status.js";
|
|
@@ -198,8 +200,9 @@ const cairoGetScaledFont = bindCairo("cairo_get_scaled_font", [CONTEXT_T], SCALE
|
|
|
198
200
|
const cairoShowGlyphs = bindCairo("cairo_show_glyphs", [CONTEXT_T, GLYPH_T, t.int32], t.void);
|
|
199
201
|
const cairoGlyphPath = bindCairo("cairo_glyph_path", [CONTEXT_T, GLYPH_T, t.int32], t.void);
|
|
200
202
|
const cairoGlyphExtents = bindCairo("cairo_glyph_extents", [CONTEXT_T, GLYPH_T, t.int32, TEXT_EXTENTS_T], t.void);
|
|
201
|
-
const cairoCopyPath = bindCairo("cairo_copy_path", [CONTEXT_T],
|
|
202
|
-
const cairoCopyPathFlat = bindCairo("cairo_copy_path_flat", [CONTEXT_T],
|
|
203
|
+
const cairoCopyPath = bindCairo("cairo_copy_path", [CONTEXT_T], PATH_FULL_T);
|
|
204
|
+
const cairoCopyPathFlat = bindCairo("cairo_copy_path_flat", [CONTEXT_T], PATH_FULL_T);
|
|
205
|
+
const cairoAppendPath = bindCairo("cairo_append_path", [CONTEXT_T, PATH_T], t.void);
|
|
203
206
|
const cairoTagBegin = bindCairo("cairo_tag_begin", [CONTEXT_T, t.string("borrowed"), t.string("borrowed")], t.void);
|
|
204
207
|
const cairoTagEnd = bindCairo("cairo_tag_end", [CONTEXT_T, t.string("borrowed")], t.void);
|
|
205
208
|
|
|
@@ -297,7 +300,7 @@ const appendSegment = (ctx: Context, segment: PathData): void => {
|
|
|
297
300
|
* path, source, transformation, clip and font state for one target surface. GTK hands one to draw callbacks
|
|
298
301
|
* and snapshots, and `new Context(surface)` creates one for offscreen drawing.
|
|
299
302
|
*/
|
|
300
|
-
class Context {
|
|
303
|
+
class Context implements Disposable {
|
|
301
304
|
static {
|
|
302
305
|
registerWrapperClass(this, CONTEXT_TYPE);
|
|
303
306
|
}
|
|
@@ -317,6 +320,29 @@ class Context {
|
|
|
317
320
|
setHandle(this, handle);
|
|
318
321
|
}
|
|
319
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Drops this context's reference to its `cairo_t` now instead of when the garbage collector
|
|
325
|
+
* reclaims the wrapper, as `cairo_destroy` does in C. Release a context the app obtains itself,
|
|
326
|
+
* such as one from `Gtk.Snapshot.appendCairo` or `Context.create` on a long-lived surface, once
|
|
327
|
+
* drawing is done: until then the context keeps its target alive, and Cairo copies a backing
|
|
328
|
+
* surface into each recording that still holds it when the app draws into it again.
|
|
329
|
+
*
|
|
330
|
+
* A `using` declaration calls this when its block exits:
|
|
331
|
+
*
|
|
332
|
+
* ```ts
|
|
333
|
+
* using cr = snapshot.appendCairo(bounds);
|
|
334
|
+
* cr.setSourceSurface(surface, 0, 0);
|
|
335
|
+
* cr.paint();
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* Every later call on the context throws. Calling it again does nothing, and on the context a
|
|
339
|
+
* draw callback receives it only ends that context early, because GTKX releases it when the
|
|
340
|
+
* callback returns anyway.
|
|
341
|
+
*/
|
|
342
|
+
[Symbol.dispose](): void {
|
|
343
|
+
releaseHandle(getHandle(this));
|
|
344
|
+
}
|
|
345
|
+
|
|
320
346
|
/** Begins a new sub-path at `(x, y)`, which becomes the current point. */
|
|
321
347
|
moveTo(x: number, y: number): void {
|
|
322
348
|
cairoMoveTo(getHandle(this), x, y);
|
|
@@ -846,19 +872,25 @@ class Context {
|
|
|
846
872
|
return readTextExtents(extents);
|
|
847
873
|
}
|
|
848
874
|
|
|
849
|
-
/** Returns a copy of the current path
|
|
850
|
-
copyPath():
|
|
851
|
-
return
|
|
875
|
+
/** Returns a copy of the current path; `toData()` reads its segments. */
|
|
876
|
+
copyPath(): Path {
|
|
877
|
+
return wrapPath(cairoCopyPath(getHandle(this)) as ExternalObject<Handle>);
|
|
852
878
|
}
|
|
853
879
|
|
|
854
880
|
/** Returns a copy of the current path with curves flattened into line segments. */
|
|
855
|
-
copyPathFlat():
|
|
856
|
-
return
|
|
881
|
+
copyPathFlat(): Path {
|
|
882
|
+
return wrapPath(cairoCopyPathFlat(getHandle(this)) as ExternalObject<Handle>);
|
|
857
883
|
}
|
|
858
884
|
|
|
859
|
-
/** Appends
|
|
860
|
-
appendPath(
|
|
861
|
-
|
|
885
|
+
/** Appends a path returned by `copyPath`, or its segments, to the current path. */
|
|
886
|
+
appendPath(path: Path | PathData[]): void {
|
|
887
|
+
if (path instanceof Path) {
|
|
888
|
+
cairoAppendPath(getHandle(this), getHandle(path));
|
|
889
|
+
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
for (const segment of path) {
|
|
862
894
|
appendSegment(this, segment);
|
|
863
895
|
}
|
|
864
896
|
}
|
package/src/font-face.ts
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
type Handle,
|
|
5
5
|
registerWrapperClass,
|
|
6
6
|
registerWrapperClassResolver,
|
|
7
|
+
setHandle,
|
|
7
8
|
t,
|
|
8
|
-
wrapHandle,
|
|
9
9
|
type WrapperClassResolver,
|
|
10
10
|
} from "@gtkx/runtime";
|
|
11
11
|
import { type FontSlant, FontType, type FontWeight, type Status } from "./enums.js";
|
|
@@ -68,9 +68,9 @@ abstract class FontFace {
|
|
|
68
68
|
registerWrapperClassResolver(this, fontFaceClassFor);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
/** Creates a toy font face
|
|
71
|
+
/** Creates a toy font face, the same as `new ToyFontFace(...)`. */
|
|
72
72
|
static create(family: string, slant: FontSlant, weight: FontWeight): ToyFontFace {
|
|
73
|
-
return
|
|
73
|
+
return new ToyFontFace(family, slant, weight);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/** GType of `CairoFontFace`, the boxed type this class is registered under. */
|
|
@@ -92,8 +92,14 @@ abstract class FontFace {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
/** A toy font face, created with `FontFace.create` or a context's `selectFontFace`. */
|
|
95
|
+
/** A toy font face, created with `new ToyFontFace(...)`, `FontFace.create` or a context's `selectFontFace`. */
|
|
96
96
|
class ToyFontFace extends FontFace {
|
|
97
|
+
/** Creates a toy font face from a family name, slant and weight. */
|
|
98
|
+
constructor(family: string, slant: FontSlant, weight: FontWeight) {
|
|
99
|
+
super();
|
|
100
|
+
setHandle(this, cairoToyFontFaceCreate(family, slant, weight) as ExternalObject<Handle>);
|
|
101
|
+
}
|
|
102
|
+
|
|
97
103
|
/** Returns the family name the font face was created with. */
|
|
98
104
|
getFamily(): string {
|
|
99
105
|
return cairoToyFontFaceGetFamily(getHandle(this)) as string;
|
package/src/lib.ts
CHANGED
|
@@ -110,11 +110,13 @@ const FONT_EXTENTS_T: BoxedDescriptor = t.boxed("cairo_font_extents_t", {
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
const PATH_T: BoxedDescriptor = t.boxed("cairo_path_t", {
|
|
113
|
-
ownership: "
|
|
113
|
+
ownership: "borrowed",
|
|
114
114
|
sharedLibrary: CAIRO_LIBRARY,
|
|
115
115
|
freeFnName: "cairo_path_destroy",
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
+
const PATH_FULL_T: BoxedDescriptor = { ...PATH_T, ownership: "full" };
|
|
119
|
+
|
|
118
120
|
const DOUBLE_BUFFER_T: BoxedDescriptor = t.boxed("double[]", { ownership: "borrowed", sharedLibrary: CAIRO_LIBRARY });
|
|
119
121
|
|
|
120
122
|
const bindCairo = (symbol: string, args: Descriptor[], returns: Descriptor): BoundFunction =>
|
|
@@ -137,6 +139,7 @@ export {
|
|
|
137
139
|
FONT_OPTIONS_T,
|
|
138
140
|
GLYPH_T,
|
|
139
141
|
MATRIX_T,
|
|
142
|
+
PATH_FULL_T,
|
|
140
143
|
PATH_T,
|
|
141
144
|
PATTERN_FULL_T,
|
|
142
145
|
PATTERN_T,
|
package/src/path.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ExternalObject, getHandle, type Handle, read, t } from "@gtkx/runtime";
|
|
1
|
+
import { type ExternalObject, getHandle, type Handle, read, t, wrapHandle } from "@gtkx/runtime";
|
|
2
2
|
import type { PathData, Point } from "./types.js";
|
|
3
3
|
import { PathDataType, type Status } from "./enums.js";
|
|
4
4
|
import { checkStatus } from "./status.js";
|
|
@@ -61,8 +61,8 @@ const parsePath = (pathHandle: PathBuffer): PathData[] => {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* A cairo path (`cairo_path_t`).
|
|
65
|
-
* one, such as `Gsk.PathBuilder.addCairoPath`, accept it as is.
|
|
64
|
+
* A cairo path (`cairo_path_t`). `Context.copyPath()` and `Context.copyPathFlat()` return one, and
|
|
65
|
+
* `Context.appendPath` and bindings that take one, such as `Gsk.PathBuilder.addCairoPath`, accept it as is.
|
|
66
66
|
*/
|
|
67
67
|
abstract class Path {
|
|
68
68
|
/** Reads the segments of the path in drawing order. */
|
|
@@ -71,4 +71,10 @@ abstract class Path {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
const wrapPath = (pathHandle: PathBuffer): Path => {
|
|
75
|
+
checkStatus(INT.read(pathHandle, 0) as Status, "path");
|
|
76
|
+
|
|
77
|
+
return wrapHandle(pathHandle, Path);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { parsePath, Path, wrapPath };
|
package/src/pattern.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type Handle,
|
|
5
5
|
registerWrapperClass,
|
|
6
6
|
registerWrapperClassResolver,
|
|
7
|
+
setHandle,
|
|
7
8
|
t,
|
|
8
9
|
wrapHandle,
|
|
9
10
|
type WrapperClassResolver,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
type BoundFunction,
|
|
16
17
|
cairoGType,
|
|
17
18
|
MATRIX_T,
|
|
18
|
-
|
|
19
|
+
PATH_FULL_T,
|
|
19
20
|
PATTERN_FULL_T,
|
|
20
21
|
PATTERN_T,
|
|
21
22
|
SURFACE_T,
|
|
@@ -136,7 +137,7 @@ const cairoMeshPatternGetPatchCount = bindCairo(
|
|
|
136
137
|
t.int32,
|
|
137
138
|
);
|
|
138
139
|
|
|
139
|
-
const cairoMeshPatternGetPath = bindCairo("cairo_mesh_pattern_get_path", [PATTERN_T, t.int32],
|
|
140
|
+
const cairoMeshPatternGetPath = bindCairo("cairo_mesh_pattern_get_path", [PATTERN_T, t.int32], PATH_FULL_T);
|
|
140
141
|
|
|
141
142
|
const cairoMeshPatternGetControlPoint = bindCairo(
|
|
142
143
|
"cairo_mesh_pattern_get_control_point",
|
|
@@ -214,14 +215,12 @@ abstract class Pattern {
|
|
|
214
215
|
return checkPattern(wrapPattern(cairoPatternCreateRgba(red, green, blue, alpha)));
|
|
215
216
|
}
|
|
216
217
|
|
|
217
|
-
/** Creates a linear gradient
|
|
218
|
+
/** Creates a linear gradient, the same as `new LinearPattern(...)`. */
|
|
218
219
|
static createLinear(x0: number, y0: number, x1: number, y1: number): LinearPattern {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return checkPattern(wrapHandle(handle, LinearPattern));
|
|
220
|
+
return new LinearPattern(x0, y0, x1, y1);
|
|
222
221
|
}
|
|
223
222
|
|
|
224
|
-
/** Creates a radial gradient
|
|
223
|
+
/** Creates a radial gradient, the same as `new RadialPattern(...)`. */
|
|
225
224
|
static createRadial(
|
|
226
225
|
cx0: number,
|
|
227
226
|
cy0: number,
|
|
@@ -230,14 +229,12 @@ abstract class Pattern {
|
|
|
230
229
|
cy1: number,
|
|
231
230
|
radius1: number,
|
|
232
231
|
): RadialPattern {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return checkPattern(wrapHandle(handle, RadialPattern));
|
|
232
|
+
return new RadialPattern(cx0, cy0, radius0, cx1, cy1, radius1);
|
|
236
233
|
}
|
|
237
234
|
|
|
238
|
-
/** Creates an empty mesh gradient
|
|
235
|
+
/** Creates an empty mesh gradient, the same as `new MeshPattern()`. */
|
|
239
236
|
static createMesh(): MeshPattern {
|
|
240
|
-
return
|
|
237
|
+
return new MeshPattern();
|
|
241
238
|
}
|
|
242
239
|
|
|
243
240
|
/** Creates a pattern that paints with the content of `surface`. */
|
|
@@ -339,8 +336,15 @@ abstract class Pattern {
|
|
|
339
336
|
}
|
|
340
337
|
}
|
|
341
338
|
|
|
342
|
-
/** A linear gradient pattern, created with `Pattern.createLinear`. */
|
|
339
|
+
/** A linear gradient pattern, created with `new LinearPattern(...)` or `Pattern.createLinear`. */
|
|
343
340
|
class LinearPattern extends Pattern {
|
|
341
|
+
/** Creates a linear gradient between `(x0, y0)` and `(x1, y1)`; add stops with `addColorStopRgba`. */
|
|
342
|
+
constructor(x0: number, y0: number, x1: number, y1: number) {
|
|
343
|
+
super();
|
|
344
|
+
setHandle(this, cairoPatternCreateLinear(x0, y0, x1, y1) as ExternalObject<Handle>);
|
|
345
|
+
checkPattern(this);
|
|
346
|
+
}
|
|
347
|
+
|
|
344
348
|
/** Returns the two end points of the gradient. */
|
|
345
349
|
getLinearPoints(): LinearPoints {
|
|
346
350
|
const x0 = { value: 0 };
|
|
@@ -353,8 +357,15 @@ class LinearPattern extends Pattern {
|
|
|
353
357
|
}
|
|
354
358
|
}
|
|
355
359
|
|
|
356
|
-
/** A radial gradient pattern, created with `Pattern.createRadial`. */
|
|
360
|
+
/** A radial gradient pattern, created with `new RadialPattern(...)` or `Pattern.createRadial`. */
|
|
357
361
|
class RadialPattern extends Pattern {
|
|
362
|
+
/** Creates a radial gradient between two circles; add stops with `addColorStopRgba`. */
|
|
363
|
+
constructor(cx0: number, cy0: number, radius0: number, cx1: number, cy1: number, radius1: number) {
|
|
364
|
+
super();
|
|
365
|
+
setHandle(this, cairoPatternCreateRadial(cx0, cy0, radius0, cx1, cy1, radius1) as ExternalObject<Handle>);
|
|
366
|
+
checkPattern(this);
|
|
367
|
+
}
|
|
368
|
+
|
|
358
369
|
/** Returns the two circles of the gradient. */
|
|
359
370
|
getRadialCircles(): RadialCircles {
|
|
360
371
|
const x0 = { value: 0 };
|
|
@@ -370,10 +381,17 @@ class RadialPattern extends Pattern {
|
|
|
370
381
|
}
|
|
371
382
|
|
|
372
383
|
/**
|
|
373
|
-
* A mesh gradient pattern, created with `Pattern.createMesh`: a set of Coons patches, each
|
|
374
|
-
* `beginPatch` and `endPatch` by a path of up to four sides and the colors of its corners.
|
|
384
|
+
* A mesh gradient pattern, created with `new MeshPattern()` or `Pattern.createMesh`: a set of Coons patches, each
|
|
385
|
+
* described between `beginPatch` and `endPatch` by a path of up to four sides and the colors of its corners.
|
|
375
386
|
*/
|
|
376
387
|
class MeshPattern extends Pattern {
|
|
388
|
+
/** Creates an empty mesh gradient; describe its patches with the methods below. */
|
|
389
|
+
constructor() {
|
|
390
|
+
super();
|
|
391
|
+
setHandle(this, cairoPatternCreateMesh() as ExternalObject<Handle>);
|
|
392
|
+
checkPattern(this);
|
|
393
|
+
}
|
|
394
|
+
|
|
377
395
|
/** Starts describing a new patch. */
|
|
378
396
|
beginPatch(): void {
|
|
379
397
|
cairoMeshPatternBeginPatch(getHandle(this));
|
package/src/surface.ts
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
type WrapperClassResolver,
|
|
12
12
|
write,
|
|
13
13
|
} from "@gtkx/runtime";
|
|
14
|
+
import { reportExternalMemory } from "@gtkx/runtime/internal";
|
|
14
15
|
import type { DeviceOffset, DeviceScale, FallbackResolution, InkExtents, RectangleData } from "./types.js";
|
|
15
|
-
import { Context } from "./context.js";
|
|
16
16
|
import { Device } from "./device.js";
|
|
17
17
|
import { type Content, type Format, type Status, SurfaceType } from "./enums.js";
|
|
18
18
|
import { FontOptions } from "./font-options.js";
|
|
@@ -110,6 +110,17 @@ const cairoRecordingSurfaceGetExtents = bindCairo(
|
|
|
110
110
|
|
|
111
111
|
const wrapSurface = (handle: unknown): Surface => wrapHandle(handle as ExternalObject<Handle>, Surface);
|
|
112
112
|
|
|
113
|
+
const ownSurface = (handle: ExternalObject<Handle>): ExternalObject<Handle> => {
|
|
114
|
+
const surface = checkSurface(handle);
|
|
115
|
+
|
|
116
|
+
if (cairoSurfaceGetType(surface) === SurfaceType.IMAGE) {
|
|
117
|
+
const bytes = (cairoImageSurfaceGetStride(surface) as number) * (cairoImageSurfaceGetHeight(surface) as number);
|
|
118
|
+
reportExternalMemory(surface, bytes);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return surface;
|
|
122
|
+
};
|
|
123
|
+
|
|
113
124
|
const readPair = <T>(boundFn: BoundFunction, self: object, build: (first: number, second: number) => T): T => {
|
|
114
125
|
const first = { value: 0 };
|
|
115
126
|
const second = { value: 0 };
|
|
@@ -170,7 +181,7 @@ abstract class Surface {
|
|
|
170
181
|
static createSimilar(other: Surface, content: Content, width: number, height: number): Surface {
|
|
171
182
|
const handle = cairoSurfaceCreateSimilar(getHandle(other), content, width, height) as ExternalObject<Handle>;
|
|
172
183
|
|
|
173
|
-
return wrapSurface(
|
|
184
|
+
return wrapSurface(ownSurface(handle));
|
|
174
185
|
}
|
|
175
186
|
|
|
176
187
|
/** Creates an image surface of the given `format` and size as compatible as possible with `other`. */
|
|
@@ -182,7 +193,7 @@ abstract class Surface {
|
|
|
182
193
|
height,
|
|
183
194
|
) as ExternalObject<Handle>;
|
|
184
195
|
|
|
185
|
-
return wrapHandle(
|
|
196
|
+
return wrapHandle(ownSurface(handle), ImageSurface);
|
|
186
197
|
}
|
|
187
198
|
|
|
188
199
|
/** Creates a surface that draws onto the given rectangle of `target`. */
|
|
@@ -313,18 +324,18 @@ abstract class Surface {
|
|
|
313
324
|
class ImageSurface extends Surface {
|
|
314
325
|
/** Creates an image surface of the given pixel `format` and size, the same as `new ImageSurface(...)`. */
|
|
315
326
|
static create(format: Format, width: number, height: number): ImageSurface {
|
|
316
|
-
return wrapHandle(
|
|
327
|
+
return wrapHandle(ownSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>), this);
|
|
317
328
|
}
|
|
318
329
|
|
|
319
330
|
/** Loads a PNG file into a new image surface; throws when the file is missing or invalid. */
|
|
320
331
|
static createFromPng(filename: string): ImageSurface {
|
|
321
|
-
return wrapHandle(
|
|
332
|
+
return wrapHandle(ownSurface(cairoImageSurfaceCreateFromPng(filename) as ExternalObject<Handle>), this);
|
|
322
333
|
}
|
|
323
334
|
|
|
324
335
|
/** Creates an image surface of the given pixel `format` and size. */
|
|
325
336
|
constructor(format: Format, width: number, height: number) {
|
|
326
337
|
super();
|
|
327
|
-
setHandle(this,
|
|
338
|
+
setHandle(this, ownSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>));
|
|
328
339
|
}
|
|
329
340
|
|
|
330
341
|
/** Returns the width of the surface in pixels. */
|
|
@@ -349,10 +360,6 @@ class ImageSurface extends Surface {
|
|
|
349
360
|
|
|
350
361
|
/** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */
|
|
351
362
|
getData(): Uint8Array {
|
|
352
|
-
/* TODO: Keep this finished-state check until Cairo stops exposing released image storage.
|
|
353
|
-
* https://github.com/gtkx-org/gtkx/issues/730
|
|
354
|
-
*/
|
|
355
|
-
Context.create(this);
|
|
356
363
|
this.flush();
|
|
357
364
|
const totalBytes = this.getStride() * this.getHeight();
|
|
358
365
|
|