use of blue.soundObject.FrozenSoundObject in project blue by kunstmusik.
the class FrozenSoundObjectRenderer method render.
@Override
public void render(Graphics graphics, SoundObjectView sObjView, int pixelSeconds) {
Graphics2D g = (Graphics2D) graphics;
int w = sObjView.getSize().width;
int h = sObjView.getSize().height;
FrozenSoundObject fso = (FrozenSoundObject) sObjView.getSoundObject();
double percentOriginal = fso.getFrozenSoundObject().getSubjectiveDuration() / fso.getSubjectiveDuration();
Color bgColor;
Color border1;
Color border2;
Color fontColor;
if (sObjView.isSelected()) {
bgColor = selectedBgColor;
border1 = selectedBorder1;
border2 = selectedBorder2;
fontColor = selectedFontColor;
} else {
bgColor = normalBgColor;
border1 = normalBorder1;
border2 = normalBorder2;
fontColor = normalFontColor;
}
g.setPaint(bgColor);
// fill original soundObject area
g.fillRect(0, 2, w, h - 4);
// fill extended area
g.setColor(shadeColor);
g.fillRect((int) (w * percentOriginal), 2, w, h - 4);
// DRAW BORDERS
// if (ProgramOptions.getGeneralSettings().isDrawFlatSObjBorders()) {
// g.setColor(Color.LIGHT_GRAY);
// g.drawRect(0, 2, w - 1, h - 4);
// } else {
g.setColor(border1);
g.drawLine(0, 2, w - 1, 2);
g.drawLine(0, 2, 0, h - 4);
g.setColor(border2);
g.drawLine(0, h - 3, w, h - 3);
g.drawLine(w - 1, h - 3, w - 1, 2);
// }
g.setPaint(fontColor);
if (h >= 20) {
g.setComposite(AlphaComposite.Src);
g.setFont(renderFont);
String[] parts = sObjView.getSoundObject().getName().split("\\\\[n]");
for (int i = 0; i < parts.length; i++) {
int y = 15 + (i * Layer.LAYER_HEIGHT);
g.drawString(parts[i], 5, y);
}
}
}
Aggregations