App
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
mhr.appcore.image.layers.lut.GammaLUTLayer Class Reference

Třída pro reprezentaci rasterové vrstvy. More...

Inheritance diagram for mhr.appcore.image.layers.lut.GammaLUTLayer:
mhr.appcore.image.layers.lut.LUTLayer mhr.appcore.image.layers.Layer

Public Member Functions

 GammaLUTLayer (Image owner, int id) throws UnsupportedBitmapException, BitmapAllocationException, LUTAllocationException
 Defaultní konstruktor, vytvoří vrstvu, která neprovádí nic - mapuje 1:1.
 
 GammaLUTLayer (Image owner, Element i, ImageFile f)
 
synchronized int dispose ()
 
LayerType getType ()
 Vrací typ vrstvy.
 
Layer duplicate (int newId)
 
void updateFromSpecificPresentation (LayerPDInfo presentation)
 Odvozená třída v této metodě upraví svoje specifická data tak, aby odpovídala reprezentaci.
 
LUT getLut ()
 Vrací LUT.
 
int applyTo (NBitmap dst)
 Aplikuje vrstvu na danou bitmapu.
 
int applyTo (NBitmap dst, Rect srcRect, int srcOrigX, int srcOrigY)
 Aplikuje výřez z vrstvy určený obdélníkem srcRect na odpovídající oblast bitmapy s počátkem v srcOrig.
 
int applyTo (NBitmap dst, Rect srcRect, int srcOrigX, int srcOrigY, NBitmap forcedMask)
 Aplikuje výřezz vrstvy určený obdélníkem srcRect na odpovídající oblast bitmapy s počátkem v srcOrig. Pokud vrstva vyžaduje použití masky, použije se jako náhrada maska mask.
 
void resizeTo (int nWidth, int nHeight, InterpolatorType iType, double force) throws BitmapAllocationException
 
void cropTo (Rect r)
 
void fillLayerElement (Document d, ImageFile f, Element e)
 
int getExtraMargin ()
 Vrací velikost okraje, který odpovídá okolí vrstvy, ze kterého vrstva při své aplikaci bere data.
 
int getId ()
 Vrací id vrstvy.
 
Depth getDepth ()
 Vrací bitovou hloubku vrstvy.
 
int getWidth ()
 Vrací šířku vrstvy v px.
 
int getHeight ()
 Vrací výšku vrstvy v px.
 
boolean isVisible ()
 Vrací viditelnost vrstvy.
 
void setVisible (boolean visible)
 nastavuje viditelnost vrstvy.
 
double getOpacity ()
 Vrací průhlednost vrstvy.
 
void setOpacity (double opacity)
 Nastavuje průhlednost vrstvy z intervalu 0..1.
 
NBitmap getMask (boolean forceCreate) throws UnsupportedBitmapException, BitmapAllocationException
 Vrací masku vrstvy.
 
boolean isMaskActive () throws IllegalStateException
 Vrací true, pokud je maska vrstvy aktivní.
 
void setMaskActive (boolean maskActive) throws UnsupportedBitmapException, BitmapAllocationException
 Zapne/vypne masku. Pokud maska zatím neexistuje, bude vytvořena.
 
void updateInfo (LayerPDInfo info)
 Vrstva nastaví paramtry v info tak, že ji budou reprezentovat.
 

Static Public Attributes

static final double opacityAsFull = 0.9999
 Maximální hodnota opacity, která se ještě aplikuje, vyšší je považované za 1 a volá se optimalizovaná funkce.
 
static final double opacityAsNone = 0.0001
 Minimální hodnota opacity, která se ještě aplikuje, nižší je považované za 0 a vrstva se neaplikuje.
 

Protected Member Functions

void finalize () throws Throwable
 
 GammaLUTLayer (GammaLUTLayer l, int newId)
 
void fillSpecificElement (Document d, ImageFile f, Element e)
 
void updateSpecificData (LayerPDInfo info)
 Odvozená třída musí v této metodě inicializovat specifická data své reprezentace tak, aby jí odpovídaly.
 
void initMask () throws UnsupportedBitmapException, BitmapAllocationException
 Inicializuje masku vrstvy, pokud ještě neexistuje, bude vytvořena.
 
void appendLeafElement (Document d, Element parent, String eName, String eContetnt)
 
void onCrop (Rect r)
 
void onResize (int nWidth, int nHeight, InterpolatorType iType, double force)
 

Protected Attributes

double gamma = 1
 
LUT lut = null
 LUT tabulka s daty vrstvy, vytváří ji odvozené třídy.
 
