{"id":17372874,"url":"https://github.com/snuyanzin/drawshell","last_synced_at":"2026-05-04T03:35:17.033Z","repository":{"id":105072613,"uuid":"153808062","full_name":"snuyanzin/drawshell","owner":"snuyanzin","description":"Drawing shell","archived":false,"fork":false,"pushed_at":"2020-02-02T13:10:32.000Z","size":92,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T22:14:57.942Z","etag":null,"topics":["drawing","shell"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snuyanzin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-19T15:57:55.000Z","updated_at":"2020-02-02T13:10:34.000Z","dependencies_parsed_at":"2024-01-07T21:03:29.980Z","dependency_job_id":null,"html_url":"https://github.com/snuyanzin/drawshell","commit_stats":{"total_commits":39,"total_committers":1,"mean_commits":39.0,"dds":0.0,"last_synced_commit":"9624b841e6d5b99d34a03edd230c1394d218ef8e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuyanzin%2Fdrawshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuyanzin%2Fdrawshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuyanzin%2Fdrawshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuyanzin%2Fdrawshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snuyanzin","download_url":"https://codeload.github.com/snuyanzin/drawshell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245907903,"owners_count":20692019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drawing","shell"],"created_at":"2024-10-16T02:04:32.212Z","updated_at":"2026-05-04T03:35:12.013Z","avatar_url":"https://github.com/snuyanzin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/snuyanzin/drawshell.svg?branch=master)](https://travis-ci.org/snuyanzin/drawshell)\n[![Build Status: Windows](https://ci.appveyor.com/api/projects/status/github/snuyanzin/drawshell?branch=master\u0026svg=true)](https://ci.appveyor.com/project/snuyanzin/drawshell)\n[![DepShield Badge](https://depshield.sonatype.org/badges/snuyanzin/drawshell/depshield.svg)](https://depshield.github.io)\n# Drawing shell\n\n## Building \u0026 Start\n### Prerequisites\n  * Maven 3.2.5 or higher\n  * Java 1.8 or higher\n### Build      \n```\nmvn package\n```\nor\n- on Linux\n    ```\n    ./mvnw package\n    ```\n- on Windows\n    ```\n    mvnw.bat package\n    ```    \nIt will create `drawingshell-1.0-SNAPSHOT.jar`. \n### Start\nThere are several ways to start: \n- On Windows: `bin\\drawingshell.bat` \n- On Linux `bin/drawingshell.sh`\n- Just using java\n  ```\n   java -Xmx8G -jar drawingshell-1.0-SNAPSHOT.jar\n  ``` \n  Memory settings are required to work with canvases up to 125000x125000 (but it could take a sufficient amount of time to have printed). In case you need much less sizes you can use lower memory settings.  \n  \nNOTE: here it is a piece of information which could help to choose suitable Xmx however on different platforms \nthe values could differ so its better to test and pay attention to this table only as a start point. \nIt also depends on number of colors in use. The table below is made for 3 colors in use. \n\n| Canvas size | Xmx |\n--------------|-----|\n| 80000 x 80000| 4Gb |\n|100000 x 100000| 6Gb |\n|125000 x 125000| 8Gb |\n  \n \n## Currently supported commands  \n \n| Command | Description |\n| ------- | ----------- |\n| `H`         | Print this help. |\n| `C w h`     | Create a new canvas of width w and height h. |\n| `L x1 y1 x2 y2` | Draw a line through points `(x1, y1)` to `(x2, y2)`. Currently only horizontal and vertical lines are supported. Horizontal and vertical lines will be drawn using `x` character. |\n| `L x1 y1 x2 y2 c` | The same as above but with color `c` specification. |\n| `R x1 y1 x2 y2` | Draw a new rectangle, whose one corner is `(x1, y1)` and another is `(x2, y2)` using `x` character. |\n| `R x1 y1 x2 y2 c` | The same as above but with color `c` specification. |\n| `B x y c` | Alias for `B4`. |\n| `B4 x y c` | Fill the entire area connected to `(x, y)` and having the same colour as `(x, y)` with colour `c`. 4-dots way of filling is used i.e. only side connections are taken into account while only corner connections will skipped. |\n| `B8 x y c` | Fill the entire area connected to `(x, y)` and having the same colour as `(x, y)` with colour `c`. 8-dots way of filling is used i.e. both side and corner connections are taken into account. |\n| `P` | Print current canvas. |\n| `SET` | Show all existing properties with their values. |\n| `SET p v` | Assign property `p` value `v`. |\n| `Q` | Quit the program. |\n                  \n### Available properties (could be changed via `SET`)\n\n| Property | Default value | Description |\n| ------- | -------------- | ---------- |\n| `hBorder` | `-` | Symbol for horizontal border. |\n| `defaultDrawChar` | `x` | Default symbol to draw lines and rectangles. |\n| `defaultEmptyChar` | ` ` | Default symbol to draw empty areas. |\n| `showCanvasAfterCommand` | `true` | Print or not print canvas after draw command. |\n| `vBorder` | \u0026#124; | Symbol for vertical border. |\n\n                        \n## Demos\n\nThere could be 2 ways of working with drawing shell\n1. There is support of input files (examples of input files could be found in `examples` folder) with commands i.e. the following command are possible\n      - On Windows: \n        - `bin\\drawingshell.bat examples\\chessboard`\n        - `bin\\drawingshell.bat examples\\maze`\n        - `bin\\drawingshell.bat examples\\readme_example`\n      - On Linux: \n        - `bin/drawingshell.sh examples/chessboard`\n        - `bin/drawingshell.sh examples/maze`\n        - `bin/drawingshell.sh examples/readme_example`\n      - Just using java: \n        - `java -jar drawingshell-1.0-SNAPSHOT.jar \u003cpath_to_file\u003e`\n        \n   this feature is also used in tests.\n2. Interactive shell mode. Below there is a sample of it.\n\n        create canvas or enter command: C 0 2 \n        Usage: C \u003cw\u003e \u003ch\u003e. Where w and h must be in a range [1..2,147,483,647].\n        In case of huge values be sure you have enough memory for jvm heap.\n        \n        create canvas or enter command: C 20 2 \n        ----------------------\n        |                    |\n        |                    |\n        ----------------------\n        \n        enter command: L 1 2 6 2\n        ----------------------\n        |                    |\n        |xxxxxx              |\n        ----------------------\n        \n        enter command: L 8 2 14 2 @\n        ----------------------\n        |                    |\n        |xxxxxx @@@@@@@      |\n        ----------------------\n        \n        enter command: R 16 1 20 3 *\n        ----------------------\n        |               *****|\n        |xxxxxx @@@@@@@ *   *|\n        ----------------------\n        \n        enter command: B 10 3 o\n        Usage: B \u003cx\u003e \u003cy\u003e \u003cc\u003e. Where\n        x must be an integer in a range [1..20] and\n        y must be an integer in a range [1..2] and\n        c must be a non-space and a non-control symbol from UTF-8 range.\n\n        enter command: B 10 1 o\n        ----------------------\n        |ooooooooooooooo*****|\n        |xxxxxxo@@@@@@@o*   *|\n        ----------------------\n\n        enter command: SET vBorder #\n        enter command: SET hBorder $\n        enter command: P        \n        $$$$$$$$$$$$$$$$$$$$$$\n        #ooooooooooooooo*****#\n        #xxxxxxo@@@@@@@o*   *#\n        $$$$$$$$$$$$$$$$$$$$$$\n        enter command: Q\n\n## Additional features and limitations\n\n1. If there is no canvas exist then prompt is `create canvas: ` otherwise the prompt is `enter command: `.\n2. Extra spaces are ignored that means that each of 2 commands:\n\n   command1\n   ```\n   L 1 10 1 -5\n   ```\n   command2\n   ```\n                   L              1                   10            1               -5            \n   ```\n   will lead to the same result. While the second one looks awful it is still valid.\n3. If a part of the line or rectangle specified via `L` or `R` commands is out of defined canvas then only the part matching to the canvas position/sizes will be drawn.\n   Please have a look at demos section for more detailed.\n4. If while `B` command there is specified a point which is out of canvas then nothing will be filled. Warning message will be shown. Please have a look at demos section for more detailed.\n5. The commands with length of 1 Gb and more are not supported. If there is a requirement to have such feature supported it should be addressed to improvements section.\n6. There is a hardcoded limit `Integer.MAX_VALUE` for canvas size (however there is an option to change it). Thus there are only environment limitations, please have a look at the table with memory required for different canvas sizes above. \n   At the same side for example Photoshop has limitation [30000](https://helpx.adobe.com/photoshop-elements/kb/maximum-image-size-limits-photoshop.html).\n   Also there are some ideas to improve it (in case it is really required) in improvements section.\n\n## Advanced features and possible customizations\n\n1. There are lots of error handling messages, help and prompt definition in `DrawingShell.properties` file which could be customized.\n2. In case of a new command is required there are 2 ways to define it:\n   - By usage of `ru.nuyanzin.commands.ReflectiveCommandHandler` - please have a look at existing commands as example.\n   - By usage of custom implementation of `ru.nuyanzin.commands.CommandHandler`.\n\n## Suggestions for improvements (possible road map)\n\n### General shell related suggestions\n1. Properties (shell variables) support to keep some setting. For example it could be applied for\n   - `BRIEF`, `VERBOSE` commands to set property which could be used to show/hide\n     additional information/warnings while application work.\n   - Lots of other settings like history file path, usage of highlighting or not.\n   - Also being able to reset properties values to defaults.\n2. Migration to use of jline3. It could provide history, history search, completion, highlighting,\n   keymap, different events from keyboard and mouse handling support and lots of others features\n   for more detailed please have a look at [jline3](https://github.com/jline/jline3/wiki).\n   There is also a progress bar for long operations could be helpful (could be based on existing from jline3).\n3. Being able to plug in new commands.\n4. As resource bundle is already in use there could be added localization support for whatever required locales.\n5. In case of having possibility so store results in files or whatever permanent storage\n   it also would be nice to have possibility of saving part of heavy command work while it is in progress\n   and to have a possibility to continue it from the last saved point (something similar to WAL files).\n### Drawing related suggestions\n1. Add more drawing related operations like any line (not only horizontal or vertical),\n   circle, triangle, filled rectangles and other shapes, being able to fill not only area\n   with the same but with the similar colours.\n2. Being able to save the current state of canvas and load it later from the file or other source.\n### Other\n1. Currently there is a limitation of `Integer.MAX_VALUE` (and environment/jvm heap/etc.) for width or height of canvas.\n   It could be increased with increasing memory but anyway it will require\n   additional performance tuning. If it is really required to support\n   huge canvas with faster speed it makes sense to think of\n   - Currently there is a 2-dimensional array of `BitSet` is created based on width and height from the input. \n     As each row is a separate `BitSet` while a column contains data from different `BitSet` the row related operations are faster.\n     Also as row is a single `BitSet` it consumes less memory. It makes sense to make row as a separate `BitSet` or column \n     as a separate `BitSet` based on whose length is larger.   \n   - Like in case of an SQL engine some \"statistics\" about current color distribution\n     could be gathered and then used on optimization level.\n   - Off-heap storage, specific optimization algorithm and so on.\n2. Huge commands (several gigabytes). May be support is not needed however what about protection from such commands?","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnuyanzin%2Fdrawshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnuyanzin%2Fdrawshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnuyanzin%2Fdrawshell/lists"}