Skip to content

Commit

Permalink
Added comment to make it more clear that the byte array inside write …
Browse files Browse the repository at this point in the history
…should be copied if it needs to be used outside the function.
  • Loading branch information
dlemstra committed Oct 12, 2024
1 parent 8359bd1 commit ffee5e6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions src/magick-image-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,26 +354,34 @@ export interface IMagickImageCollection extends Array<IMagickImage>, IDisposable
trimBounds(): void;

/**
* Write all image frames to a byte array.
* Write all image frames to a byte array.This array points to native memory and will be give back to the
* native memory manager after the excution of the function. A copy of the data should be made if it needs
* to be used after the function has completed.
* @param func The function to execute with the byte array.
*/
write<TReturnType>(func: (data: Uint8Array) => TReturnType): TReturnType;

/**
* Write all image frames to a byte array.
* Write all image frames to a byte array. This array points to native memory and will be give back to the
* native memory manager after the excution of the function. A copy of the data should be made if it needs
* to be used after the function has completed.
* @param func The async function to execute with the byte array.
*/
write<TReturnType>(func: (data: Uint8Array) => Promise<TReturnType>): Promise<TReturnType>;

/**
* Write all image frames to a byte array.
* Write all image frames to a byte array. This array points to native memory and will be give back to the
* native memory manager after the excution of the function. A copy of the data should be made if it needs
* to be used after the function has completed.
* @param format The format to use.
* @param func The async function to execute with the byte array.
*/
write<TReturnType>(format: MagickFormat, func: (data: Uint8Array) => TReturnType): TReturnType;

/**
* Write all image frames to a byte array.
* Write all image frames to a byte array. This array points to native memory and will be give back to the
* native memory manager after the excution of the function. A copy of the data should be made if it needs
* to be used after the function has completed.
* @param format The format to use.
* @param func The async async function to execute with the byte array.
*/
Expand Down
16 changes: 12 additions & 4 deletions src/magick-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1750,26 +1750,34 @@ export interface IMagickImage extends IDisposable {
wave(method: PixelInterpolateMethod, amplitude: number, length: number): void;

/**
* Writes the image to a byte array.
* Writes the image to a byte array. This array points to native memory and will be give back to the native
* memory manager after the excution of the function. A copy of the data should be made if it needs to be
* used after the function has completed.
* @param func The function to execute with the byte array.
*/
write<TReturnType>(func: (data: Uint8Array) => TReturnType): TReturnType;

/**
* Writes the image to a byte array.
* Writes the image to a byte array.This array points to native memory and will be give back to the native
* memory manager after the excution of the function. A copy of the data should be made if it needs to be
* used after the function has completed.
* @param func The async function to execute with the byte array.
*/
write<TReturnType>(func: (data: Uint8Array) => Promise<TReturnType>): Promise<TReturnType>;

/**
* Writes the image to a byte array.
* Writes the image to a byte array.This array points to native memory and will be give back to the native
* memory manager after the excution of the function. A copy of the data should be made if it needs to be
* used after the function has completed.
* @param format The format to use.
* @param func The function to execute with the byte array.
*/
write<TReturnType>(format: MagickFormat, func: (data: Uint8Array) => TReturnType): TReturnType;

/**
* Writes the image to a byte array.
* Writes the image to a byte array.This array points to native memory and will be give back to the native
* memory manager after the excution of the function. A copy of the data should be made if it needs to be
* used after the function has completed.
* @param format The format to use.
* @param func The async function to execute with the byte array.
*/
Expand Down

0 comments on commit ffee5e6

Please sign in to comment.