1.2.6 • Published 9 days ago

csnf v1.2.6

Weekly downloads
3
License
MIT
Repository
github
Last release
9 days ago

csnf

csnf is a parser and generator for CSNF (CLIP STUDIO name files).

npm install csnf

test npm version License

Usage

const CSNF = require('csnf')

const csnf = new CSNF({ template: 'B4' })
const page = csnf.addPage()

// CSNF has 4 layer types (Frame, Draw, Text, Note),
// each type allows up to 3 layers.

const drawData = Uint8Array.of(
  255, 255, 255, 255, 255, 255, 255, 255,
  255, 0, 0, 0, 0, 255, 255, 255,
  255, 0, 255, 255, 255, 0, 255, 255,
  255, 0, 255, 255, 255, 255, 0, 255,
  255, 0, 255, 255, 255, 255, 0, 255,
  255, 0, 255, 255, 255, 0, 255, 255,
  255, 0, 0, 0, 0, 255, 255, 255,
  128, 255, 255, 255, 255, 255, 255, 255
)
page.addDrawLayer(csnf.bitmap(8, 8, drawData))

const rect = csnf.baseframeRect()
const p0 = [rect.x, rect.y]
const p1 = [rect.x + rect.width, rect.y]
const p2 = [rect.x + rect.width, rect.y + rect.height]
const p3 = [rect.x, rect.y + rect.height]

const fontSize = 11
const vertical = true
page.addTextLayer([
  csnf.text(p1, fontSize, vertical, 'vertical\ntext')
])

const w = 4
page.addFrameLayer([
  csnf.line(w, p0, p2),
  csnf.polygon(w, p0, p1, p2, p3)
])

await csnf.writeFile('test.csnf')

License

MIT

1.2.6

9 days ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.0

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago