UNPKG

ducjs

Version:

The duc 2D CAD file format is a cornerstone of our advanced design system, conceived to cater to professionals seeking precision and efficiency in their design work.

112 lines (111 loc) 4.39 kB
// automatically generated by the FlatBuffers compiler, do not modify /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; export class StrokeStyle { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsStrokeStyle(bb, obj) { return (obj || new StrokeStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsStrokeStyle(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new StrokeStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } preference() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.readUint8(this.bb_pos + offset) : null; } cap() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readUint8(this.bb_pos + offset) : null; } join() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.readUint8(this.bb_pos + offset) : null; } dash(index) { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0; } dashLength() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } dashArray() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; } dashLineOverride(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } dashCap() { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? this.bb.readUint8(this.bb_pos + offset) : null; } miterLimit() { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? this.bb.readFloat64(this.bb_pos + offset) : null; } static startStrokeStyle(builder) { builder.startObject(7); } static addPreference(builder, preference) { builder.addFieldInt8(0, preference, null); } static addCap(builder, cap) { builder.addFieldInt8(1, cap, null); } static addJoin(builder, join) { builder.addFieldInt8(2, join, null); } static addDash(builder, dashOffset) { builder.addFieldOffset(3, dashOffset, 0); } static createDashVector(builder, data) { builder.startVector(8, data.length, 8); for (let i = data.length - 1; i >= 0; i--) { builder.addFloat64(data[i]); } return builder.endVector(); } static startDashVector(builder, numElems) { builder.startVector(8, numElems, 8); } static addDashLineOverride(builder, dashLineOverrideOffset) { builder.addFieldOffset(4, dashLineOverrideOffset, 0); } static addDashCap(builder, dashCap) { builder.addFieldInt8(5, dashCap, null); } static addMiterLimit(builder, miterLimit) { builder.addFieldFloat64(6, miterLimit, null); } static endStrokeStyle(builder) { const offset = builder.endObject(); return offset; } static createStrokeStyle(builder, preference, cap, join, dashOffset, dashLineOverrideOffset, dashCap, miterLimit) { StrokeStyle.startStrokeStyle(builder); if (preference !== null) StrokeStyle.addPreference(builder, preference); if (cap !== null) StrokeStyle.addCap(builder, cap); if (join !== null) StrokeStyle.addJoin(builder, join); StrokeStyle.addDash(builder, dashOffset); StrokeStyle.addDashLineOverride(builder, dashLineOverrideOffset); if (dashCap !== null) StrokeStyle.addDashCap(builder, dashCap); if (miterLimit !== null) StrokeStyle.addMiterLimit(builder, miterLimit); return StrokeStyle.endStrokeStyle(builder); } }