Ticket #1036 (closed task: fixed)

Opened 7 years ago

Last modified 7 years ago

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

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

comment:1 Changed 7 years ago by bdezonia

Chat log contents:

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.

comment:2 Changed 7 years ago by bdezonia

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

comment:3 Changed 7 years ago by curtis

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

comment:4 Changed 7 years ago by bdezonia

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

comment:5 Changed 7 years ago by bdezonia

  • Blocking 1340 added

comment:6 Changed 7 years ago 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 7 years ago by bdezonia

  • Blocking 1340 removed

comment:8 Changed 7 years ago by bdezonia

  • Blocking 1398 added

comment:9 Changed 7 years ago by bdezonia

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

Fixed with commit 5fff913c1c73acfa18a72affed633f50f004f548

comment:10 Changed 7 years ago by bdezonia

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

comment:11 Changed 7 years ago by bdezonia

  • Blocking 1340 added; 1398 removed

comment:12 Changed 7 years ago by bdezonia

Further refinement in place with commit ffa2b6b998b9c630106cda36034133cd2d4fc7c8

Note: See TracTickets for help on using tickets.