Implement a RenderingService

Description

The About ImageJ2 plugin draws text onto planes of a Dataset. Currently that work is done by DrawingTool in ij-data. And temporarily its using AWT to do some work. We want to get rid of AWT dependency in ij-data.

The plan is to create a RenderingService that gives back a text renderer when prompted. DrawingTool (which may or may not stay in ij-data) would use the RenderingService to get a TextRenderer that is appropriate for the current UI.

The code for AWTTextRenderer is encapsulated in a private class of DrawingTool.

Currently text rendering is done by rendering into a buffer internal to the renderer that can be accessed after rendering. The DrawingTool uses this set of pixels to determine which dataset sample values need to be overwritten with the current fore ground color/value.

Change History

bdezonia
2:27
ctrueden: I need to talk to you at some point about a design decision related to drawing text onto planes of a dataset. I have code to do so for the about ij2 plugin. its very temporarily located in ij-data and pulls in awt dependencies. can we discuss how best to refactor this (both location of DrawingTool as well as location of its helper classes TextRenderer and AWTTextRenderer)?
2:34
ctrueden
bdezonia: Yes, I saw your notes about that. Very cool.

2:34
ctrueden
I agree that it needs to be UI-agnostic, and somehow moved to the ui package, using services.
It could be part of UIService maybe, though I'm not sure that's the best.
Or we could create a dedicated DrawingService that looks for special Drawing plugins. Sort of like how the UIService looks for UserInterface implementations.

2:35
dscho
Or a separate service.
Right.

2:35
ctrueden
I like the latter best right now.

2:36
dscho
OME has a rnr package (AKA "render") which could be adjusted to provide that service, too. I figure they do not have a dependency on AWT, but then, they probably do not have support for text rendering, either...

2:37
ctrueden
Oh yeah, we talked about rendering being put into a common package.
I think this is the seed of that.
Let's make a RenderService, and see where it goes.
Maybe we can get some of their code into it.

2:42
bdezonia
Okay I will start building a RenderingService, give it a getTextRenderer() method, and have it use those discovered by sezpoz. The awt/swing projects will implement them using the existing AWTTextRenderer code.

2:43
ctrueden
That sounds awesome Barry.
The TextRenderers can be a new type of IPlugin. Can model it after UserInterface.