本文整理汇总了Java中org.monte.media.math.Rational.max方法的典型用法代码示例。如果您正苦于以下问题:Java Rational.max方法的具体用法?Java Rational.max怎么用?Java Rational.max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.monte.media.math.Rational
的用法示例。
在下文中一共展示了Rational.max方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseDragged
import org.monte.media.math.Rational; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
if (movie == null) {
return;
}
if (pressedHandle != null) {
Rational time = posToTime(e.getX());
switch (pressedHandle) {
case SelectionStart:
time = Rational.min(time, movie.getSelectionEnd());
movie.setSelectionStart(time);
movie.setInsertionPoint(time);
break;
case SelectionEnd:
time = Rational.max(movie.getSelectionStart(), time);
movie.setSelectionEnd(time);
movie.setInsertionPoint(time);
break;
case InsertionPoint:
movie.setInsertionPoint(time);
break;
}
}
}
示例2: posToTime
import org.monte.media.math.Rational; //导入方法依赖的package包/类
protected Rational posToTime(int pos) {
Rational fraction = new Rational(pos - trackInsets.left, getWidth() - trackInsets.left - trackInsets.right);
fraction = Rational.max(new Rational(0, 1), Rational.min(new Rational(1, 1), fraction));
Rational time = fraction.multiply(movie.getDuration());
if (timeTrack != -1) {
long sample = movie.timeToSample(timeTrack, time);
time = movie.sampleToTime(timeTrack, sample);
}
return time;
}
示例3: createMovieWriter
import org.monte.media.math.Rational; //导入方法依赖的package包/类
protected MovieWriter createMovieWriter() throws IOException {
File f = createMovieFile(fileFormat);
recordedFiles.add(f);
MovieWriter mw = w = Registry.getInstance().getWriter(fileFormat, f);
// Create the video encoder
Rational videoRate = Rational.max(screenFormat.get(FrameRateKey), mouseFormat.get(FrameRateKey));
ffrDuration = videoRate.inverse();
Format videoInputFormat = screenFormat.prepend(MediaTypeKey, MediaType.VIDEO,
EncodingKey, ENCODING_BUFFERED_IMAGE,
WidthKey, captureArea.width,
HeightKey, captureArea.height,
FrameRateKey, videoRate);
Format videoOutputFormat = screenFormat.prepend(
FrameRateKey, videoRate,
MimeTypeKey, fileFormat.get(MimeTypeKey))//
//
.append(//
WidthKey, captureArea.width,
HeightKey, captureArea.height);
videoTrack = w.addTrack(videoOutputFormat);
if (audioFormat != null) {
audioTrack = w.addTrack(audioFormat);
}
Codec encoder = Registry.getInstance().getEncoder(w.getFormat(videoTrack));
if (encoder == null) {
throw new IOException("No encoder for format " + w.getFormat(videoTrack));
}
frameEncoder = encoder;
frameEncoder.setInputFormat(videoInputFormat);
frameEncoder.setOutputFormat(videoOutputFormat);
if (frameEncoder.getOutputFormat() == null) {
throw new IOException("Unable to encode video frames in this output format:\n" + videoOutputFormat);
}
// If the capture area does not have the same dimensions as the
// video format, create a codec chain which scales the image before
// performing the frame encoding.
if (!videoInputFormat.intersectKeys(WidthKey, HeightKey).matches(
videoOutputFormat.intersectKeys(WidthKey, HeightKey))) {
ScaleImageCodec sic = new ScaleImageCodec();
sic.setInputFormat(videoInputFormat);
sic.setOutputFormat(videoOutputFormat.intersectKeys(WidthKey, HeightKey).append(videoInputFormat));
frameEncoder = new CodecChain(sic, frameEncoder);
}
// FIXME - There should be no need for format-specific code.
if (screenFormat.get(DepthKey) == 8) {
if (w instanceof AVIWriter) {
AVIWriter aviw = (AVIWriter) w;
aviw.setPalette(videoTrack, Colors.createMacColors());
} else if (w instanceof QuickTimeWriter) {
QuickTimeWriter qtw = (QuickTimeWriter) w;
qtw.setVideoColorTable(videoTrack, Colors.createMacColors());
}
}
fileStartTime = System.currentTimeMillis();
return mw;
}