You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Another huge refactor and lots of big fixes! Time mapping now works... mostly. The jumpy / glitchy images have been solved by copying the AVFrame into an AVPicture, which does not get clobbered on the next decode.
Also, added a new frame number overaly (in the top, left part of the image), and a new AddColor() method, to change the size and color of the frame's image... Padded the end of the FFmpegWriter / WriteTrailer() method, to avoid having a codec ignore the last many frames.
This commit is contained in:
@@ -467,6 +467,20 @@ void Frame::Save(string path, float scale)
|
||||
copy.write(path);
|
||||
}
|
||||
|
||||
// Add (or replace) pixel data to the frame (based on a solid color)
|
||||
void Frame::AddColor(int width, int height, string color)
|
||||
{
|
||||
// Deallocate image memory
|
||||
if (image)
|
||||
{
|
||||
delete image;
|
||||
image = NULL;
|
||||
}
|
||||
|
||||
// Create new image object, and fill with pixel data
|
||||
image = new Magick::Image(Magick::Geometry(width, height), Magick::Color(color));
|
||||
}
|
||||
|
||||
// Add (or replace) pixel data to the frame
|
||||
void Frame::AddImage(int width, int height, const string map, const Magick::StorageType type, const void *pixels)
|
||||
{
|
||||
@@ -531,6 +545,28 @@ void Frame::AddOverlay(Frame* frame)
|
||||
image->composite(*overlay, Magick::SouthEastGravity, Magick::OverCompositeOp);
|
||||
}
|
||||
|
||||
// Experimental method to add the frame number on top of the image
|
||||
void Frame::AddOverlayNumber(int overlay_number)
|
||||
{
|
||||
stringstream label;
|
||||
if (overlay_number > 0)
|
||||
label << overlay_number;
|
||||
else
|
||||
label << number;
|
||||
|
||||
// Drawable text
|
||||
list<Magick::Drawable> lines;
|
||||
|
||||
lines.push_back(Magick::DrawableGravity(Magick::NorthWestGravity));
|
||||
lines.push_back(Magick::DrawableStrokeColor("#ffffff"));
|
||||
lines.push_back(Magick::DrawableFillColor("#ffffff"));
|
||||
lines.push_back(Magick::DrawableStrokeWidth(0.1));
|
||||
lines.push_back(Magick::DrawablePointSize(24));
|
||||
lines.push_back(Magick::DrawableText(5, 5, label.str()));
|
||||
|
||||
image->draw(lines);
|
||||
}
|
||||
|
||||
// Get pointer to Magick++ image object
|
||||
Magick::Image* Frame::GetImage()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user