README

f4ah6o/jww_parser/core does not have a README file

#
Arc

pub struct Arc {
base : EntityBase
center_x : Double
center_y : Double
radius : Double
start_angle : Double
arc_angle : Double
tilt_angle : Double
flatness : Double
is_full_circle : Bool
}

円弧/円エンティティ (JWWクラス: CDataEnko)
impl Eq for Arc
impl Show for Arc

#
ArcSolid

pub struct ArcSolid {
base : EntityBase
center_x : Double
center_y : Double
radius : Double
flatness : Double
tilt_angle : Double
start_angle : Double
arc_angle : Double
solid_param : Double
color : UInt
}

円弧/円ソリッドエンティティ (CDataSolid, pen_style >= 101)
impl Eq for ArcSolid
impl Show for ArcSolid

#
Block

pub struct Block {
base : EntityBase
ref_x : Double
ref_y : Double
scale_x : Double
scale_y : Double
rotation : Double
def_number : UInt
}

ブロック挿入エンティティ (JWWクラス: CDataBlock)
impl Eq for Block
impl Show for Block

#
BlockDef

pub struct BlockDef {
base : EntityBase
number : UInt
is_referenced : Bool
name : String
entities : Array[Entity]
}

ブロック定義
impl Eq for BlockDef
impl Show for BlockDef

#
Document

pub struct Document {
version : UInt
memo : String
paper_size : UInt
write_layer_group : UInt
layer_groups : Array[LayerGroup]
entities : Array[Entity]
block_defs : Array[BlockDef]
embedded_images : Array[EmbeddedImage]
print_settings : PrintSettings
sunpou_settings : SunpouSettings
metadata_settings : MetadataSettings
}

JWWドキュメント全体
impl Eq for Document
impl Show for Document

#
Document::default

fn Document::default() -> Document

Documentのデフォルト値

#
EmbeddedImage

pub struct EmbeddedImage {
index : UInt
file_size : UInt
data : Bytes
format : ImageFormat
}

同梱画像データ (Ver.7.00+)
impl Eq for EmbeddedImage

#
Entity

pub enum Entity {
Line(Line)
Arc(Arc)
Point(Point)
Text(Text)
Solid(Solid)
ArcSolid(ArcSolid)
Block(Block)
Image(Image)
}

エンティティ種別
impl Eq for Entity
impl Show for Entity

#
Entity::base

fn Entity::base(self : Entity) -> EntityBase

エンティティの基本属性を取得

#
Entity::type_name

fn Entity::type_name(self : Entity) -> String

エンティティタイプ名を取得

#
EntityBase

pub struct EntityBase {
group : UInt
pen_style : Byte
pen_color : UInt16
pen_width : UInt16
layer : UInt16
layer_group : UInt16
flag : UInt16
}

全エンティティに共通する属性
impl Eq for EntityBase
impl Show for EntityBase

#
EntityBase::default

fn EntityBase::default() -> EntityBase

EntityBaseのデフォルト値

#
Image

pub struct Image {
base : EntityBase
image_path : String
x : Double
y : Double
width : Double
height : Double
rotation : Double
}

画像エンティティ (CDataMojiの^@BM形式から変換)
impl Eq for Image
impl Show for Image

#
ImageFormat

pub enum ImageFormat {
Unknown
Jpeg
Png
Bmp
Gif
}

画像フォーマット種別(マジックバイトから検出)
impl Eq for ImageFormat
impl Show for ImageFormat

#
Layer

pub struct Layer {
state : UInt
protect : UInt
name : String
}

個別レイヤ
impl Eq for Layer
impl Show for Layer

#
Layer::default

fn Layer::default() -> Layer

Layerのデフォルト値

#
LayerGroup

pub struct LayerGroup {
state : UInt
write_layer : UInt
scale : Double
protect : UInt
layers : Array[Layer]
name : String
}

レイヤグループ(16個のレイヤを含む)
impl Eq for LayerGroup
impl Show for LayerGroup

#
LayerGroup::default

fn LayerGroup::default() -> LayerGroup

LayerGroupのデフォルト値

#
Line

pub struct Line {
base : EntityBase
start_x : Double
start_y : Double
end_x : Double
end_y : Double
}

直線エンティティ (JWWクラス: CDataSen)
impl Eq for Line
impl Show for Line

#
MetadataSettings

pub struct MetadataSettings {
printer_paper_size : String
draw_bmp_touka : String
view_direct2d : String
printer_bmp_zentai : String
printer_orientation : String
printer_d2d_bmp : String
}

メタデータ設定(CDataMojiに埋め込まれた設定情報)

#
MetadataSettings::default

MetadataSettingsのデフォルト値

#
ParseError

pub enum ParseError {
InvalidSignature
UnsupportedVersion(UInt)
UnknownClassPid(UInt)
UnknownEntityClass(String)
UnexpectedEof
IoError(String)
Other(String)
}

JWWファイルパース時のエラー型

#
ParseError::to_string

fn ParseError::to_string(self : ParseError) -> String

エラーメッセージを取得

#
Point

