Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3055c85
feat: handling timeline deletion
JeremyMeissner May 6, 2022
7c3170f
chore: doing animation section
JeremyMeissner May 6, 2022
02d75b1
docs: add brand identity
JeremyMeissner May 7, 2022
7adcd6f
feat: shape animation list ui
JeremyMeissner May 9, 2022
3732d3c
Merge branch '5-timeline-implementation' of https://github.com/Jeremy…
JeremyMeissner May 9, 2022
6055621
chore: interpolation implementation
JeremyMeissner May 10, 2022
687c8b4
feat: timeline loop
JeremyMeissner May 11, 2022
25f76b3
refactor: global structure
JeremyMeissner May 11, 2022
1e79797
chore: add camera
JeremyMeissner May 12, 2022
548a88d
chore: change timeline logic
JeremyMeissner May 13, 2022
d5a1681
chore: remove loop/reverse
JeremyMeissner May 14, 2022
672470b
feat: angle supported
JeremyMeissner May 14, 2022
80ad23d
refactor: selector
JeremyMeissner May 15, 2022
029cb93
feat: color importation
JeremyMeissner May 16, 2022
1963b2b
refactor: timeline
JeremyMeissner May 16, 2022
432cd5f
refactor: timeline
JeremyMeissner May 17, 2022
053ccc0
refactor: remove unused code
JeremyMeissner May 18, 2022
a7cea3a
feat: add triangle
JeremyMeissner May 20, 2022
a0814c1
refactor: window class
JeremyMeissner May 23, 2022
6dba92e
chore: change d attr regex
JeremyMeissner May 25, 2022
172e538
chore: update shader
JeremyMeissner May 31, 2022
f520c1d
refactor: Renderer
JeremyMeissner Jun 1, 2022
cc7863c
fix: path drawing problem
JeremyMeissner Jun 2, 2022
e774ed9
chore: serialization
JeremyMeissner Jun 2, 2022
d153021
feat: serialization
JeremyMeissner Jun 2, 2022
860a7d2
fix: import form render
JeremyMeissner Jun 3, 2022
8a6c0b2
refactor: path structure
JeremyMeissner Jun 7, 2022
780e5b3
refactor: whole structure
JeremyMeissner Jun 8, 2022
b37ec4f
fix: picker filter reset
JeremyMeissner Jun 8, 2022
c9d0296
refactor: add comments
JeremyMeissner Jun 8, 2022
b585b8c
chore: remove useless close button
JeremyMeissner Jun 9, 2022
0808cba
refactor: whole structure
JeremyMeissner Jun 9, 2022
3666559
refactor: remove useless using
JeremyMeissner Jun 9, 2022
78bdd4c
Merge branch 'master' into 5-timeline-implementation
JeremyMeissner Jun 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: change timeline logic
  • Loading branch information
JeremyMeissner committed May 13, 2022
commit 548a88d3c4b40399d85d9b5880376df9e6dfd8b0
24 changes: 24 additions & 0 deletions FreeFrame/Components/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading.Tasks;
using System.Xml;
using FreeFrame.Components.Shapes;
using OpenTK.Mathematics;

namespace FreeFrame.Components
{
Expand Down Expand Up @@ -66,5 +67,28 @@ static public (List<Shape>, bool) ImportFromString(string pString)

return ImportFromStream(new MemoryStream(byteArray));
}

static public void ExportToFile(List<Shape> shapes, Vector2i clientSize)
{

using (FileStream fs = new FileStream("output.svg", FileMode.Create))
{
byte[] bytes = Encoding.ASCII.GetBytes($@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<svg xmlns=""http://www.w3.org/2000/svg"" version=""1.1"" width=""{clientSize.X}"" height=""{clientSize.Y}"" >" + Environment.NewLine);

for (int i = 0; i < bytes.Length; i++)
fs.WriteByte(bytes[i]);

foreach (Shape shape in shapes)
{
bytes = Encoding.ASCII.GetBytes(shape.ToString() + Environment.NewLine);
for (int i = 0; i < bytes.Length; i++)
fs.WriteByte(bytes[i]);
}
bytes = Encoding.ASCII.GetBytes("</svg>");
for (int i = 0; i < bytes.Length; i++)
fs.WriteByte(bytes[i]);
}
}
}
}
2 changes: 1 addition & 1 deletion FreeFrame/Components/Shapes/SVGCircle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public SVGCircle(int r, int cx, int cy)
ImplementObject();
}