int id
 Id vrstvy, unikátní v rámci obrazu.
 
Image owner
 Obraz, který vlastní vrstvu.
 
Depth depth
 Barevná hloubka vrstvy, měla by odpovídat barevné hloubce obrazu...
 
int width
 Výška vrstvy v pixelech.
 
int height
 Šířka vrstvy v pixelech.
 
double opacity = 1
 Dodatečná alpha z intervalu 0..1.
 
boolean visible = true
 Viditelnost vrstvy.
 
NBitmap mask = null
 Maska vrstvy, vytvoří se až při prvním použití.
 
boolean maskActive = false
 Informace o tom, jestli je maska zapnutá.
 

Detailed Description

Třída pro reprezentaci rasterové vrstvy.

Definition at line 24 of file GammaLUTLayer.java.

Constructor & Destructor Documentation

mhr.appcore.image.layers.lut.GammaLUTLayer.GammaLUTLayer ( GammaLUTLayer  l,
int  newId 
)
inlineprotected

Definition at line 43 of file GammaLUTLayer.java.

{
super(l, newId);
lut = LUT.getGammaLut(l.gamma);
}
mhr.appcore.image.layers.lut.GammaLUTLayer.GammaLUTLayer ( Image  owner,
int  id 
) throws UnsupportedBitmapException, BitmapAllocationException, LUTAllocationException
inline

Defaultní konstruktor, vytvoří vrstvu, která neprovádí nic - mapuje 1:1.

Parameters
owner
id
Exceptions
UnsupportedBitmapException
BitmapAllocationException
LUTAllocationException

Definition at line 57 of file GammaLUTLayer.java.

{
super(owner, id);
}
mhr.appcore.image.layers.lut.GammaLUTLayer.GammaLUTLayer ( Image  owner,
Element  i,
ImageFile  f 
)
inline

Definition at line 62 of file GammaLUTLayer.java.

{
super(owner, i, f);
try {
gamma = Double.parseDouble(i.getElementsByTagName("Gamma").item(0).getTextContent());
} catch (Exception e) {
throw new LayerCreationException(e);
}
}

Member Function Documentation

void mhr.appcore.image.layers.Layer.appendLeafElement ( Document  d,
Element  parent,
String  eName,
String  eContetnt 
)
inlineprotectedinherited

Definition at line 181 of file Layer.java.

{
Element e = d.createElement(eName);
e.setTextContent(eContetnt);
parent.appendChild(e);
}
int mhr.appcore.image.layers.lut.LUTLayer.applyTo ( NBitmap  dst)
inlinevirtualinherited

Aplikuje vrstvu na danou bitmapu.

Parameters
dst
Returns

Implements mhr.appcore.image.layers.Layer.

Definition at line 97 of file LUTLayer.java.

{
if (!visible) {
return 0;
}
if (lut == null) {
throw new AlreadyDisposedException("Layer is already disposed");
}
if (isMaskActive()) {
return lut.applyTo(dst, mask, mask.getRect(), 0, 0, opacity);
} else {
return lut.applyTo(dst, dst.getRect(), opacity);
}
}
int mhr.appcore.image.layers.lut.LUTLayer.applyTo ( NBitmap  dst,
Rect  srcRect,
int  srcOrigX,
int  srcOrigY 
)
inlinevirtualinherited

Aplikuje výřez z vrstvy určený obdélníkem srcRect na odpovídající oblast bitmapy s počátkem v srcOrig.

Parameters
dst
srcRect
srcOrigX
srcOrigY
Returns

Implements mhr.appcore.image.layers.Layer.

Definition at line 112 of file LUTLayer.java.

{
if (!visible) {
return 0;
}
if (lut == null) {
throw new AlreadyDisposedException("Layer is already disposed");
}
if (isMaskActive()) {
return lut.applyTo(dst, mask, srcRect, srcOrigX, srcOrigY, opacity);
} else {
return lut.applyTo(dst, srcRect, opacity);
}
}
int mhr.appcore.image.layers.lut.LUTLayer.applyTo ( NBitmap  dst,
Rect  srcRect,
int  srcOrigX,
int  srcOrigY,
NBitmap  mask 
)
inlinevirtualinherited

Aplikuje výřezz vrstvy určený obdélníkem srcRect na odpovídající oblast bitmapy s počátkem v srcOrig. Pokud vrstva vyžaduje použití masky, použije se jako náhrada maska mask.

Parameters
dst
srcRect
srcOrigX
srcOrigY
mask
Returns

Implements mhr.appcore.image.layers.Layer.

