JDraw

A very simple, no-dependencies drawing API providing some primitive operations including lines, rectangles, circles, ellipses, arcs. It doesn't actually draw TO anything, you must provide your own implementation of Backing to actually paint the pixels. This project is intended for use with Snake, my project for Razer devices on Linux, but is made available in case others may find it useful. It doesn't have anything fancy like anti-alias, transformations or even line widths, contributions welcome though!

Лицензия

Лицензия

Группа

Группа

uk.co.bithatch
Идентификатор

Идентификатор

jdraw
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

JDraw
A very simple, no-dependencies drawing API providing some primitive operations including lines, rectangles, circles, ellipses, arcs. It doesn't actually draw TO anything, you must provide your own implementation of Backing to actually paint the pixels. This project is intended for use with Snake, my project for Razer devices on Linux, but is made available in case others may find it useful. It doesn't have anything fancy like anti-alias, transformations or even line widths, contributions welcome though!
Ссылка на сайт

Ссылка на сайт

https://github.com/bithatch/jdraw
Система контроля версий

Система контроля версий

https://github.com/bithatch/jdraw/

Скачать jdraw

Имя Файла Размер
jdraw-1.0.pom
jdraw-1.0.jar 24 KB
jdraw-1.0-sources.jar 14 KB
jdraw-1.0-javadoc.jar 135 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/uk.co.bithatch/jdraw/ -->
<dependency>
    <groupId>uk.co.bithatch</groupId>
    <artifactId>jdraw</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/uk.co.bithatch/jdraw/
implementation 'uk.co.bithatch:jdraw:1.0'
// https://jarcasting.com/artifacts/uk.co.bithatch/jdraw/
implementation ("uk.co.bithatch:jdraw:1.0")
'uk.co.bithatch:jdraw:jar:1.0'
<dependency org="uk.co.bithatch" name="jdraw" rev="1.0">
  <artifact name="jdraw" type="jar" />
</dependency>
@Grapes(
@Grab(group='uk.co.bithatch', module='jdraw', version='1.0')
)
libraryDependencies += "uk.co.bithatch" % "jdraw" % "1.0"
[uk.co.bithatch/jdraw "1.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

JDraw

A very simple, no-dependencies drawing API for Java, providing some primitive operations including lines, rectangles, circles, ellipses and arcs.

It doesn't actually draw TO anything, you must provide your own implementation of Backing to actually paint the pixels.

This project is intended for use with Snake, my project for Razer devices on Linux, but is made available in case others may find it useful.

It doesn't have anything fancy like anti-alias, transformations or even line widths, and there are currently no plans to develop it any further, but contributions are of course welcome!

Dependencies

No dependencies other than Java itself.

Configuring your project

The library is available in Maven Central.

Maven

	<dependency>
		<groupId>uk.co.bithatch</groupId>
		<artifactId>jdraw</artifactId>
		<version>1.0</version>
	</dependency>

Development versions (whem available), will be the next version number, suffixed with -SNAPSHOT).

	<dependency>
		<groupId>uk.co.bithatch</groupId>
		<artifactId>jdraw</artifactId>
		<version>1.1-SNAPSHOT</version>
	</dependency>

Usage

To add to your own project, first you need an implementation of Backing. For example, if you wanted to draw on a BufferedImage, you would do the following.

Note this is a pointless example really, as BufferedImage can be drawn on with Java's own Graphics API, but it is a quick way to get some useful output from JDraw.

public class MyBacking implements Backing {

	public BufferedImage img;

	public 	MyBacking() {
		img = new BufferedImage(512, 512, BufferedImage.TYPE_INT_ARGB);
	}

	@Override
	public int getWidth() {
		return img.getWidth();
	}

	@Override
	public int getHeight() {
		return img.getHeight();
	}

	@Override
	public void plot(int x, int y, int[] rgb) {
		bimg.setRGB(x, y, (0xff << 24) | (rgb[0] << 16) | (rgb[1] << 8) | (rgb[2]));
		draw.repaint();
	}
}

Now you have a Backing implementation, you can draw on it using JDraw. The following will draw a 100x100 red rectangle at 10, 10.

	MyBacking backing = new MyBacking();
	RGBCanvas canvas = new RGBCanvas(backing);
	
	canvas.setColour(RGBCanvas.RED);
	canvas.fillRect(10, 10, 100, 100);
	
	// Now do something useful with your drawing, for example save it as a PNG..
	ImageIO.write(backing.img, "png", new File("my-image.png"));
	
uk.co.bithatch

Bithatch

Open source libraries and applications

Версии библиотеки

Версия
1.0