public override string ToString() => $"cx: {X + Width / 2}, cy: {Y + Height / 2}, r: {Width / 2}";
public override string ToString() => $"<circle cx=\"{X + Width / 2}\" cy=\"{Y + Height / 2}\" r=\"{Width / 2}\" fill=\"{ColorToHexadecimal(Color)}\"/>";

public override float[] GetVertices() => new float[] { X, Y, X + Width, Y, X + Width, Y + Height, X, Y + Height }; // x, y, x, y, x, y, ... (clockwise)
public override uint[] GetVerticesIndexes() => new uint[] { 0, 1, 2, 0, 2, 3 }; // TODO: please dont hardcode
Expand Down
2 changes: 1 addition & 1 deletion FreeFrame/Components/Shapes/SVGLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SVGLine(int x1, int y1, int x2, int y2)
}
public override float[] GetVertices() => new float[] { X, Y, Width + X, Height + Y }; // x, y, x, y, x, y, ... (clockwise)
public override uint[] GetVerticesIndexes() => new uint[] { 0, 1 }; // TODO: please dont hardcode
public override string ToString() => $"x1: {X}, y1: {Y}, x2: {Width + X}, y2: {Height + Y}";
public override string ToString() => $"<line x1=\"{X}\" y1=\"{Y}\" x2=\"{Width + X}\" y2=\"{Height + Y}\" fill=\"{ColorToHexadecimal(Color)}\"/>";
public override List<Vector2i> GetSelectablePoints()
{
List<Vector2i> points = new();
Expand Down
4 changes: 2 additions & 2 deletions FreeFrame/Components/Shapes/SVGPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ public override List<Vector2i> GetSelectablePoints()

public override string ToString()
{
string output = "d: ";
string output = "<path d=\"";
DrawAttributes.ForEach(d => output += d.ToString() + " ");
return output.Trim();
return output.Trim() + $"\" fill=\"{ColorToHexadecimal(Color)}\"/>";
}
}
}
6 changes: 5 additions & 1 deletion FreeFrame/Components/Shapes/SVGRectangle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ public override void ImplementObject()
}
public override float[] GetVertices() => new float[] { X, Y, X + Width, Y, X + Width, Y + Height, X, Y + Height }; // x, y, x, y, x, y, ... (clockwise)
public override uint[] GetVerticesIndexes() => new uint[] { 0, 1, 2, 0, 2, 3 }; // TODO: please dont hardcode
public override string ToString()
{
return $"<rect x=\"{X}\" y=\"{Y}\" width=\"{Width}\" height=\"{Height}\" rx=\"{CornerRadius}\" ry=\"{CornerRadius}\" fill=\"{ColorToHexadecimal(Color)}\"/>";
}


public override string ToString() => $"x: {X}, y: {Y}, width: {Width}, height: {Height}, rx: {CornerRadius}, ry: {CornerRadius}";

public override List<Vector2i> GetSelectablePoints()
{
Expand Down
10 changes: 10 additions & 0 deletions FreeFrame/Components/Shapes/Shape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ public void DeleteObjects()
public abstract void Move(Vector2i position);
public abstract void Resize(Vector2i size);
public abstract override string ToString();

public static string ColorToHexadecimal(Color4 color)
{
int r, g, b, a;
r = (int)(color.R * 255);
g = (int)(color.G * 255);
b = (int)(color.B * 255);
a = (int)(color.A * 255);
return '#' + r.ToString("X2") + g.ToString("X2") + b.ToString("X2") + a.ToString("X2");
}
}

}
7 changes: 7 additions & 0 deletions FreeFrame/FreeFrame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AnimatedGif" Version="1.0.5" />
<PackageReference Include="Delaunator" Version="1.0.9" />
<PackageReference Include="Emgu.CV" Version="4.5.5.4823" />
<PackageReference Include="Emgu.CV.Bitmap" Version="4.5.5.4823" />
<PackageReference Include="Emgu.CV.runtime.ubuntu.20.04-x64" Version="4.5.5.4823" />
<PackageReference Include="Emgu.CV.runtime.windows" Version="4.5.5.4823" />
<PackageReference Include="GifMotion" Version="1.0.4" />
<PackageReference Include="ImGui.NET" Version="1.87.3" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="OpenTK" Version="4.7.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.1" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>

Expand Down
3 changes: 2 additions & 1 deletion FreeFrame/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ static void Main()
NativeWindowSettings nativeWindowSettings = new()
{
Size = new Vector2i(800, 600),
Title = "FreeFrame"
Title = "FreeFrame",
NumberOfSamples = 8,
};
using Window window = new(GameWindowSettings.Default, nativeWindowSettings); // Create window context (GLFW, OpenGL)

Expand Down
Loading