Definition at line 127 of file LUTLayer.java.

{
if (!visible) {
return 0;
}
if (lut == null) {
throw new AlreadyDisposedException("Layer is already disposed");
}
if (isMaskActive()) {
return lut.applyTo(dst, forcedMask, srcRect, srcOrigX, srcOrigY, opacity);
} else {
return lut.applyTo(dst, srcRect, opacity);
}
}
void mhr.appcore.image.layers.Layer.cropTo ( Rect  r)
inlineinherited

Definition at line 222 of file Layer.java.

{
if (mask != null) {
} else {
Rect crop = new Rect(r);
crop.cropBy(new Rect(width, height));
width = crop.getWidth();
height = crop.getHeight();
}
onCrop(r);
}
synchronized int mhr.appcore.image.layers.lut.GammaLUTLayer.dispose ( )
inline

Definition at line 74 of file GammaLUTLayer.java.

{
super.dispose();
return 0;
}
Layer mhr.appcore.image.layers.lut.GammaLUTLayer.duplicate ( int  newId)
inlinevirtual

Implements mhr.appcore.image.layers.Layer.

Definition at line 104 of file GammaLUTLayer.java.

{
return new GammaLUTLayer(this, newId);
}
void mhr.appcore.image.layers.Layer.fillLayerElement ( Document  d,
ImageFile  f,
Element  e 
)
inlineinherited

Definition at line 236 of file Layer.java.

{
FileConstants c = new FileConstants();
appendLeafElement(d, e, c.LAYER_TYPE_NODE, getType().toString());
Element li = d.createElement(c.LAYER_INFO_NODE);
e.appendChild(li);
appendLeafElement(d, li, c.ID_NODE, Integer.toString(id));
appendLeafElement(d, li, c.WIDTH_NODE, Integer.toString(width));
appendLeafElement(d, li, c.HEIGHT_NODE, Integer.toString(height));
appendLeafElement(d, li, c.OPACITY_NODE, Double.toString(opacity));
appendLeafElement(d, li, c.LAYER_VISIBLE_NODE, Boolean.toString(visible));
appendLeafElement(d, li, c.HAS_MASK_NODE, Boolean.toString(mask != null));
if (mask != null) {
PDBitmap tmpBitmap = f.createBitmap(new BitmapInfo(width, height, ChannelCount.SINGLE_CHANNEL, depth, ColorMode.MONO, false));
NBitmap tmpWrap = new NBitmap(tmpBitmap);
mask.copyTo(tmpWrap, mask.getRect(), 0, 0);
tmpWrap.dispose();
f.writeMask(tmpBitmap, Integer.toString(id) + c.MASK_FILE_SUFFIX);
tmpBitmap.dispose();
appendLeafElement(d, li, c.MASK_ACTIVE_NODE, Boolean.toString(maskActive));
}
Element lsd = d.createElement(c.LAYER_SPECIFIC_DATA_NODE);
e.appendChild(lsd);
fillSpecificElement(d, f, lsd);
}
void mhr.appcore.image.layers.lut.GammaLUTLayer.fillSpecificElement ( Document  d,
ImageFile  f,
Element  e 
)
inlineprotectedvirtual

Implements mhr.appcore.image.layers.Layer.

Definition at line 81 of file GammaLUTLayer.java.

{
appendLeafElement(d, e, "Gamma", Double.toString(gamma));
}
void mhr.appcore.image.layers.lut.GammaLUTLayer.finalize ( ) throws Throwable
inlineprotected

Definition at line 38 of file GammaLUTLayer.java.

{
super.finalize();
}
Depth mhr.appcore.image.layers.Layer.getDepth ( )
inlineinherited

Vrací bitovou hloubku vrstvy.

Returns

Definition at line 287 of file Layer.java.

{
return depth;
}
int mhr.appcore.image.layers.Layer.getExtraMargin ( )
inlineinherited

Vrací velikost okraje, který odpovídá okolí vrstvy, ze kterého vrstva při své aplikaci bere data.

Returns

Definition at line 271 of file Layer.java.

{
return 0;
}
int mhr.appcore.image.layers.Layer.getHeight ( )
inlineinherited

Vrací výšku vrstvy v px.

Returns

Definition at line 303 of file Layer.java.

{
return height;
}
int mhr.appcore.image.layers.Layer.getId ( )
inlineinherited

Vrací id vrstvy.

Returns

Definition at line 279 of file Layer.java.

{
return id;
}
LUT mhr.appcore.image.layers.lut.LUTLayer.getLut ( )
inlineinherited

Vrací LUT.

Returns

