Skip to main content

Command line tool to generate razor-sharp Xiangqi (Chinese chess) setup graphics

Project description

xiangqi-setup (and xiangqi-board)

xiangqi-setup is a command line tool using svgutils 0.3.1 to render Xiangqi (Chinese chess) board setups from WXF files to SVG images.

The most simple way to render a given setup is:

# xiangqi-setup input.wxf output.svg

For demo.wxf, the result is:

(left: default board, default pieces — right: default board, euro_xiangqi_js pieces)

There are a number of themes to pick from for board and pieces (independently). The --help listing below also includes the list of all themes and their license information.

The default board theme clean_alpha has been generated with command line tool xiangqi-board that is included with the xiangqi-setup package. It can be used to create variations of the detault theme, e.g. to create a version with reduced spacing in crosses you would run:

# xiangqi-board --cross-gap-px 2 board.{svg,ini}

Usage

xiangqi-setup — render WXF files to SVG images

# xiangqi-setup --help
usage: xiangqi-setup [-h] [--board THEME] [--pieces THEME]
                     [--width-px PIXEL | --width-cm CENTIMETER] [--dpi FLOAT]
                     [--scale-pieces FACTOR] [--debug] [--version]
                     INPUT_FILE OUTPUT_FILE

positional arguments:
  INPUT_FILE            location of WXF file to render
  OUTPUT_FILE           location of SVG output file to write

optional arguments:
  -h, --help            show this help message and exit
  --debug               enable debugging (e.g. mark corners of the board)
  --version             show program's version number and exit

theme selection:
  --board THEME         name of board theme to use (default: "clean_alpha";
                        please check the list of available themes below
  --pieces THEME        name of pieces theme to use (default: "retro_simple";
                        please check the list of available themes below

scaling:
  --width-px PIXEL      width of the output in pixels
  --width-cm CENTIMETER
                        width of the output in centimeters
  --dpi FLOAT           resolution of the output in dots per inch
  --scale-pieces FACTOR
                        factor to scale pieces by (0.0 to 1.2, default: 0.9)

available board themes (in alphabetic order):
  a4_blank_2cm_margin                        (license: CC0-1.0)
  cambaluc_remake_nolegend                   (license: CC0-1.0)
  cambaluc_remake_nolegend_nogap             (license: CC0-1.0)
  ccbridge_3_0_beta4_default_preview_remake  (license: CC0-1.0)
  clean_alpha                                (license: CC0-1.0)
  clean_beta                                 (license: CC0-1.0)
  commons_xiangqi_board_2008                 (license: public-domain)
  commons_xiangqi_board_2008_bw_thin         (license: public-domain)
  dhtmlxq_2014_remake                        (license: CC0-1.0)
  latex_xq_remake                            (license: CC0-1.0)
  minimal                                    (license: CC0-1.0)
  minimal_chinese                            (license: CC0-1.0)
  minimal_chinese_arabic                     (license: CC0-1.0)
  playok_2014_remake                         (license: CC0-1.0)
  western_red_wine                           (license: CC0-1.0)
  xiexie_2_5_0_remake_minimal                (license: CC0-1.0)

available pieces themes (in alphabetic order):
  ccbridge_3_0_beta4_default_preview_remake  (license: CC0-1.0)
  commons_xiangqi_pieces_print_2010          (license: FDL-1.2+ / CC-BY-SA-4.0)
  commons_xiangqi_pieces_print_2010_bw_heavy (license: FDL-1.2+ / CC-BY-SA-4.0)
  euro_xiangqi_js                            (license: CC-BY-4.0)
  latex_xqlarge_2006_chinese_autotrace       (license: non-commercial)
  latex_xqlarge_2006_chinese_potrace         (license: non-commercial)
  playok_2014_chinese                        (license: CC0-1.0)
  playok_2014_chinese_noshadow               (license: CC0-1.0)
  retro_simple                               (license: CC0-1.0)

xiangqi-board — create custom board themes

# xiangqi-board --help
usage: xiangqi-board [-h] [--line-thickness-px FLOAT] [--field-width-px FLOAT]
                     [--field-height-px FLOAT] [--border-thickness-px FLOAT]
                     [--border-gap-width-px FLOAT]
                     [--border-gap-height-px FLOAT] [--cross-width-px FLOAT]
                     [--cross-thickness-px FLOAT] [--cross-gap-px FLOAT]
                     SVG_FILE INI_FILE

positional arguments:
  SVG_FILE
  INI_FILE

optional arguments:
  -h, --help            show this help message and exit
  --line-thickness-px FLOAT
                        Line thickness of square fields in pixel (default: 1)
  --field-width-px FLOAT
                        Width of fields in pixel (default: 53)
  --field-height-px FLOAT
                        Height of fields in pixel (default: 53)
  --border-thickness-px FLOAT
                        Line thickness of border in pixel (default: 2)
  --border-gap-width-px FLOAT
                        Widtn of gap to border in pixel (default: 40)
  --border-gap-height-px FLOAT
                        Height of gap to border in pixel (default: 40)
  --cross-width-px FLOAT
                        Width of starting position cross segments in pixel
                        (default: 10)
  --cross-thickness-px FLOAT
                        Line thickness of starting position cross in pixel
                        (default: 1)
  --cross-gap-px FLOAT  Gap to starting position cross in pixel (default: 4)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xiangqi-setup-1.5.0.tar.gz (961.1 kB view details)

Uploaded Source

Built Distributions

xiangqi_setup-1.5.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

xiangqi_setup-1.5.0-py2-none-any.whl (1.2 MB view details)

Uploaded Python 2

File details

Details for the file xiangqi-setup-1.5.0.tar.gz.

File metadata

  • Download URL: xiangqi-setup-1.5.0.tar.gz
  • Upload date:
  • Size: 961.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.10

File hashes

Hashes for xiangqi-setup-1.5.0.tar.gz
Algorithm Hash digest
SHA256 2cf67e887c3d2de14c5a9680acde900762e155670ffc0cb4460da96ee6976d51
MD5 4fbc4b2aea74ccd99dc297fc3ea69fe4
BLAKE2b-256 c9e0278772bae708e45c4ef51c2fc8f1944864e3f01e70717ac3232251a603ca

See more details on using hashes here.

File details

Details for the file xiangqi_setup-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: xiangqi_setup-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.10

File hashes

Hashes for xiangqi_setup-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6611b9761020f13fc1232be4d2529c2c0ad64ea62fdcbdd5ceb85dc2fb5964b1
MD5 b83c9186381ecd4e62cf90b5f0074c50
BLAKE2b-256 e519417bc693870e25c996fea6a103c7142fea45d1c786cfc48d42ac996d23c6

See more details on using hashes here.

File details

Details for the file xiangqi_setup-1.5.0-py2-none-any.whl.

File metadata

  • Download URL: xiangqi_setup-1.5.0-py2-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.10

File hashes

Hashes for xiangqi_setup-1.5.0-py2-none-any.whl
Algorithm Hash digest
SHA256 cbba2113244aecec79449270e1bf230826f6de131f1335a1bc50ba6dde6b133d
MD5 21876e26f6b10076fef7117276894e20
BLAKE2b-256 9fec186c76683ec4e92f4cb000972ec8c00c787def771c4b71a324462044516b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page