pub struct Point {
base : EntityBase
x : Double
y : Double
is_temporary : Bool
code : UInt
angle : Double
scale : Double
}

点エンティティ (JWWクラス: CDataTen)
impl Eq for Point
impl Show for Point

#
PrintSettings

pub struct PrintSettings {
origin_x : Double
origin_y : Double
scale : Double
rotation_setting : UInt
}

印刷設定情報
impl Eq for PrintSettings

#
Reader

pub struct Reader {
data : Array[Byte]
pos : Int
}

バイナリデータリーダー カーソル位置を追跡しながらリトルエンディアンで読み込む

#
Reader::has_remaining

fn Reader::has_remaining(self : Reader) -> Bool

まだデータが残っているか

#
Reader::length

fn Reader::length(self : Reader) -> Int

データの長さを取得

#
Reader::new

fn Reader::new(data~ : Bytes) -> Reader

新しいリーダーを作成

#
Reader::position

fn Reader::position(self : Reader) -> Int

現在の位置を取得

#
Reader::read_byte

fn Reader::read_byte(self : Reader) -> Byte

1バイト読み込んで位置を進める

#
Reader::read_bytes

fn Reader::read_bytes(self : Reader, n~ : Int) -> Bytes

nバイト読み込む データが不足している場合は空のBytesを返す

#
Reader::read_double

fn Reader::read_double(self : Reader) -> Double

IEEE 754 double (8バイト) を読み込む

#
Reader::read_dword

fn Reader::read_dword(self : Reader) -> UInt

4バイト読み込む(リトルエンディアン、UInt32)

#
Reader::read_uint64

fn Reader::read_uint64(self : Reader) -> UInt64

8バイト読み込んでUInt64として解釈

#
Reader::read_word

fn Reader::read_word(self : Reader) -> UInt16

2バイト読み込む(リトルエンディアン、UInt16)

#
Reader::remaining

fn Reader::remaining(self : Reader) -> Int

残りのバイト数を取得

#
Reader::skip

fn Reader::skip(self : Reader, n~ : Int) -> Unit

nバイトスキップする

#
Rgb

pub struct Rgb {
r : Byte
g : Byte
b : Byte
}

RGB色 (0-255)
impl Eq for Rgb
impl Show for Rgb

#
Solid

pub struct Solid {
base : EntityBase
point1_x : Double
point1_y : Double
point2_x : Double
point2_y : Double
point3_x : Double
point3_y : Double
point4_x : Double
point4_y : Double
color : UInt
}

塗りつぶしエンティティ (JWWクラス: CDataSolid)
impl Eq for Solid
impl Show for Solid

#
SunpouSettings

pub struct SunpouSettings {
sunpou1 : UInt
sunpou2 : UInt
sunpou3 : UInt
sunpou4 : UInt
sunpou5 : UInt
dummy : UInt
max_line_width : UInt
}

日光設定(寸法設定)

#
SunpouSettings::default

SunpouSettingsのデフォルト値

#
Text

pub struct Text {
base : EntityBase
start_x : Double
start_y : Double
end_x : Double
end_y : Double
text_type : UInt
size_x : Double
size_y : Double
spacing : Double
angle : Double
font_name : String
content : String
}

文字エンティティ (JWWクラス: CDataMoji)
impl Eq for Text
impl Show for Text

#
Writer

pub struct Writer {
buffer : Array[Byte]
}

バイナリデータライター リトルエンディアンで書き込む

#
Writer::clear

fn Writer::clear(self : Writer) -> Unit

バッファをクリア

#
Writer::length

fn Writer::length(self : Writer) -> Int

現在のバッファサイズを取得

#
Writer::new

fn Writer::new() -> Writer

新しいライターを作成

#
Writer::to_bytes

fn Writer::to_bytes(self : Writer) -> Bytes

Bytesとして出力

#
Writer::write_byte

fn Writer::write_byte(self : Writer, b~ : Byte) -> Unit

1バイト書き込む

#
Writer::write_bytes

fn Writer::write_bytes(self : Writer, data~ : Bytes) -> Unit

nバイト書き込む

#
Writer::write_double

fn Writer::write_double(self : Writer, d~ : Double) -> Unit

IEEE 754 double (8バイト) を書き込む

#
Writer::write_dword

fn Writer::write_dword(self : Writer, d~ : UInt) -> Unit

4バイト書き込む(リトルエンディアン、UInt32)

#
Writer::write_word

fn Writer::write_word(self : Writer, w~ : UInt16) -> Unit

2バイト書き込む(リトルエンディアン、UInt16)

#
parse

fn parse(data~ : Bytes) -> Document

JWWファイルをパースする

#
pen_color_to_rgb

fn pen_color_to_rgb(pen_color : UInt16) -> Rgb?

基本線色(1-8)と補助線色(9)を既定RGBに変換する

既定値は Jw_win.Jwf (Sample) の画面表示色を参照

#
serialize

fn serialize(doc~ : Document) -> Bytes

JWWドキュメントをバイト列にシリアライズする

#
signature

fn signature() -> Bytes

JWWシグネチャ