Fix brush hardness set and get.

master
poikilos 2020-10-07 01:40:32 -04:00
parent d236673e51
commit 3225887464
6 changed files with 46 additions and 11 deletions

2
.gitignore vendored
View File

@ -35,4 +35,4 @@ Makefile*
# QtCtreator CMake
CMakeLists.txt.user
*.blend1

View File

@ -1,7 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.
## [Unreleased] - 2019-06-28
## [git] - 2020-10-07
### Changed
- (examples.blend) Upgrade blend to 2.83.5 (paste objects into a new file)
### Fixed
- (examples.blend) Turn on "Soft Shadows" render option to avoid
large aliasing artifacts on shadows.
- Calculate and change brush hardness correctly.
## [git] - 2019-06-28
- Add potential references from local directories.
- Add note regarding new documents to README.md.
- Name and sort documents better.

Binary file not shown.

View File

@ -1,8 +1,8 @@
# RotoCanvas
For now this repository serves as a collection of terminal commands for
manipulating videos and DVDs, but if you can get the code working, let
me know. I'll change this message if I make more progress. See [FFMpeg
Notes](#FFMpeg Notes) below, and the "more" directory. Upstream ideas
me know. I'll change this message if I make more progress. See [FFmpeg
Notes](#FFmpeg Notes) below, and the "more" directory. Upstream ideas
and code from "more" directory that are implemented will be moved to
"references". Please read "Purpose" and "Why aren't there more
rotoscoping applications?" below before commenting on the code or
@ -192,6 +192,9 @@ rotoscoped out, there will be both the error and a corrected blotch
that is the error's original position & shape), which in such cases
would require redoing the rotoscoping.
### Alternate names
See "~/Nextcloud/d.cs/RotoCanvas/1.RotoCanvas (SEE GitHub instead).txt"
### Backends
#### Python
(Not Tried Yet)
@ -205,6 +208,22 @@ would require redoing the rotoscoping.
- <https://github.com/mattrobenolt/colors.py>: "Convert colors between
rgb, hsv, and hex, perform arithmetic, blend modes, and generate
random colors within boundaries"
- VapourSynth
- Python equivalent to AviSynth
- has a cli tool for piping output into ffmpeg or other tools
- ffmpeg
- See also: the "ffmpeg Notes" section.
- Possibly bake changes to png files then overlay them onto the video
(to use frame rate from video automatically):
`ffmpeg -i foo.mkv -i bar%04d.png -filter_complex "[1:v]format=argb,geq=r='r(X,Y)':a='alpha(X,Y)'[zork]; [0:v][zork]overlay" -vcodec libx264 myresult.mkv`
- based on
<https://stackoverflow.com/questions/38753739/ffmpeg-overlay-a-png-image-on-a-video-with-custom-transparency>
answered Aug 3 '16 at 22:00 RocketNuts
- overall opacity can be multiplied by prepending a value such
as `0.5*`, for example: `a=0.5*'alpha(X,Y)'`
- For no custom opacity (only 2nd layer's alpha), simplify to the
line in the question at that link:
`ffmpeg -i foo.mkv -i bar.png -filter_complex "[0:v][1:v]overlay" -vcodec libx264 myresult.mkv`
### RotoCanvas Paint Notes
* The save method is used by both the Save and the Save As actions. The
@ -278,7 +297,7 @@ kind. Use this software at your own risk.*
- or download and unzip **megui** to `C:\PortableApps\Video` and add
`C:\PortableApps\Video\megui\tools\mencoder` to your PATH.
### FFMpeg Notes
### FFmpeg Notes
- For a program that has a narrow use case but has additional video
conversion commands embedded in the Python code as strings, see
<https://github.com/poikilos/IntroCompatiblizer>.

View File

@ -538,9 +538,14 @@ void RotoCanvas::setBrushRadius(double newWidth)
void RotoCanvas::setBrushHardness(double new_value)
{
if (new_value>1.0) new_value=1.0;
else if (new_value<0.0) new_value=0.0f;
brushHardRadius = brushRadius-(brushRadius*(1.0-new_value));
// brushHardRadius is the part that is hard, 0 for softest brush.
if (new_value > 1.0)
new_value = 1.0;
else if (new_value < 0.0)
new_value = 0.0f;
brushHardRadius = brushRadius * new_value;
if (brushHardRadius < 0.0)
brushHardRadius = 0.0;
}
void RotoCanvas::setBrushOpacity(double new_value)

View File

@ -48,13 +48,13 @@ public:
QString getFramePath(int frameNumber);
static QString getFramePath(QString folderPath, QString seqName, int frameNumber, int minDigitCount, QString format);
//QString getFramePath(int frameNumber);
// QString getFramePath(int frameNumber);
static QString getZeroPadded(int frameNumber, int minDigitCount);
static void drawAlphaPix(QImage* destImage, int x, int y, QColor sourceColor, double this_opacity);
bool getIsModified();
bool openImage(const QString &fileName);
bool saveFrame();//const QString &fileName, const char *fileFormat);
bool saveFrame(); // const QString &fileName, const char *fileFormat);
bool exportFrame(QDir destinationDir, const QString &sequenceName, const char *fileFormat, int frameNumber);
int exportFrames(QDir destinationDir, const QString &sequenceName, const char *fileFormat);
void setBrushColor(const QColor &newColor);
@ -64,7 +64,7 @@ public:
QColor getBrushColor() const { return brushColor; }
double getBrushRadius() const { return brushRadius; }
double getBrushHardness() const { return (brushRadius-brushHardRadius)/brushRadius; }
double getBrushHardness() const { return brushHardRadius / brushRadius; }
double getBrushOpacity() const { return brushOpacity; }
public slots: