Skip to content

Commit

Permalink
Fixed soft attribute in Shapes.
Browse files Browse the repository at this point in the history
Fixed thumbnails in PDF when they were taller than width.
  • Loading branch information
ggarra13 committed Jun 10, 2023
1 parent 30e5f91 commit a4dbc99
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ https://sourceforge.net/projects/mrv2/files/
.tar.gz file and you can uncompress it with:

```
tar -xf mrv2-v0.3.1-amd64.tar.gz.
tar -xf mrv2-v0.6.1-amd64.tar.gz
```

That will create a folder in the direcory
Expand Down Expand Up @@ -324,7 +324,7 @@ media-autobuild_suite.bat

If you have a bin directory in your $HOME (ie. ~/bin ), the build scripts will
create a symlink there. So you should add ~/bin to your PATH in your .bashrc
or .zahrc.
or .zshrc.

Assuming you complied mrv2 with the ~/bin directory already created, then to
start mrv2 then you'd do:
Expand Down
4 changes: 4 additions & 0 deletions mrv2/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ v0.6.1
- Added a Scripts/Add to Script List to Python Panel. It allows you to store
up to 10 scripts in the list and run them just by accessing the menu.
The script list is saved in the preferences.
- Fixed window size on starting mrv2 when Dock Group was open.
- Fixed PDF thumbnail creation when the clip was taller than its width.
- Fixed annotations not keeping the soft parameter in session or network
connection.

v0.6.0
------
Expand Down
3 changes: 3 additions & 0 deletions mrv2/lib/mrvDraw/Shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ namespace tl
j["matrix"] = matrix;
j["color"] = color;
j["pen_size"] = value.pen_size;
j["soft"] = value.soft;
}

void from_json(const nlohmann::json& j, Shape& value)
{
j.at("matrix").get_to(value.matrix);
j.at("color").get_to(value.color);
j.at("pen_size").get_to(value.pen_size);
if (j.contains("soft"))
j.at("soft").get_to(value.soft);
}

void to_json(nlohmann::json& j, const PathShape& value)
Expand Down
4 changes: 3 additions & 1 deletion mrv2/lib/mrvDraw/Shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace tl
public:
Shape() :
color(0.F, 1.F, 0.F, 1.F),
pen_size(5){};
pen_size(5),
soft(false){};

virtual ~Shape(){};

Expand All @@ -36,6 +37,7 @@ namespace tl
public:
math::Matrix4x4f matrix;
imaging::Color4f color;
bool soft;
float pen_size;
};

Expand Down
10 changes: 10 additions & 0 deletions mrv2/lib/mrvFl/mrvPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,11 @@ namespace mrv
float pct = std_any_empty(value) ? 0.2 : std_any_cast<float>(value);
int width = ui->uiViewGroup->w() * pct;

value = settingsObject->value("gui/DockGroup/Visible");
int visible = std_any_empty(value) ? 0 : std_any_cast<int>(value);
if (visible)
ui->uiDockGroup->show();

// Set a minimum size for dockgroup
if (width < 270)
width = 270;
Expand Down Expand Up @@ -958,6 +963,11 @@ namespace mrv
float pct = (float)width / ui->uiViewGroup->w();
settingsObject->setValue("gui/DockGroup/Width", pct);

visible = 0;
if (ui->uiDockGroup->visible())
visible = 1;
settingsObject->setValue("gui/DockGroup/Visible", visible);

Fl_Preferences base(prefspath().c_str(), "filmaura", "mrv2");
base.set("version", 7);

Expand Down
6 changes: 0 additions & 6 deletions mrv2/lib/mrvGL/mrvGLShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ namespace mrv
virtual ~GLShape(){};

virtual void draw(const std::shared_ptr<timeline::IRender>&) = 0;

public:
bool soft = false;
};

class GLCircleShape : public GLShape
Expand Down Expand Up @@ -63,9 +60,6 @@ namespace mrv
virtual ~GLPathShape(){};

void draw(const std::shared_ptr<timeline::IRender>&) override;

public:
bool soft = false;
};

void to_json(nlohmann::json& json, const GLPathShape& value);
Expand Down
25 changes: 21 additions & 4 deletions mrv2/lib/mrvPDF/mrvSavePDF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,29 @@ namespace mrv
image =
HPDF_LoadRawImageFromMem(pdf, buffer, W, H, HPDF_CS_DEVICE_RGB, 8);

size_t W2 = kThumbnailWidth;
int Xoffset = 0;
if (W >= H)
{
size_t W2 = kThumbnailWidth;

H = thumbnailHeight = W2 * H / W;
W = W2;
}
else
{
size_t H2 = kThumbnailHeight;

W = H2 * W / H;
if (W > kThumbnailWidth)
W = kThumbnailWidth;

H = thumbnailHeight = W2 * H / W;
W = W2;
int centerX = (kThumbnailWidth - W) / 2;
Xoffset = centerX - W / 2;

H = thumbnailHeight = H2;
}

HPDF_Page_DrawImage(page, image, P.x, P.y, W, H);
HPDF_Page_DrawImage(page, image, P.x + Xoffset, P.y, W, H);
}

void PDFCreator::print_time(HPDF_Font font, const ViewerUI* ui)
Expand Down
1 change: 1 addition & 0 deletions mrv2/lib/mrvPDF/mrvSavePDF.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace mrv
{
protected:
const int kThumbnailWidth = 175;
const int kThumbnailHeight = 80;

public:
PDFCreator(
Expand Down

0 comments on commit a4dbc99

Please sign in to comment.