<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
+
+ <AssemblyVersion>0.0.1</AssemblyVersion>
+ <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
+
+ <Title>C.R.O.W Cairo Backend</Title>
+ <Description>C.R.O.W. is a widget toolkit and rendering engine developed in C# with templates, styles, compositing, and bindings.</Description>
+ <RepositoryUrl>https://github.com/jpbruyere/Crow</RepositoryUrl>
+ <PackageTags>Crow GUI Backend cairo</PackageTags>
+ <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
+ <PackageProjectUrl>https://github.com/jpbruyere/Crow/wiki</PackageProjectUrl>
+ <PackageLicenseExpression>MIT</PackageLicenseExpression>
+ <PackageIcon>crow.png</PackageIcon>
+ <PackageCopyright>Copyright 2021</PackageCopyright>
+ <PackageReleaseNotes>
+ </PackageReleaseNotes>
+ <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="src\**\*.cs" Exclude="src\NativeMethods-internal.cs" />
+ <Content Include="..\..\Images\crow.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
ctx.Dispose ();
clipping = null;
}
- public void ResizeMainSurface (int width, int height)
+ public virtual void ResizeMainSurface (int width, int height)
{
surf.Resize (width, height);
}
namespace Crow.Backends
{
- public class DefaultBackend : EglBackend {
+ public class DefaultBackend : ImageBackend {
/// <summary>
/// Create a new generic backend bound to the application surface
/// </summary>
public ImageBackend (int width, int height) : base () {
surf = new ImageSurface (Format.ARGB32, width, height);
}
+ public ImageBackend (IntPtr surfaceBitmapData, int width, int height, int stride) : base () {
+ surf = new ImageSurface (surfaceBitmapData, Format.ARGB32, width, height, stride);
+ }
+
public override ISurface CreateSurface(int width, int height)
=> new ImageSurface (Format.ARGB32, width, height);
public override ISurface CreateSurface(byte[] data, int width, int height)
/// <param name="height">the height of the window</param>
/// <param name="glfwWindowHandle">A valid GLFW window handle</param>
/// <returns></returns>
- public Interface (int width, int height, IntPtr glfwWindowHandle) : this (width, height, true, false)
+ public Interface (int width, int height, IntPtr glfwWindowHandle) : this (width, height, true)
{
hWin = glfwWindowHandle;
PerformanceMeasure.InitMeasures ();
/// <param name="height">the height of the native window</param>
/// <param name="singleThreaded">If 'false' start the ui update (InterfaceThread method) in a dedicated thread</param>
/// <param name="createSurface">If 'yes', create the main rendering surface on the native window</param>
- public Interface (int width = 800, int height = 600, bool singleThreaded = false, bool createSurface = true)
+ public Interface (int width = 800, int height = 600, bool singleThreaded = false)
{
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
//CurrentInterface = this;
clientRectangle = new Rectangle (0, 0, width, height);
SingleThreaded = singleThreaded;
-
- initBackend ();
-
PerformanceMeasure.InitMeasures ();
-
- if (!SingleThreaded) {
- Thread t = new Thread (InterfaceThread) {
- IsBackground = true
- };
- t.Start ();
- }
}
#endregion
/// call Init() then enter the running loop performing ProcessEvents until running==false.
/// </summary>
public virtual void Run () {
+ initBackend ();
+
+ if (!SingleThreaded) {
+ Thread t = new Thread (InterfaceThread) {
+ IsBackground = true
+ };
+ t.Start ();
+ }
+
Init ();
if (SingleThreaded) {
<!-- Used only by CrowIDE and CrowEdit-->
<CrowDesignModeEnabled>false</CrowDesignModeEnabled>
- <!-- Experimental vkvg backend, testing only-->
- <CrowVkvgBackend>false</CrowVkvgBackend>
-
<GlfwSharpVersion>0.2.14</GlfwSharpVersion>
</PropertyGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netcoreapp3.0</TargetFramework>
+ <TargetFramework>netstandard2.1</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<AssemblyVersion>1.0.0</AssemblyVersion>
{
public struct Point : IEquatable<Point>, IEquatable<int>
{
+ public static readonly Point UnitX = new Point (1,0);
+ public static readonly Point UnitY = new Point (0,1);
+
public int X, Y;
#region CTOR
namespace Drawing2D {
public struct PointD : IEquatable<PointD>, IEquatable<double> {
+ public static readonly PointD UnitX = new PointD (1,0);
+ public static readonly PointD UnitY = new PointD (0,1);
public double X;
public double Y;
public PointD (double x, double y)
namespace HelloWorld
{
class Program : Interface {
- Program() : base (800, 600, true, true) {}
+ Program() : base (800, 600, true) {}
static void Main (string[] args) {
using (Program app = new Program ()) {
- app.Initialized += (sender, e) => app.LoadIMLFragment (@"<Label Text='Hello World'/>");
+ //app.Initialized += (sender, e) => app.LoadIMLFragment (@"<Label Text='Hello World' Background='Red' Top='50' Margin='0'/>");
+ //app.Initialized += (sender, e) => app.LoadIMLFragment (@"<Window Caption='hello world'/>");
app.Run ();
}
}
+ protected override void OnInitialized()
+ {
+ Load ("/mnt/devel/crow/Samples/HelloWorld/ui/helloworld.crow");
+ }
}
}
}
public TestInterface (string[] args, int width = 800, int height = 600)
- : base (width, height, true, false)
+ : base (width, height, true)
{
string outDir = null;
Environment.SetEnvironmentVariable ("FONTCONFIG_PATH", @"C:\Users\Jean-Philippe\source\vcpkg\installed\x64-windows\tools\fontconfig\fonts");
using (Showcase app = new Showcase ()) {
- app.WindowTitle = "C.R.O.W Showcase";
//app.SetWindowIcon ("#Crow.Icons.crow.png");
//app.Theme = @"C:\Users\Jean-Philippe\source\Crow\Themes\TestTheme";
CurrentProgramInstance = app;
protected override void OnInitialized () {
base.OnInitialized ();
+ WindowTitle = "C.R.O.W Showcase";
+
Load ("#ShowCase.showcase.crow").DataSource = this;
crowContainer = FindByName ("CrowContainer") as Container;
editor = FindByName ("tb") as Editor;
public class SampleBase : Interface
{
public SampleBase(IntPtr hWin) : base(800, 600, hWin) { }
- public SampleBase() : base(800, 600, true, true) { }
+ public SampleBase() : base (800, 600, true) { }
public Version CrowVersion => Assembly.GetAssembly(typeof(Widget)).GetName().Version;