🌸 「なでしこ」
>
🍯 「貯蔵庫」
plugin_weykpng PNGファイル操作Plugin
🌟新規
📒一覧
🔌
🔍検索
🚪ログイン
plugin_weykpng PNGファイル操作Plugin 📖
PNGのファイルを内容を操作するためのplugin。Javascript形式。
プログラム:
(→大)
class PNGchunk { static registeredChunk = new Map(); constructor(chunk) { this.chunkType=chunk; this.chunkTypeRaw=new Uint8Array(4); this.chunkTypeRaw[0]=chunk.charCodeAt(0); this.chunkTypeRaw[1]=chunk.charCodeAt(1); this.chunkTypeRaw[2]=chunk.charCodeAt(2); this.chunkTypeRaw[3]=chunk.charCodeAt(3); this.chunkRaw = new ArrayBuffer(0); this.chunkCrc = 0; } static registerChunk(chunk, func) { this.registeredChunk.set(chunk, func); } static createFromRaw(f,o) { const view = new DataView(f); const t = String.fromCharCode(view.getUint8(o+4),view.getUint8(o+5),view.getUint8(o+6),view.getUint8(o+7)); const c = this.registeredChunk.get(t); let chunk = null; if (c !== undefined) { chunk = new c(); } else { chunk = new PNGchunk(t); } chunk.setFromRaw(f, o); chunk.parseRaw(); return chunk; } setFromRaw(f,o) { const view = new DataView(f); this.chunkLength = view.getUint32(o,false); o += 4; this.chunkTypeRaw = new Uint8Array(f.slice(o,o+4)); this.chunkType = String.fromCharCode(this.chunkTypeRaw[0],this.chunkTypeRaw[1],this.chunkTypeRaw[2],this.chunkTypeRaw[3]); o += 4; this.chunkRaw = f.slice(o,o+this.chunkLength); o += this.chunkLength; this.chunkCrc = view.getUint32(o,false); } parseRaw() { } generateRaw() { if (this.chunkRaw == null) { this.chunkRaw = new ArrayBuffer(0); this.chunkLength=0; } } updateCrc() { const crc = new CRC32(); crc.update(this.chunkTypeRaw); crc.update(this.chunkRaw); this.chunkCrc = crc.finish(); } getBytes() { this.generateRaw(); this.updateCrc(); const buf = new ArrayBuffer(this.chunkLength+12); this.setBytes(buf, o); return buf; } setBytes(buf, o) { const view8 = new Uint8Array(buf, o, this.chunkLength+12); const setFromArrayBuffer = (ui8, buf, o) => { const views = new Uint8Array(buf); ui8.set(views, o); } setFromArrayBuffer(view8, this.chunkTypeRaw, 4); setFromArrayBuffer(view8, this.chunkRaw, 8); const view = new DataView(buf, o, this.chunkLength+12); view.setUint32(0, this.chunkLength); view.setUint32(8+this.chunkLength, this.chunkCrc); } } class gAMA extends PNGchunk { constructor() { super('gAMA'); this.gamma = 1.0; } parseRaw() { const view = new DataView(this.chunkRaw,0); this.gamma = view.getUint32(0,false) / 100000; } generateRaw() { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 4) { this.chunkRaw = new ArrayBuffer(4); } this.chunkLength = 4; const view = new DataView(this.chunkRaw,0); view.setUint32(0,this.gamma * 100000,false); } } PNGchunk.registerChunk('gAMA',gAMA); class sRGB extends PNGchunk { constructor() { super('sRGB'); this.renderingIntent = 0; } parseRaw() { const view = new DataView(this.chunkRaw,0); this.renderingIntent = view.getUint8(0); } generateRaw() { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 1) { this.chunkRaw = new ArrayBuffer(1); } this.chunkLength = 1; const view = new DataView(this.chunkRaw,0); view.setUint8(0,this.renderingIntent); } } PNGchunk.registerChunk('sRGB',sRGB); class IEND extends PNGchunk { constructor() { super('IEND'); } generateRaw() { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 0) { this.chunkRaw = new ArrayBuffer(0); } this.chunkLength=0; } } PNGchunk.registerChunk('IEND',IEND); class IDAT extends PNGchunk { constructor() { super('IDAT'); } generateRaw() { if (this.chunkRaw == null) { this.chunkRaw = new ArrayBuffer(0); this.chunkLength=0; } } } PNGchunk.registerChunk('IDAT',IDAT); class IHDR extends PNGchunk { constructor() { super('IHDR'); this.width = 0; this.height = 0; this.bitDepth = 32; this.colorType = 0; this.compression = 0; this.filter = 0; this.interlace = 0; } parseRaw() { const view = new DataView(this.chunkRaw,0); this.width = view.getUint32(0,false); this.height = view.getUint32(4,false); this.bitDepth = view.getUint8(8); this.colorType = view.getUint8(9); this.compression = view.getUint8(10); this.filter = view.getUint8(11); this.interlace = view.getUint8(12); } generateRaw() { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 13) { this.chunkRaw = new ArrayBuffer(13); } this.chunkLength = 13; const view = new DataView(this.chunkRaw,0); view.setUint32(0,this.width,false); view.setUint32(4,this.height,false); view.setUint8(8,this.bitDepth); view.setUint8(9,this.colorType); view.setUint8(10,this.compression); view.setUint8(11,this.filter); view.setUint8(12,this.interlace); } } PNGchunk.registerChunk('IHDR',IHDR); class PLTE extends PNGchunk { constructor() { super('PLTE'); this.palette = []; } parseRaw() { const view = new DataView(this.chunkRaw,0); const l = this.chunkLength; let i = 0; this.palette = []; while (i < l) { const p = [view.getUint8(i+0),view.getUint8(i+1),view.getUint8(i+2)]; this.palette.push(p); i+=3; } } generateRaw() { const l = this.palette.length * 3; if (this.chunkRaw == null || this.chunkRaw.byteLength !== l) { this.chunkRaw = new ArrayBuffer(l); } this.chunkLength = l; const view = new DataView(this.chunkRaw,0); let i = 0; while (i < l / 3) { const p = this.palette[i]; view.setUint8(i*3+0,p[0]); view.setUint8(i*3+1,p[1]); view.setUint8(i*3+2,p[2]); i++; } } } PNGchunk.registerChunk('PLTE',PLTE); class tRNS extends PNGchunk { constructor() { super('tRNS'); this.colorType = -1; this.alphas = 0; } parseRaw() { const view = new DataView(this.chunkRaw,0); const l = this.chunkLength; } reparseRaw(colorType) { this.colorType = colorType; const view = new DataView(this.chunkRaw,0); if (colorType === 0) { this.alphas = view.getUint16(0, false); } else if (colorType === 2) { this.alphas = [view.getUint16(0,false),view.getUint16(2,false),view.getUint16(4,false)]; } else if (colorType === 3) { this.alphas = []; const l = this.chunkLength; for (let i=0;i<l;i++) { this.alphas.push(view.getUint8(i)); } } else { throw new Error('color type error in tRNS chunk. require set.'); } } generateRaw() { if (this.colorType === 0) { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 2) { this.chunkRaw = new ArrayBuffer(2); } this.chunkLength = 2; const view = new DataView(this.chunkRaw,0); let alpha = this.alphas; if (Array.isArray(alpha)) { alpha = alpha[0]; } view.setUint16(0,alpha,false); } else if (this.colorType === 2) { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 6) { this.chunkRaw = new ArrayBuffer(6); } this.chunkLength = 6; const view = new DataView(this.chunkRaw,0); view.setUint16(0,this,alphas[0],false); view.setUint16(2,this,alphas[1],false); view.setUint16(4,this,alphas[2],false); } else if (this.colorType === 3) { if (Array.isArray(this.alphas)) { const l = this.alphas.length; if (this.chunkRaw == null || this.chunkRaw.byteLength !== l) { this.chunkRaw = new ArrayBuffer(l); } this.chunkLength = l; const view = new DataView(this.chunkRaw,0); let i = 0; for (let i=0;i<l;i++) { view.setUint8(i, this.alphas[i]); } } else { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 1) { this.chunkRaw = new ArrayBuffer(1); } this.chunkLength = 1; const view = new DataView(this.chunkRaw,0); view.setUint8(0, this.alphas); } } else { throw new Error('color type error in tRNS chunk. require set.'); } } } PNGchunk.registerChunk('tRNS',tRNS); class pHYs extends PNGchunk { constructor() { super('pHYs'); this.pixelDimensionsX = 1; this.pixelDimensionsY = 1; this.unit = 0; } parseRaw() { const view = new DataView(this.chunkRaw,0); this.pixelDimensionsX = view.getUint32(0,false); this.pixelDimensionsY = view.getUint32(4,false); this.unit = view.getUint8(8); } generateRaw() { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 9) { this.chunkRaw = new ArrayBuffer(9); } this.chunkLength = 9; const view = new DataView(this.chunkRaw,0); view.setUint32(0,this.pixelDimensionsX,false); view.setUint32(4,this.pixelDimensionsY,false); view.setUint8(8,this.unit); } } PNGchunk.registerChunk('pHYs',pHYs); class tEXt extends PNGchunk { constructor() { super('tEXt'); this.key = ''; this.text = ''; } parseRaw() { const view = new DataView(this.chunkRaw,0); let l = this.chunkLength; let i = 0; let v = ''; while (l > 0) { const c = view.getUint8(i); if (c === 0) { this.key = v; v=''; } else { v += String.fromCharCode(c); } i++; l--; } this.text = v; } generateRaw() { const l = this.key.length + this.text.length + 1; if (this.chunkRaw == null || this.chunkRaw.byteLength !== l) { this.chunkRaw = new ArrayBuffer(l); } this.chunkLength = l; const view = new DataView(this.chunkRaw,0); let o = 0; let i; for (i=0;i<this.key.length;i++) { view.setUint8(o,this.key.charCodeAt(i)); o++; } view.setUint8(o,0); o++; for (i=0;i<this.text.length;i++) { view.setUint8(o,this.text.charCodeAt(i)); o++; } } } PNGchunk.registerChunk('tEXt',tEXt); // for animated PNG class acTL extends PNGchunk { constructor() { super('acTL'); this.num_frames = 0; this.num_plays = 1; } parseRaw() { const view = new DataView(this.chunkRaw,0); this.num_frames = view.getUint32(0,false); this.num_plays = view.getUint32(4,false); } generateRaw() { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 8) { this.chunkRaw = new ArrayBuffer(8); } this.chunkLength = 8; const view = new DataView(this.chunkRaw,0); view.setUint32(0,this.num_frames,false); view.setUint32(4,this.num_plays,false); } } PNGchunk.registerChunk('acTL',acTL); class fcTL extends PNGchunk { constructor() { super('fcTL'); this.sequence_number = 0; this.width = 1; this.height = 1; this.x_offset = 0; this.y_offset = 0; this.delay_num = 500; this.delay_den = 1; this.dispose_op = 0; this.blend_op = 0; } parseRaw() { const view = new DataView(this.chunkRaw,0); this.sequence_number = view.getUint32(0,false); this.width = view.getUint32(4,false); this.height = view.getUint32(8,false); this.x_offset = view.getUint32(12,false); this.y_offset = view.getUint32(16,false); this.delay_num = view.getUint16(20,false); this.delay_den = view.getUint16(22,false); this.dispose_op = view.getUint8(24); this.blend_op = view.getUint8(25); } generateRaw() { if (this.chunkRaw == null || this.chunkRaw.byteLength !== 26) { this.chunkRaw = new ArrayBuffer(26); } this.chunkLength = 26; const view = new DataView(this.chunkRaw,0); view.setUint32(0,this.sequence_number,false); view.setUint32(4,this.width,false); view.setUint32(8,this.height,false); view.setUint32(12,this.x_offset,false); view.setUint32(16,this.y_offset,false); view.setUint16(20,this.delay_num,false); view.setUint16(22,this.delay_den,false); view.setUint8(24,this.dispose_op); view.setUint8(25,this.blend_op); } } PNGchunk.registerChunk('fcTL',fcTL); class fdAT extends PNGchunk { constructor() { super('fdAT'); this.sequence_number = 0; this.imageRaw = new ArrayBuffer(0); } parseRaw() { const view = new DataView(this.chunkRaw,0); this.sequence_number = view.getUint32(0,false); this.imageRaw = this.chunkRaw.slice(4); } generateRaw() { const l = 4+this.imageRaw.byteLength; if (this.chunkRaw == null || this.chunkRaw.byteLength !== l) { this.chunkRaw = new ArrayBuffer(l); } this.chunkLength = l; const setFromArrayBuffer = (ui8, buf, o) => { const views = new Uint8Array(buf); ui8.set(views, o); } const view = new DataView(this.chunkRaw,0); view.setUint32(0,this.sequence_number,false); const view8 = new Uint8Array(this.chunkRaw,0); setFromArrayBuffer(view8, this.imageRaw, 4); } } PNGchunk.registerChunk('fdAT',fdAT); class PNGsignature { static signature = new Uint8Array([137,80,78,71,13,10,26,10]); constructor() { this.chunks = []; } static check(f) { const view = new Uint8Array(f.slice(0,8)); if (view.length !== 8) return false; if (view.join(',') !== this.signature.join(',')) return false; return true; } getRaw() { return this.constructor.signature; } static createFromRaw(f) { let o = 0; if (PNGsignature.check(f)) { const p = new PNGsignature(); o += 8; let colorType = -1; while (o < f.byteLength) { var pc = PNGchunk.createFromRaw(f,o); o += pc.chunkLength + 12; p.chunks.push(pc); if (pc.chunkType==='IHDR') { colorType = pc.colorType; } else if (pc.chunkType==='tRNS') { pc.reparseRaw(colorType); } } return p; } return null; } getBytes() { let totallength = 8; // signature length this.chunks.forEach(c => { c.generateRaw(); c.updateCrc(); totallength += 12 + c.chunkLength; }); const buf = new ArrayBuffer(totallength); let o = 0; const view8 = new Uint8Array(buf); view8.set(this.getRaw(), o); o+=8; this.chunks.forEach(c => { c.setBytes(buf, o); o += 12 + c.chunkLength; }); return buf; } } class BitReader { constructor(buf) { this.dataRaw = buf; this.view = new DataView(this.dataRaw); this.currentIndex = 0; this.remainBit = 0; this.remainData = 0; } seekOffset(n) { this.currentIndex = n; this.remainBit = 0; } getOffset() { return this.currentIndex; } alignByte() { this.remainBit = 0; } getUint8() { this.remainBit = 0; const data = this.view.getUint8(this.currentIndex); this.currentIndex+=1; return data; } getUint16(f) { this.remainBit = 0; const data = this.view.getUint16(this.currentIndex,f); this.currentIndex+=2; return data; } getUint32(f) { this.remainBit = 0; const data = this.view.getUint32(this.currentIndex,f); this.currentIndex+=4; return data; } getBits(n,f) { return f ? this.getBitsN(n) : this.getBitsR(n); } getBitsN(n) { let work = 0; while (n > 0) { if (this.remainBit === 0) { if (this.currentIndex >= this.dataRaw.byteLength) { return -1; } this.remainBit = 8; this.remainData = this.view.getUint8(this.currentIndex); this.currentIndex++; } work = (work << 1) | (this.remainData & 1); this.remainData >>>= 1; this.remainBit--; n--; } return work; } getBitsR(n) { let work = 0; let base = 0; while (n > 0) { if (this.remainBit === 0) { if (this.currentIndex >= this.dataRaw.byteLength) { return -1; } this.remainBit = 8; this.remainData = this.view.getUint8(this.currentIndex); this.currentIndex++; } if (n <= this.remainBit) { const m = (1 << n)-1; work |= (this.remainData & m) << base; this.remainData >>>= n; this.remainBit-=n; n=0; } else { const m = (1 << this.remainBit)-1 work |= (this.remainData & m) << base; base+=this.remainBit; n-=this.remainBit; this.remainBit=0; } } return work; } } class CRC32 { static crc_table=[]; static crc_table_computed = false; static make_crc_table() { for (let i = 0; i < 256; i++) { let c = i; for (let j = 0; j < 8; j++) { if (c & 1 !== 0) { c = 0xedb88320 ^ (c >>> 1); } else { c = c >>> 1; } } this.crc_table[i] = c >>> 0; } this.crc_table_computed = true; } constructor() { this.reset(); } reset() { this.crc = 0xffffffff; } update(buf) { let c = this.crc; if (!this.constructor.crc_table_computed) { this.constructor.make_crc_table(); } let u8array = buf; if (u8array instanceof ArrayBuffer) { u8array = new Uint8Array(buf); } const l = u8array.length; for (let i = 0; i < l; i++) { const n = u8array[i]; c = ( this.constructor.crc_table[(c ^ n) & 0xff] ^ (c >>> 8) ) >>> 0; } this.crc = c; return c; } finish() { return (this.crc ^ 0xffffffff) >>> 0; } } class ADLER32 { constructor() { this.reset(); } reset() { this.a = 1; this.b = 0; } update(buf) { let a = this.a; let b = this.b; let u8array = buf; if (u8array instanceof ArrayBuffer) { u8array = new Uint8Array(buf); } let l = u8array.length; let i = 0; while (l > 0) { const tl = l > 5550 ? 5550 : l; l -= tl; while (tl > 0) { const n = u8array[i]; a += n; b += a; i++; tl--; } a %= 65521; b %= 65521; } this.a = a; this.b = b; } finish() { return ((b << 16) | a) >>> 0; } } function makeHdict(lens) { const dict={}; const lencount={}; let l; let i; let maxcode=0; let maxlen=0; let minlen=999; // step1 for(i=0,l=lens.length;i<l;++i) { const len=lens[i]; if (len>0) { lencount[len]=(typeof lencount[len]==='undefined')?1:lencount[len]+1; if (len>maxlen) { maxlen=len; } if (len<minlen) { minlen=len; } } } maxcode=lens.length-1; // step2 let code=0; const ncode=[]; lencount[0] = 0; for (i=1;i<=maxlen;++i) { code=(code+lencount[i-1]) << 1; ncode[i]=code; } // step3 for (i=0;i<=maxcode;++i) { l=lens[i]; if (l!=0) { if (typeof dict[l]==='undefined') { dict[l]={}; } dict[l][ncode[l]]=i; ++ncode[l]; } } dict["min"]=minlen; dict["max"]=maxlen; return dict; } function makeLengthTable() { const dict = {}; let i; const f = (s,e,l,x,n) => { for (i=s;i<=e;++i,l+=n) { dict[i]=[l,x]; } } f(257, 264, 3, 0, 1); f(265, 268, 11, 1, 2); f(269, 272, 19, 2, 4); f(273, 276, 35, 3, 8); f(277, 280, 67, 4,16); f(281, 284,115, 5,32); f(285, 285,258, 0, 0); return dict; } function makeOffsetTable() { const dict = {}; let i; for(i=0;i<=3;i++) { dict[i]=[i+1,0]; } let x=1; let l=5; let n=2; for(i=4;i<=29;i+=2,++x) { dict[i]=[l,x]; l+=n; dict[i+1]=[l,x]; l+=n; n=n<<1; } return dict; } function makeFixHDict() { const dict = {}; let i; const f = (b,s,e,k) => { if (typeof dict["min"] === "undefined") { dict["min"]=b; dict["max"]=b; } else { if (b < dict["min"]) { dict["min"]=b; } if (b > dict["max"]) { dict["max"]=b; } } if (typeof dict[b] === "undefined") { dict[b]={}; } for (i=0;i<=(e-s);++i) { dict[b][k+i]=s+i; } } f(8, 0,143, 0x30); f(9,144,255,0x190); f(7,256,279, 0x0); f(8,280,287, 0xc0); return dict; } function makeFixODict() { const dict = {}; dict["min"]=5; dict["max"]=5; dict[5]={}; for (i=0;i<=31;++i) { dict[5][i]=i; } return dict; } function inflate(buf) { const bs = new BitReader(buf); const readHfcore = (bs,dict) => { let bit = dict["min"]; let data = bs.getBits(bit,true); while (bit <= dict["max"]) { if (typeof dict[bit][data] !== "undefined") { return dict[bit][data]; } bit++; data = (data << 1) | bs.getBits(1,true); } return -1; } const readHfLens = (bs,n,dict) => { const lens=[]; let prev=0; for (let i=0;i<n;) { const code=readHfcore(bs,dict); if (code<=15) { lens[i]=code; prev=code; ++i; } else if (code<=18) { const b=(code===18)?11:3; const e=(code===16)?2:(code===17)?3:7; const l=bs.getBits(e,false)+b; if (code!==16) { prev=0; } for (let j=0;j<l;++j,++i) { lens[i]=prev; } } else { throw new Error('code error'); } } return lens; } if (false) { console.log('CM='+bs.getBits(4,false)); console.log('CINFO='+bs.getBits(4,false)); console.log('FCHECK='+bs.getBits(5,false)); console.log('FDICT='+bs.getBits(1,false)); console.log('FLEVEL='+bs.getBits(2,false)); } let f=0; let outbuf=[]; const lobjtbl=makeLengthTable(); const oobjtbl=makeOffsetTable(); while (f===0) { f = bs.getBits(1,false); const c = bs.getBits(2,false); if (c === 0) { bs.alignByte(); const l = bs.getUint16(true); const nl = bs.getUint16(true); bs.seekOffset(bs.getOffset()+l); const ad32=bs.getUint32(true); } else { let hfdict = {}; let hodict = {}; if (c === 2) { const hlit = bs.getBits(5,false)+257; const hdist = bs.getBits(5,false)+1; const hclen = bs.getBits(4,false)+4; const cllens = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; const clindex = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; for (let i=0;i<hclen;i++) { cllens[clindex[i]]=bs.getBits(3,false); } const hdict=makeHdict(cllens); const hflens=readHfLens(bs,hlit,hdict); const holens=readHfLens(bs,hdist,hdict); hfdict=makeHdict(hflens); hodict=makeHdict(holens); } else { hfdict = makeFixHDict(); hodict = makeFixODict(); } while(true) { let code=readHfcore(bs,hfdict) if (code === -1) { throw new Error('cause error') } else if (code <= 255) { outbuf.push(code); } else if (code === 256) { break; } else if (code <= 285) { let lobj=lobjtbl[code]; let blen=lobj[0]+bs.getBits(lobj[1],false); code=readHf(bs,hodict); if (code === -1) { throw new Error('cause error') } let oobj=oobjtbl[code]; let boff=oobj[0]+bs.getBits(oobj[1],false); let o=outbuf.length-boff; for (let i=0;i<blen;++i,o++) { outbuf.push(outbuf[o]); } } } } } // console.log(outbuf); return outbuf; } const PluginPNG = { '初期化': { type: 'func', josi: [], pure: true, fn: function (sys) { if (sys._weyk_png) {return} sys._weyk_png = { clearAll: function () { const me = this } } } }, '!クリア': { type: 'func', josi: [], pure: true, fn: function (sys) { sys._weyk_png.clearAll() } }, // @PNGファイル 'PNG作成': { // @空のPNGファイルオブジェクトを作成して返す // @PNGさくせい type: 'func', josi: [], pure: true, fn: function (sys) { return new PNGsignature() } }, 'PNG読込': { // @バッファからPNGファイルオブジェクトを作成して返す // @PNGよみこみ type: 'func', josi: [['から','を']], pure: true, fn: function (f, sys) { return PNGsignature.createFromRaw(f) } }, 'PNG取出': { // @PNGファイルオブジェクトからバッファを取り出して返す // @PNGとりだし type: 'func', josi: [['から','を']], pure: true, fn: function (png, sys) { return png.getBytes() } }, 'PNGチャンク追加': { // @PNGファイルオブジェクトにチャンクを追加する // @PNGちゃんくついか type: 'func', josi: [['に'],['を']], pure: true, fn: function (png, chunk, sys) { png.chunks.push(chunk) } }, 'PNGチャンク配列取得': { // @PNGファイルオブジェクトからチャンクの配列を取得して返す // @PNGちゃんくはいれつしゅとく type: 'func', josi: [['から','の']], pure: true, fn: function (png, sys) { return png.chunks } }, 'PNGチャンク配列設定': { // @PNGファイルオブジェクトのチャンクの配列を置き換える // @PNGちゃんくはいれつせってい type: 'func', josi: [['の'],['を']], pure: true, fn: function (png, chunks, sys) { png.chunks = chunks } }, 'PNGチャンク配列クリア': { // @PNGファイルオブジェクトのチャンクの配列をクリアする // @PNGちゃんくはいれつくりあ type: 'func', josi: [['から','の']], pure: true, fn: function (png, sys) { png.chunks=[] } }, 'PNGチャンク作成': { // @PNGのチャンクの配列を作成して返す // @PNGちゃんくさくせい type: 'func', josi: [['の']], pure: true, fn: function (chunktype, sys) { const c = PNGchunk.registeredChunk.get(chunktype) let chunk = null; if (c !== undefined) { chunk = new c(); } else { chunk = new PNGchunk(chunktype); } return chunk } }, 'PNGInflate': { // @PNGに含まれるDeflateの伸長を行い返す // @PNGInflate type: 'func', josi: [['を']], pure: true, fn: function (buf, sys) { return inflate(buf); } } } if (typeof (navigator) === 'object' && typeof (navigator.nako3)) {navigator.nako3.addPluginObject('PluginPNG', PluginPNG)}
⭐ てぃふと@うぇいく 作
タイトル:
plugin_weykpng PNGファイル操作Plugin
ライセンス:
未指定 (未指定/貯蔵庫のみ)
タイプ:
js
タグ:
-
利用バージョン:
3.2.27
作成日時:
2021/10/12 22:04 (編集: 2021/10/15 21:12)
公開の投稿
⭐
ログイン
して★を付けよう!
Twitterへ投稿
📝作品を編集
作品公開情報
📍この作品のURL:
📍アプリ(即時実行)のURL:
📍アプリ(実行ボタンあり)のURL:
📍ブログパーツ:
上記HTML↑をブログに貼り付けることでアプリを埋め込めます。
📍ライブラリ直リンク - 『!「***」を取込』で使うとき:
通報数:
0
通報って何?