App
Public Member Functions | Protected Attributes | List of all members
mhr.appcore.image.Image.UndoPatch Class Reference

Třída představuje záplatu, která slouží k vrácení zpět poslední úpravy rastrových dat. More...

Public Member Functions

Rect getArea ()
 vrací obdélník odpovídající oblasti pokryté záplatou.
 
int getId ()
 Vrací id vrstvy, pro kterou je záplata vytvořena.
 
ImageSelectedState getState ()
 vrací typ prvku, pro který je záplata vytvořena.
 
 UndoPatch (NBitmap from)
 Výchozí konstrukor.
 
 UndoPatch (NBitmap from, Rect fromArea, ImageSelectedState state, int id)
 Pokročilý konstruktor, pro uložení změn, které neprovádí nástroj.
 
boolean apply ()
 aplikuje záplatu, lze aplikovat cyklicky.
 
void dispose ()
 Uvolní nativní prostředky.
 

Protected Attributes

ImageSelectedState state = ImageSelectedState.SELECTED_NONE
 
int id
 
Rect area
 
NBitmap patch = null
 

Detailed Description

Třída představuje záplatu, která slouží k vrácení zpět poslední úpravy rastrových dat.

Definition at line 81 of file Image.java.

Constructor & Destructor Documentation

mhr.appcore.image.Image.UndoPatch.UndoPatch ( NBitmap  from)
inline

Výchozí konstrukor.

Výchozí konstrukor. Zadá se pouze bitmapa, která se má použít pro vytvoření záplaty, ostatní informace si sám vezme z obrazu.

Parameters
from

Definition at line 118 of file Image.java.

{
if (canvasChangedArea.getWidth() > 0 && canvasChangedArea.getHeight() > 0) { // Jinak se nealokuje bitmapa
area = new Rect(canvasChangedArea);
BitmapInfo i = from.getInfo();
patch = new NBitmap(new BitmapInfo(area.getWidth(), area.getHeight(), i.channelCount, i.depth, i.colorMode, i.premultiplied));
from.copyTo(patch, area, 0, 0);
}
}
mhr.appcore.image.Image.UndoPatch.UndoPatch ( NBitmap  from,
Rect  fromArea,
ImageSelectedState  state,
int  id 
)
inline

Pokročilý konstruktor, pro uložení změn, které neprovádí nástroj.

Parameters
from
fromArea
state
id

Definition at line 136 of file Image.java.

{
this.state = state;
this.id = id;
if (fromArea.getWidth() > 0 && fromArea.getHeight() > 0) { // Jinak se nealokuje bitmapa
area = new Rect(fromArea);
BitmapInfo i = from.getInfo();
patch = new NBitmap(new BitmapInfo(area.getWidth(), area.getHeight(), i.channelCount, i.depth, i.colorMode, i.premultiplied));
from.copyTo(patch, area, 0, 0);
}
}

Member Function Documentation

boolean mhr.appcore.image.Image.UndoPatch.apply ( )
inline

aplikuje záplatu, lze aplikovat cyklicky.

Returns
true, pokud se podařilo aplikovat.

Definition at line 151 of file Image.java.

{
if (patch == null || canvasOwner != null) {
return false;
}
NBitmap target = null;
switch (state) {
case SELECTED_LAYER:
try {
Layer l = getLayer(id);
target = ((RasterLayer)l).getBitmap();
} catch (LayerNotFoundException e) {
return false;
} catch (ClassCastException e) {
throw new ImageException("Bad undo action - not RasterLayer");
}
break;
case SELECTED_MASK:
try {
Layer l = getLayer(id);
target = l.getMask(false);
} catch (LayerNotFoundException e) {
return false;
}
break;
case SELECTED_MASTER_MASK:
target = masterMask;
break;
case SELECTED_NONE:
return false;
}
if (target == null ) {
return false;
}
NBitmap tmp = new NBitmap(patch.getInfo());
target.copyTo(tmp, area, 0, 0);
patch = tmp;
return true;
}
void mhr.appcore.image.Image.UndoPatch.dispose ( )
inline

Uvolní nativní prostředky.

Definition at line 200 of file Image.java.

{
if (patch != null) {
patch = null;
}
}
Rect mhr.appcore.image.Image.UndoPatch.getArea ( )
inline

vrací obdélník odpovídající oblasti pokryté záplatou.

Returns

Definition at line 91 of file Image.java.

{
return new Rect(area);
}
int mhr.appcore.image.Image.UndoPatch.getId ( )
inline

Vrací id vrstvy, pro kterou je záplata vytvořena.

Returns

Definition at line 99 of file Image.java.

{
return id;
}
ImageSelectedState mhr.appcore.image.Image.UndoPatch.getState ( )
inline

vrací typ prvku, pro který je záplata vytvořena.

Returns

Definition at line 107 of file Image.java.

{
return state;
}

Member Data Documentation

Rect mhr.appcore.image.Image.UndoPatch.area
protected

Definition at line 84 of file Image.java.

int mhr.appcore.image.Image.UndoPatch.id
protected

Definition at line 83 of file Image.java.

NBitmap mhr.appcore.image.Image.UndoPatch.patch = null
protected

Definition at line 85 of file Image.java.

ImageSelectedState mhr.appcore.image.Image.UndoPatch.state = ImageSelectedState.SELECTED_NONE
protected

Definition at line 82 of file Image.java.


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