Definition at line 81 of file LUTLayer.java.

{
return lut;
}
NBitmap mhr.appcore.image.layers.Layer.getMask ( boolean  forceCreate) throws UnsupportedBitmapException, BitmapAllocationException
inlineinherited

Vrací masku vrstvy.

Parameters
forceCreateParametr, jestli se má maska vytvořit, pokud neexistuje.
Returns
Exceptions
UnsupportedBitmapException
BitmapAllocationException

Definition at line 347 of file Layer.java.

{
if (forceCreate) {
}
return mask;
}
double mhr.appcore.image.layers.Layer.getOpacity ( )
inlineinherited

Vrací průhlednost vrstvy.

Returns

Definition at line 327 of file Layer.java.

{
return opacity;
}
LayerType mhr.appcore.image.layers.lut.GammaLUTLayer.getType ( )
inlinevirtual

Vrací typ vrstvy.

Implements mhr.appcore.image.layers.Layer.

Definition at line 87 of file GammaLUTLayer.java.

{
return LayerType.LAYER_GAMMA;
}
int mhr.appcore.image.layers.Layer.getWidth ( )
inlineinherited

Vrací šířku vrstvy v px.

Returns

Definition at line 295 of file Layer.java.

{
return width;
}
void mhr.appcore.image.layers.Layer.initMask ( ) throws UnsupportedBitmapException, BitmapAllocationException
inlineprotectedinherited

Inicializuje masku vrstvy, pokud ještě neexistuje, bude vytvořena.

Exceptions
UnsupportedBitmapException
BitmapAllocationException

Definition at line 174 of file Layer.java.

{
if (mask == null) {
mask = new NBitmap(new BitmapInfo(width, height, ChannelCount.SINGLE_CHANNEL, depth, ColorMode.MONO, false));
mask.fill(mask.getRect(), 0x00);
}
}
boolean mhr.appcore.image.layers.Layer.isMaskActive ( ) throws IllegalStateException
inlineinherited

Vrací true, pokud je maska vrstvy aktivní.

Returns
Exceptions
IllegalStateException

Definition at line 359 of file Layer.java.

{
if (mask != null && maskActive) {
return true;
} else if (!maskActive) {
return false;
} else {
throw new IllegalStateException("Mask on but doesn't exist.");
}
}
boolean mhr.appcore.image.layers.Layer.isVisible ( )
inlineinherited

Vrací viditelnost vrstvy.

Returns

Definition at line 311 of file Layer.java.

{
return visible;
}
void mhr.appcore.image.layers.Layer.onCrop ( Rect  r)
inlineprotectedinherited

Definition at line 196 of file Layer.java.

{
}
void mhr.appcore.image.layers.Layer.onResize ( int  nWidth,
int  nHeight,
InterpolatorType  iType,
double  force 
)
inlineprotectedinherited

Definition at line 200 of file Layer.java.

{
}
void mhr.appcore.image.layers.Layer.resizeTo ( int  nWidth,
int  nHeight,
InterpolatorType  iType,
double  force 
) throws BitmapAllocationException
inlineinherited

Definition at line 207 of file Layer.java.

{
if (mask != null) {
NBitmap tmp = new NBitmap(new BitmapInfo(nWidth, nHeight, ChannelCount.SINGLE_CHANNEL, depth, ColorMode.MONO, false));
Interpolator.resampleTo(mask, tmp, iType, force);
mask = tmp;
}
width = nWidth;
height = nHeight;
onResize(nWidth, nHeight, iType, force);
}
void mhr.appcore.image.layers.Layer.setMaskActive ( boolean  maskActive) throws UnsupportedBitmapException, BitmapAllocationException
inlineinherited

Zapne/vypne masku. Pokud maska zatím neexistuje, bude vytvořena.

Parameters
maskActive
Exceptions
UnsupportedBitmapException
BitmapAllocationException

Definition at line 375 of file Layer.java.

{
if (maskActive) {
} else {
}
}
void mhr.appcore.image.layers.Layer.setOpacity ( double  opacity)
inlineinherited

Nastavuje průhlednost vrstvy z intervalu 0..1.

Parameters
opacity

Definition at line 335 of file Layer.java.

{
this.opacity = opacity;
}
void mhr.appcore.image.layers.Layer.setVisible ( boolean  visible)
inlineinherited

nastavuje viditelnost vrstvy.

Parameters
visible

Definition at line 319 of file Layer.java.

{
this.visible = visible;
}
void mhr.appcore.image.layers.lut.GammaLUTLayer.updateFromSpecificPresentation ( LayerPDInfo  presentation)
inlinevirtual

