public class GradationCurveCommand extends AbstractDocumentCommand
Hint:
To work properly this command needs a PageView
instance in the
Context
object.
The following named command parameters exists and can be used to configure the command behavior.
Description | Command Parameter Name | Possible Parameter Values |
---|---|---|
gradation curve description | curve | a customized curve specification (how to define a customized curve is described below) |
Scope to apply to curve (inherited from AbstractDocumentCommand ) |
scope | PAGE, DOCUMENT (default = DOCUMENT) |
The definition of a customized gradation curve should be given as the following example describes.
As an example take a look at a simple gradation given by four points:
- point.0.x=0, point.0.y=0
- point.1.x=53, point.1.y=101
- point.2.x=131, point.2.y=61
- point.4.x=255, point.4.y=255
This one could be defined by listing each point one after the other delimited by commas in the
command properties:
SimpleGradation =com.levigo.jadice.addon.gradation.ApplyGradationCommand
SimpleGradation.param.curve=0,0,53,101,131,61,255,255
If the points are not set or set to values, which can not translated into points, a neutral
gradation is assumed, excepted by NEUTRAL curve, which as mentioned above do not need any point
definition.
AbstractDocumentCommand.Scope
document
Constructor and Description |
---|
GradationCurveCommand() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canExecute()
Subclasses may override this method to perform argument validation beyond the validation that
happens automatically during the injection phase.
|
protected void |
execute()
This method is called in order to execute the command.
|
protected RenderControls |
getApplicableRenderControls()
This utility method is intended to get the applicable render controls object to apply gradation
changes.
|
protected GradationCurve |
getCurrentGradationCurve()
This utility method is intended to get a lookup gradation curve to check the current applied
settings.
|
String |
getCurve() |
protected GradationCurve |
getGradationCurve()
Creates a gradation curve instance defined by command parameter points.
|
void |
setCurve(String curve) |
getRenderControls, getScope, setScope
getPageView, setPageView
getContext, propagateContextChange, setContext
canExecute, execute, getKey, isAvailable, isSelected, isSelected, setKey
protected boolean canExecute()
InjectedCommand
Argument
annotations and the
arguments have been injected.canExecute
in class AbstractDocumentCommand
true
if the command can/may be executed in the current context,
false
otherwise.protected RenderControls getApplicableRenderControls()
Depending on the state of Scope
this method will either return the document controls of
the current document or the page controls for the current page in the target PageView
, if
the command should work in a per-page way (not Scope#DOCUMENT
). If no page render
controls is available in the per-page case, a new render controls for the current page will be
created.
protected void execute()
InjectedCommand
InjectedCommand.canExecute()
has returned
true
.execute
in class InjectedCommand
protected GradationCurve getGradationCurve()
protected GradationCurve getCurrentGradationCurve()
It is a shortcut for getApplicableRenderControls()
,
RenderControls.getImageRenderSettings()
and
ImageRenderSettings.getGradationCurve()
.
public void setCurve(String curve)
public String getCurve()
Copyright © 2024 levigo holding gmbh. All rights reserved.