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

Třída pro reprezentaci vrstvy s jednolitou barvou. More...

Inheritance diagram for mhr.appcore.image.layers.ColorLayer:
mhr.appcore.image.layers.Layer

Public Member Functions

 ColorLayer (Image owner, int id)
 Defaultní konstruktor, vytvoří neviditelnou bílou vrstvu, aby dostálo požadavku, že vytvořená vrstva nepotřebuje překreslení.
 
 ColorLayer (Image owner, Element i, ImageFile f)
 
synchronized int dispose ()
 
LayerType getType ()
 Vrací typ vrstvy.
 
BlendMode getMode ()
 Vrací mód vrstvy.
 
void setMode (BlendMode mode)
 Nastavuje mód vrstvy.
 
int getColor ()
 
void setColor (int color)
 
Layer duplicate (int newId)
 
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 updateFromSpecificPresentation (LayerPDInfo presentation)
 Odvozená třída v této metodě upraví svoje specifická data tak, aby odpovídala reprezentaci.
 
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
 
 ColorLayer (ColorLayer 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

BlendMode mode
 Blendovací mód.
 
int color
 Barva výplně
 
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 vrstvy s jednolitou barvou.

Definition at line 26 of file ColorLayer.java.

Constructor & Destructor Documentation

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

Definition at line 47 of file ColorLayer.java.

{
super(l, newId);
this.color = l.color;
this.mode = l.mode;
}
mhr.appcore.image.layers.ColorLayer.ColorLayer ( Image  owner,
int  id 
)
inline

Defaultní konstruktor, vytvoří neviditelnou bílou vrstvu, aby dostálo požadavku, že vytvořená vrstva nepotřebuje překreslení.

Parameters
owner
id

Definition at line 59 of file ColorLayer.java.

{
super(owner, id);
color = 0xFFFFFFFF;
opacity = 0;
}
mhr.appcore.image.layers.ColorLayer.ColorLayer ( Image  owner,
Element  i,
ImageFile  f 
)
inline

Definition at line 66 of file ColorLayer.java.

{
super(owner, i, f);
mode = BlendMode.valueOf(i.getElementsByTagName("BlendMode").item(0).getTextContent());
color = Integer.parseInt(i.getElementsByTagName("Color").item(0).getTextContent());
}

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.ColorLayer.applyTo ( NBitmap  dst)
inlinevirtual

Aplikuje vrstvu na danou bitmapu.

Parameters
dst
Returns

Implements mhr.appcore.image.layers.Layer.

Definition at line 136 of file ColorLayer.java.

{
if (!visible) {
return 0;
}
return 0;
}
if (isMaskActive()) {
return Blender.drawTo(mode, dst, mask, color, mask.getRect(), 0, 0);
} else {
return Blender.drawTo(mode, dst, mask, color, mask.getRect(), 0, 0, opacity);
}
} else {
return Blender.blendTo(mode, dst, color, dst.getRect());
} else {
return Blender.blendTo(mode, dst, color, dst.getRect(), opacity);
}
}
}
int mhr.appcore.image.layers.ColorLayer.applyTo ( NBitmap  dst,
Rect  srcRect,
int  srcOrigX,
int  srcOrigY 
)
inlinevirtual

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 159 of file ColorLayer.java.

{
if (!visible) {
return 0;
}
return 0;
}
if (isMaskActive()) {
return Blender.drawTo(mode, dst, mask, color, srcRect, srcOrigX, srcOrigY);
} else {
return Blender.drawTo(mode, dst, mask, color, srcRect, srcOrigX, srcOrigY, opacity);
}
} else {
return Blender.blendTo(mode, dst, color, srcRect);
} else {
return Blender.blendTo(mode, dst, color, srcRect, opacity);
}
}
}
int mhr.appcore.image.layers.ColorLayer.applyTo ( NBitmap  dst,
Rect  srcRect,
int  srcOrigX,
int  srcOrigY,
NBitmap  mask 
)
inlinevirtual

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 182 of file ColorLayer.java.

{
if (!visible) {
return 0;
}
return 0;
}
if (isMaskActive()) {
return Blender.drawTo(mode, dst, forcedMask, color, srcRect, srcOrigX, srcOrigY);
} else {
return Blender.drawTo(mode, dst, forcedMask, color, srcRect, srcOrigX, srcOrigY, opacity);
}
} else {
return Blender.blendTo(mode, dst, color, srcRect);
} else {
return Blender.blendTo(mode, dst, color, 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.ColorLayer.dispose ( )
inline

Definition at line 73 of file ColorLayer.java.

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

Implements mhr.appcore.image.layers.Layer.

Definition at line 131 of file ColorLayer.java.

{
return new ColorLayer(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.ColorLayer.fillSpecificElement ( Document  d,
ImageFile  f,
Element  e 
)
inlineprotectedvirtual

Implements mhr.appcore.image.layers.Layer.

Definition at line 82 of file ColorLayer.java.

{
appendLeafElement(d, e, "BlendMode", mode.toString());
appendLeafElement(d, e, "Color", Integer.toString(color));
}
void mhr.appcore.image.layers.ColorLayer.finalize ( ) throws Throwable
inlineprotected

Definition at line 42 of file ColorLayer.java.

{
super.finalize();
}
int mhr.appcore.image.layers.ColorLayer.getColor ( )
inline

Definition at line 110 of file ColorLayer.java.

{
return color;
}
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;
}
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;
}
BlendMode mhr.appcore.image.layers.ColorLayer.getMode ( )
inline

Vrací mód vrstvy.

Returns

Definition at line 98 of file ColorLayer.java.

{
return mode;
}
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.ColorLayer.getType ( )
inlinevirtual

Vrací typ vrstvy.

Implements mhr.appcore.image.layers.Layer.

Definition at line 90 of file ColorLayer.java.

{
return LayerType.LAYER_COLOR;
}
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.ColorLayer.setColor ( int  color)
inline

Definition at line 114 of file ColorLayer.java.

{
this.color = color;
}
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.ColorLayer.setMode ( BlendMode  mode)
inline

Nastavuje mód vrstvy.

Parameters
mode

Definition at line 106 of file ColorLayer.java.

{
this.mode = mode;
}
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.ColorLayer.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 213 of file ColorLayer.java.

{
if (!(presentation.extra instanceof ColorLayerSpecificPresentation)) {
throw new InvalidLayerSpecificPresentationSuppliedException("Invalid specific data supplied");
}
ColorLayerSpecificPresentation p = (ColorLayerSpecificPresentation) presentation.extra;
mode = p.mode;
color = p.color;
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.ColorLayer.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 205 of file ColorLayer.java.

{
ColorLayerSpecificPresentation p = new ColorLayerSpecificPresentation();
p.mode = mode;
p.color = color;
info.extra = p;
}

Member Data Documentation

int mhr.appcore.image.layers.ColorLayer.color
protected

Barva výplně

Definition at line 35 of file ColorLayer.java.

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.

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.

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.

BlendMode mhr.appcore.image.layers.ColorLayer.mode
protected

Blendovací mód.

Definition at line 34 of file ColorLayer.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: