Project

shogi_koma

0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
An image generator for Shogi's pieces (it's "ko-ma" in Japanese) for Ruby by cairo.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
>= 0.0.2
 Project Readme

ShogiKoma

An image generator for Shogi's pieces (it's "ko-ma" in Japanese) for Ruby by cairo.

It supports one or two characters.

fu1 fu2

Requirements

Installation

Add this line to your application's Gemfile:

gem "shogi_koma"

And then execute:

$ bundle

Or install it yourself as:

$ gem install shogi_koma

Usage

Write to PNG

require "shogi_koma"

painter = ShogiKoma::Painter.new
#painter.width = 200        # as default
#painter.height = 200       # as default
#painter.font = "xxx"       # default: "Hiragino Mincho" or "MS Mincho" or "Noto"
painter.write_to_png("歩", "shogi_koma-fu1.png")
painter.write_to_png("歩兵", "shogi_koma-fu2.png")

Draw to Cairo::Context

require "cairo"
require "shogi_koma"

width  = 200
height = 200

Cairo::ImageSurface.new(:argb32, width, height) do |surface|
  Cairo::Context.new(surface) do |context|
    context.scale(width, height)
    painter = ShogiKoma::Painter.new
    painter.draw(context, "歩")
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request