Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
(cherry picked from commit a651044591ecfd20409e5e004aa71c6da0561386)

# Conflicts:
#	packages/core/src/index.ts
  • Loading branch information
hipstersmoothie committed Mar 21, 2024
1 parent 3d24bfd commit 5a0f977
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"description": "The jimp monorepo.",
"repository": "jimp-dev/jimp",
"author": "Andrew Lisowski <lisowski54@gmail.com>",
"engines": {
"node": ">=18"
},
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"devDependencies": {
"@jimp/config-eslint": "workspace:*",
"@jimp/config-typescript": "workspace:*",
"@types/file-type": "^10.9.1",
"eslint": "^8.57.0",
"tshy": "^1.12.0",
"typescript": "^5.4.2",
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,18 @@ export class Jimp<
> implements JimpClass
{
static plugins: JimpPlugin[] = [];
/**
* Plugins that add image formats
*/
static formatPlugins: JimpFormat[] = [];
/**
* Formats that can be used with Jimp
*/
static formats: Format[] = [];

/**
* The bitmap data of the image
*/
bitmap: Bitmap = emptyBitmap;
methods: MethodMap = {} as MethodMap;
formats: Format<SupportedMimeTypes>[] = [];
Expand Down
7 changes: 6 additions & 1 deletion packages/jimp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import blit from "@jimp/plugin-blit";
import png from "@jimp/js-png";

export const Jimp = JimpCustom
// .addFormat(png)
// Formats
.addFormat(png)
// Plugins
.plugin(blit)
.plugin(crop);

const image = new Jimp();

image
// doesn't work because blit is added first
.blit({ src: image, x: 0, y: 0 })
.crop(0, 0, image.bitmap.width, image.bitmap.height)
.blit({ src: image, x: 0, y: 0 })
Expand All @@ -21,4 +24,6 @@ image
image
.crop(0, 0, image.bitmap.width, image.bitmap.height)
.blit({ src: image, x: 0, y: 0 })
// doesn't work because becuase of type returned from crop?
// maybe its the same issue as above?
.crop(0, 0, image.bitmap.width, image.bitmap.height);
16 changes: 10 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a0f977

Please sign in to comment.