Odvozená třída v této metodě upraví svoje specifická data tak, aby odpovídala reprezentaci.

Parameters
presentation

Implements mhr.appcore.image.layers.Layer.

Definition at line 116 of file GammaLUTLayer.java.

{
if (!(presentation.extra instanceof GammaLUTLayerSpecificPresentation)) {
throw new InvalidLayerSpecificPresentationSuppliedException("Invalid specific data supplied");
}
GammaLUTLayerSpecificPresentation p = (GammaLUTLayerSpecificPresentation) presentation.extra;
gamma = p.gamma;
if (lut != null) {
}
presentation.isChanged = true;
}
void mhr.appcore.image.layers.Layer.updateInfo ( LayerPDInfo  info)
inlineinherited

Vrstva nastaví paramtry v info tak, že ji budou reprezentovat.

Parameters
info

Definition at line 388 of file Layer.java.

{
info.id = id;
info.type = getType();
info.opacity = opacity;
info.visible = visible;
info.maskActive = maskActive;
info.isChanged = true;
if (mask != null) {
NBitmap mskThumbWrap = new NBitmap(info.getMaskThumb(true));
Interpolator.resampleTo(mask, mskThumbWrap);
mskThumbWrap.dispose();
}
}
void mhr.appcore.image.layers.lut.GammaLUTLayer.updateSpecificData ( LayerPDInfo  info)
inlineprotectedvirtual

Odvozená třída musí v této metodě inicializovat specifická data své reprezentace tak, aby jí odpovídaly.

Parameters
info

Implements mhr.appcore.image.layers.Layer.

Definition at line 109 of file GammaLUTLayer.java.

{
GammaLUTLayerSpecificPresentation p = new GammaLUTLayerSpecificPresentation();
p.gamma = gamma;
info.extra = p;
}

Member Data Documentation

Depth mhr.appcore.image.layers.Layer.depth
protectedinherited

Barevná hloubka vrstvy, měla by odpovídat barevné hloubce obrazu...

Definition at line 52 of file Layer.java.

double mhr.appcore.image.layers.lut.GammaLUTLayer.gamma = 1
protected

Definition at line 32 of file GammaLUTLayer.java.

int mhr.appcore.image.layers.Layer.height
protectedinherited

Šířka vrstvy v pixelech.

Definition at line 54 of file Layer.java.

int mhr.appcore.image.layers.Layer.id
protectedinherited

Id vrstvy, unikátní v rámci obrazu.

Definition at line 50 of file Layer.java.

LUT mhr.appcore.image.layers.lut.LUTLayer.lut = null
protectedinherited

LUT tabulka s daty vrstvy, vytváří ji odvozené třídy.

Definition at line 31 of file LUTLayer.java.

NBitmap mhr.appcore.image.layers.Layer.mask = null
protectedinherited

Maska vrstvy, vytvoří se až při prvním použití.

Definition at line 66 of file Layer.java.

boolean mhr.appcore.image.layers.Layer.maskActive = false
protectedinherited

Informace o tom, jestli je maska zapnutá.

Definition at line 67 of file Layer.java.

double mhr.appcore.image.layers.Layer.opacity = 1
protectedinherited

Dodatečná alpha z intervalu 0..1.

Definition at line 55 of file Layer.java.

final double mhr.appcore.image.layers.Layer.opacityAsFull = 0.9999
staticinherited

Maximální hodnota opacity, která se ještě aplikuje, vyšší je považované za 1 a volá se optimalizovaná funkce.

Hodnota je více než dostačující pro 8bit. alphu, ale už plně nevystihuje rozlišovací schopnost 16bit. alphy.Macímální hodnota opacity, který se ještě aplikuje, vyžší je považované za 1

Definition at line 64 of file Layer.java.

final double mhr.appcore.image.layers.Layer.opacityAsNone = 0.0001
staticinherited

Minimální hodnota opacity, která se ještě aplikuje, nižší je považované za 0 a vrstva se neaplikuje.

Definition at line 65 of file Layer.java.

Image mhr.appcore.image.layers.Layer.owner
protectedinherited

Obraz, který vlastní vrstvu.

Definition at line 51 of file Layer.java.

boolean mhr.appcore.image.layers.Layer.visible = true
protectedinherited

Viditelnost vrstvy.

Definition at line 56 of file Layer.java.

int mhr.appcore.image.layers.Layer.width
protectedinherited

Výška vrstvy v pixelech.

Definition at line 53 of file Layer.java.


The documentation for this class was generated from the following file: