MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / apply_waveform

Method apply_waveform

src/Clip.cpp:1400–1426  ·  view source on GitHub ↗

Apply apply_waveform image to the source frame (if any)

Source from the content-addressed store, hash-verified

1398
1399// Apply apply_waveform image to the source frame (if any)
1400void Clip::apply_waveform(std::shared_ptr<Frame> frame, QSize timeline_size) {
1401
1402 if (!Waveform()) {
1403 // Exit if no waveform is needed
1404 return;
1405 }
1406
1407 // Get image from clip
1408 std::shared_ptr<QImage> source_image = frame->GetImage();
1409
1410 // Debug output
1411 ZmqLogger::Instance()->AppendDebugMethod("Clip::apply_waveform (Generate Waveform Image)",
1412 "frame->number", frame->number,
1413 "Waveform()", Waveform(),
1414 "width", timeline_size.width(),
1415 "height", timeline_size.height());
1416
1417 // Get the color of the waveform
1418 int red = wave_color.red.GetInt(frame->number);
1419 int green = wave_color.green.GetInt(frame->number);
1420 int blue = wave_color.blue.GetInt(frame->number);
1421 int alpha = wave_color.alpha.GetInt(frame->number);
1422
1423 // Generate Waveform Dynamically (the size of the timeline)
1424 source_image = frame->GetWaveform(timeline_size.width(), timeline_size.height(), red, green, blue, alpha);
1425 frame->AddImage(source_image);
1426}
1427
1428// Scale a source size to a target size (given a specific scale-type)
1429QSize Clip::scale_size(QSize source_size, ScaleType source_scale, int target_width, int target_height) {

Callers

nothing calls this directly

Calls 5

GetImageMethod · 0.80
AppendDebugMethodMethod · 0.80
GetIntMethod · 0.80
GetWaveformMethod · 0.80
AddImageMethod · 0.80

Tested by

no test coverage detected