use of org.gephi.appearance.plugin.RankingElementColorTransformer.LinearGradient in project gephi by gephi.
the class RecentPalettes method retrieve.
private void retrieve() {
gradients.clear();
Preferences prefs = getPreferences();
for (int i = 0; i < maxSize; i++) {
byte[] cols = prefs.getByteArray(COLORS + i, null);
byte[] poss = prefs.getByteArray(POSITIONS + i, null);
if (cols != null && poss != null) {
try {
Color[] colors = deserializeColors(cols);
float[] posisitons = deserializePositions(poss);
LinearGradient linearGradient = new LinearGradient(colors, posisitons);
gradients.addLast(linearGradient);
} catch (Exception e) {
e.printStackTrace();
}
} else {
break;
}
}
}
use of org.gephi.appearance.plugin.RankingElementColorTransformer.LinearGradient in project gephi by gephi.
the class RecentPalettes method store.
private void store() {
Preferences prefs = getPreferences();
// clear the backing store
try {
prefs.clear();
} catch (BackingStoreException ex) {
}
int i = 0;
for (LinearGradient gradient : gradients) {
try {
prefs.putByteArray(COLORS + i, serializeColors(gradient.getColors()));
prefs.putByteArray(POSITIONS + i, serializePositions(gradient.getPositions()));
} catch (Exception e) {
e.printStackTrace();
}
i++;
}
}
use of org.gephi.appearance.plugin.RankingElementColorTransformer.LinearGradient in project gephi by gephi.
the class RecentPalettes method add.
public void add(LinearGradient gradient) {
//Remove the old
gradients.remove(gradient);
// add to the top
gradients.push(new LinearGradient(gradient.getColors(), gradient.getPositions()));
while (gradients.size() > maxSize) {
gradients.removeLast();
}
store();
}
Aggregations