- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Create base class for pointers.
Showing
3 changed files
with
28 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright Dirk Lemstra https://github.com/dlemstra/magick-wasm. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
import { ImageMagick } from '../../image-magick'; | ||
|
||
/** @internal */ | ||
export abstract class Pointer { | ||
private readonly instance: number; | ||
private readonly type: string; | ||
|
||
protected constructor(size: number, type: string) { | ||
this.instance = ImageMagick._api._malloc(size); | ||
this.type = type; | ||
ImageMagick._api.setValue(this.instance, 0, this.type); | ||
} | ||
|
||
get ptr(): number { return this.instance; } | ||
|
||
get value(): number { return ImageMagick._api.getValue(this.instance, this.type); } | ||
} |