Doctus is a Scala Library for the creation of visual art pieces.
It is based on the ideas of Processing but uses scala as a programming language. Projects can create images on multiple platforms. Currently Swing and HTML5-Canvas are supported.
Principles
Doctus prepares a core interface. For the creation of your art pieces you always use that core interface. These can then be rendered on different platforms. Usually all classes of the core interfaces have a wrapper for each platform to be rendered on there.
Modules
- doctus-core. The core interface and some utilities
- doctus-swing. Java-Swing renderer
- doctus-scalajs. ScalaJS renderer. Converts your code to Javascript that can be executed in a HTML5 capable browser.
Sourcecode: wwagner4/doctus1.
Examples
List of projects using doctus. more...
Getting started
The easiest way to start a doctus project is to use giter8, a command line tool to generate files and directories from templates.
To create a new doctus project call
g8 wwagner4/mydoctus.g8
This will create a multimodule sbt project containing all the sourcefiles and other resouces you need.
To test the newly created project (we assume you named it 'mydoctus') change to the root directory of that project. There start sbt. This might take some time if you have not yet downloaded and compiled all the necessary libraries.
cd mydoctus
sbt
Inside 'sbt', call 'test' to see if everything compiles right and the tests execute correctly.
> test
After 'test' succeeded, generate the javascript code for running your project in the browser. To do so call 'fastOptJS'. For details about the 'fastOptJS' command see ScalaJS
> fastOptJS
You can test your project by opening the 'mydoctus-scalajs/index.html' page in your preferred browser.
For running your project in the swing renderer execute the following commands in sbt.
> project mydoctus-swing
> run
This should open a new window running your project.
Features
- Canvas with associated graphic context that contains basic drawing functins
- Colormanagement that supports opacity
- Scheduler for creating animated pieces
- Proof of concept for the usage of GUI-components.
Planned for the future
- Support for touchdevices. Based on the usage of touch events
- Application framework for easier usage. Based on the framework known from Processing where you have a number of methods like 'setup', 'draw', 'mouseDragged', etc. , that give you an intuitive way to write your applications.
- Adding some kind of sound interface
- Carefully extend the overall functionallity
Documentation
To get an overview of the API have a look at the core interface for the doctus version you wnt to use.
Naming conventions for wrapper classes
In order make it easy to find the wrapper implementations for the interface class you want to use the following naming conventions.
The name of the implementation starts with the name of the interface followed by the platform name and an optional qualifier.
Examples:
- DoctusCanvas -> DoctusCanvasSwing, DoctusCanvasScalaJs
- DoctusActiavatable -> DoctusActtivatableSwing, DoctusActtivatableSwingKey, DoctusActivatableScalaJs
IDE Support
To be able to edit your project inside your preferred IDE do the following:
- Eclipse (Scala-IDE): Call 'eclipse' inside sbt. Then import 'General / Existing Projects into Workspace'
- IntelliJ IDEA: Import the Project directly using the 'sbt importer'. Make sure you have already installed the sbt- and scala-plugin.
Showcase
The doctus library includes a showase module for the core and every platform. All doctus functionality is (should be) present in the doctus showcases.
Modules
- doctus-showcase
- doctus-swing-showcase
- doctus-scalajs-showcases
Sourcecode (Same as the doctus library): wwagner4/doctus1.
Beside the showcase the source code of the example programs is also good starting point to understand how doctus works.