NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #1036 (closed task: fixed)

Opened 2012-02-29T15:07:19-06:00

Last modified 2012-08-29T14:12:19-05:00

Implement a RenderingService

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b4-plugins
Component: Data Model Version:
Severity: serious Keywords:
Cc: josh@…, j.burel@… Blocked By:
Blocking: #1340


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

comment:1 Changed 2012-02-29T15:08:27-06:00 by bdezonia

Chat log contents:

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)?
bdezonia: Yes, I saw your notes about that. Very cool.

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.

Or a separate service.

I like the latter best right now.

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...

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.

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.

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

comment:2 Changed 2012-02-29T15:10:55-06:00 by bdezonia

  • Milestone changed from imagej-2.0-beta1 to imagej-2.0-beta2

comment:3 Changed 2012-02-29T15:28:43-06:00 by curtis

  • Cc josh@…, j.burel@… added

comment:4 Changed 2012-05-14T11:09:39-05:00 by bdezonia

  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta4

comment:5 Changed 2012-07-17T14:29:54-05:00 by bdezonia

  • Blocking 1340 added

comment:6 Changed 2012-08-14T12:37:50-05:00 by bdezonia

  • Milestone changed from imagej-2.0.0-beta4 to imagej-2.0.0-beta5

After discussing with Curtis it seemed this could be done when the display of data is updated in beta 5

comment:7 Changed 2012-08-14T13:20:49-05:00 by bdezonia

  • Blocking 1340 removed

comment:8 Changed 2012-08-23T15:29:43-05:00 by bdezonia

  • Blocking 1398 added

comment:9 Changed 2012-08-29T10:43:06-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

Fixed with commit 5fff913c1c73acfa18a72affed633f50f004f548

comment:10 Changed 2012-08-29T11:34:16-05:00 by bdezonia

  • Milestone changed from imagej-2.0.0-beta5 to imagej-2.0.0-beta4

comment:11 Changed 2012-08-29T11:38:46-05:00 by bdezonia

  • Blocking 1340 added; 1398 removed

comment:12 Changed 2012-08-29T14:12:19-05:00 by bdezonia

Further refinement in place with commit ffa2b6b998b9c630106cda36034133cd2d4fc7c8