Skip to content

Commit 4e1e5d5

Browse files
authored
Merge pull request #48 from anpawo/feature/text
Feature/text
2 parents 3b47d23 + cb89fcd commit 4e1e5d5

File tree

30 files changed

+232
-129
lines changed

30 files changed

+232
-129
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@ re: fclean
143143
.PHONY: debug
144144
debug: fclean
145145
$(MAKE) "CXXFLAGS = $(CXXFLAGS) -g3"
146+
# $(MAKE) "CXXFLAGS = $(CXXFLAGS) -g3" "CPPFLAGS = $(CPPFLAGS) -fsanitize=address" "LDFLAGS = $(LDFLAGS) -fsanitize=address"
146147

147148

148149
.PHONY: format
149150
format:
150151
clang-format -i **/*.cpp **/*.hpp
151152

152-
.PHONY: doc
153-
doc:
153+
.PHONY: docs
154+
docs:
155+
./vc --generate
154156
./docs/readme/generate.sh

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,26 @@ Below is an example of the last feature added (code) and the result (video).
1616
from videocode.VideoCode import *
1717

1818
x = 700
19-
y = 100
19+
y = 10
2020

2121
# text: Video-Code
22-
t = text("Video-Code", 3).apply(translate(x, y), repeat(40))
23-
t[:20].apply(fadeIn())
24-
t[20:].apply(fadeOut())
22+
t = text("Video-Code", 3).apply(translate(x, y), repeat(24 * 4))
23+
t[: 24 * 3].apply(fadeIn(LEFT))
2524
t.add()
25+
t.keep()
2626

27-
# text: Made by:
28-
t = text("made by", 3).apply(translate(x, y), repeat(40))
29-
t[:20].apply(fadeIn())
30-
t[20:].apply(fadeOut())
27+
# text: Made by
28+
t = text("made by", 3).apply(translate(x, y + 80), repeat(24 * 4))
29+
t[: 24 * 3].apply(fadeIn(LEFT))
3130
t.add()
31+
t.keep()
3232

3333

3434
# Me
35-
v = video("video/v.mp4").apply(translate(x, y + 100))
36-
v[0:20].apply(fadeIn()).add()
37-
v[20:40].apply(fadeOut()).add()
35+
v = video("video/v.mp4").apply(translate(x, y + 175))
36+
v[0:20].apply(fadeIn())
37+
v.add()
38+
v.keep()
3839
```
3940

4041
<img src="docs/readme/example.gif" style="width: 50%;">
@@ -87,6 +88,8 @@ To add the frames of the __Input__ to the timeline, use the __\<Input\>.add()__
8788
<summary><code>Patchs</code></summary>
8889
<br>
8990

91+
- `feature`: keep last frame of input on screen (06/03/25)
92+
- `rework`: one stack (06/03/25)
9093
- `transformation`: repeat (03/03/25)
9194
- `input`: text (03/03/25)
9295
- `rework`: position of the frames (02/03/25)

docs/readme/02_code.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33
from videocode.VideoCode import *
44

55
x = 700
6-
y = 100
6+
y = 10
77

88
# text: Video-Code
9-
t = text("Video-Code", 3).apply(translate(x, y), repeat(40))
10-
t[:20].apply(fadeIn())
11-
t[20:].apply(fadeOut())
9+
t = text("Video-Code", 3).apply(translate(x, y), repeat(24 * 4))
10+
t[: 24 * 3].apply(fadeIn(LEFT))
1211
t.add()
12+
t.keep()
1313

14-
# text: Made by:
15-
t = text("made by", 3).apply(translate(x, y), repeat(40))
16-
t[:20].apply(fadeIn())
17-
t[20:].apply(fadeOut())
14+
# text: Made by
15+
t = text("made by", 3).apply(translate(x, y + 80), repeat(24 * 4))
16+
t[: 24 * 3].apply(fadeIn(LEFT))
1817
t.add()
18+
t.keep()
1919

2020

2121
# Me
22-
v = video("video/v.mp4").apply(translate(x, y + 100))
23-
v[0:20].apply(fadeIn()).add()
24-
v[20:40].apply(fadeOut()).add()
22+
v = video("video/v.mp4").apply(translate(x, y + 175))
23+
v[0:20].apply(fadeIn())
24+
v.add()
25+
v.keep()
2526
```

docs/readme/05_patch_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
<summary><code>Patchs</code></summary>
3838
<br>
3939

40+
- `feature`: keep last frame of input on screen (06/03/25)
41+
- `rework`: one stack (06/03/25)
4042
- `transformation`: repeat (03/03/25)
4143
- `input`: text (03/03/25)
4244
- `rework`: position of the frames (02/03/25)

docs/readme/example.gif

2.28 MB
Loading

include/input/IInput.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class IInput
2424
///< Iteration
2525
virtual std::vector<Frame>::iterator begin() = 0;
2626
virtual std::vector<Frame>::iterator end() = 0;
27+
virtual Frame& back() = 0;
2728

2829
///< Repeat
2930
virtual void repeat(size_t n) = 0;

include/input/composite/Slice.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Slice final : public ABCCompositeInput
2424
///< Iteration
2525
std::vector<Frame>::iterator begin();
2626
std::vector<Frame>::iterator end();
27+
Frame& back();
2728

2829
///< Repeat
2930
void repeat(size_t n);

include/input/concrete/ABCConcreteInput.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ABCConcreteInput : public IInput
2626
///< Iteration
2727
std::vector<Frame>::iterator begin() final;
2828
std::vector<Frame>::iterator end() final;
29+
Frame& back() final;
2930

3031
///< Repeat
3132
void repeat(size_t n) final;

include/input/concrete/text/Text.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ class Text final : public ABCConcreteInput
1818

1919
Text(const std::string &text, double fontSize, int fontThickness, const std::vector<int> &color, int font = cv::FONT_HERSHEY_SIMPLEX);
2020
~Text() = default;
21+
22+
private:
23+
24+
const std::string _text;
2125
};

include/vm/Register.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,20 @@ class Register
2929
Register() = default;
3030
~Register() = default;
3131

32-
///< Update instructions
33-
void updateInstructions(json::array_t &&newInstructions);
34-
35-
///< Run the first instruction not done
36-
void runNextInstruction();
32+
///< Create a new `Input`
33+
void newInput(const std::string &type, const json::object_t &args);
3734

3835
///< Access _inputs at `index`
3936
std::shared_ptr<IInput> operator[](size_t index);
4037

38+
///< Remove old `Inputs`
39+
void clear();
40+
4141
private:
4242

4343
///< Variables representing the Inputs currently used in the program
4444
std::vector<std::shared_ptr<IInput>> _inputs{};
4545

46-
///< Instructions to create new Inputs: [[instructionName, {instructionArgs}]]
47-
json::array_t _instructions{};
48-
4946
///< Each instruction
5047
const std::map<std::string, std::function<void(const json::object_t &)>> _inputFactory{
5148
{"Image", [this](const json::object_t &args) { _inputs.push_back(std::make_shared<Image>(args.at("filepath"))); }},

0 commit comments

Comments
 (0)