zkweb-framework / zkweb.system.drawing Goto Github PK
View Code? Open in Web Editor NEW.Net Core compatible System.Drawing implementation modified from mono project.
License: Other
.Net Core compatible System.Drawing implementation modified from mono project.
License: Other
It maybe an excepted behavior, just record it.
I think that's a mono issue (same problem with CoreCompat) but anyway:
It's currently not possible to create a bitmap from a Icon (with transparency e.g. Vista and above Icons) and preserve transparency.
This works with MS .NET framework but not with this library (Background is black, not transparent)
Here is a usage sample: https://github.com/GathSystems/CygwinPortable/blob/master/Source/class/IconFromFile.cs
Thank you
I am using Windows 10 and installed ZKWeb.System Drawing 4.0.1. I added a simple Bitmap initialization line to the code. While debugging the my sample application on Android emulator, libgdiplus.dll not found exception is thrown. How can I fix it, could you help on this?
{System.TypeInitializationException: The type initializer for 'System.DrawingCore.GDIPlus' threw an exception. --->
System.DllNotFoundException: gdiplus
at (wrapper managed-to-native) System.DrawingCore.GDIPlus:GdiplusStartup (ulong&,System.DrawingCore.GdiplusStartupInput&,System.DrawingCore.GdiplusStartupOutput&)
at System.DrawingCore.GDIPlus..cctor () [0x000ab] in :0
--- End of inner exception stack trace ---
at System.DrawingCore.Bitmap..ctor (System.Int32 width, System.Int32 height, System.DrawingCore.Imaging.PixelFormat format) [0x00006] in :0
at System.DrawingCore.Bitmap..ctor (System.Int32 width, System.Int32 height) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.DrawingCore.Bitmap:.ctor (int,int)
at XamarinWebSample.SampleService+d__7.MoveNext () [0x00008] in C:\VS_TFS\DivaPos\Mobile\XamarinWebSample\XamarinWebSample\SampleService.cs:72
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet] (System.Runtime.CompilerServices.CallSite site, T0 arg0) [0x00104] in <65f4a23934a3468fae9abe3139b55169>:0
at XamarinWebSample.WebCallbackRepository+<>c__DisplayClass13_1+<b__1>d.MoveNext () [0x00148] in ..\XamarinWebSample\WebCallbackRepository.cs:125 }
Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Drawing.KnownColors' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at System.Drawing.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output)
at System.Drawing.GDIPlus..cctor()
--- End of inner exception stack trace ---
at System.Drawing.GDIPlus.RunningOnWindows()
at System.Drawing.KnownColors..cctor()
--- End of inner exception stack trace ---
at System.Drawing.KnownColors.FromKnownColor(KnownColor kc)
at QRCoder.QRCode.GetGraphic(Int32 pixelsPerModule)
at QrNetCore.Program.WriteQRImage(String data, Int32 ppm) in /home/raffael/MonoProjects/QrCoderNetcore/QrNetCore/Program.cs:line 23
at QrNetCore.Program.Main(String[] args) in /home/raffael/MonoProjects/QrCoderNetcore/QrNetCore/Program.cs:line 10
see: http://stackoverflow.com/questions/11398325/a-null-reference-or-invalid-value-was-found-gdi-status-invalidparameter
code trigger this bug is
newImg.SetResolution(img.HorizontalResolution, img.VerticalResolution)
I have made the gdiplus.dll by following your steps.
and build the gdiplus.dll into an docker images. and run a container with this image.
but it still shows "Unable to load DLL 'gdiplus.dll': The specified module could not be found."
Unhandled Exception: System.TypeInitializationException: The type initializer for 'DiscordLucarioBotnAPI.Program' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
I want to draw anything on the screen from a .NET Core Application. How does this library help me with that?
Thanks in advance.
I has except install package ZKWeb.System.Drawing from nuget and install libgdiplus flow the Step CentOS 7 and above , but it's also fail on CentOS7.(it's work on windows)
I want to use PrintDocument in .net core. Is there any way through which I can achieve that?
I want the following implementation:
public void Print()
{
PrintDocument pdPrint = null;
using (pdPrint = new PrintDocument())
{
pdPrint.PrinterSettings.PrinterName = printerName;
pdPrint.DefaultPageSettings.PaperSize = paperSize;
pdPrint.PrintPage += new PrintPageEventHandler((sender, e) => PrintPage(sender, e);
pdPrint.Print();
}
}
private void PrintPage(object sender, PrintPageEventArgs e)
{
float x, y, lineOffset;
Font printFontA = new Font("Microsoft Sans Serif", Convert.ToSingle(11), FontStyle.Bold, GraphicsUnit.Point); // Substituted to FontA Font
StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Far;
e.Graphics.PageUnit = GraphicsUnit.Point;
//Specify the line spacing between lines
lineOffset = printFontA.GetHeight(e.Graphics);
//Specify the starting position for printing
x = 50;
y = 50;
e.Graphics.DrawString("****Test****", printFontA, Brushes.Black, x, y);
}
My aim is to do printing in Linux using 'PrintPageEventArgs', can you please suggest me a way.
Hello.
The project itself is an ASP.NET Core Application, and I wish to draw some images with more code.
On Windows it runs normally when I start the program with "dotnet xxxx.dll" but on Ubuntu it was crash while the systemis available for about 1316000KB memory.
I tried to reduce the code a little and it runs normally.
But how to solve it if i want to keep the code length?
System.OutOfMemoryException: Not enough memory to complete operation [GDI+ status: OutOfMemory]
at System.DrawingCore.GDIPlus.CheckStatus(Status status)
at System.DrawingCore.Graphics.DrawLine(Pen pen, PointF pt1, PointF pt2)
at Daylily.Plugin.Command.PpPlus.Draw(String user, Dictionary`2 d_pfmance)
at Daylily.Plugin.Command.PpPlus.Execute(String params, String user, String group, Boolean isRoot)
var img = new Bitmap(500, 500);
var g = Graphics.FromImage(img);
g.Clear(Color.Gray);
g.DrawString("AABB", new Font("Arial", 140), new SolidBrush(Color.Red), new RectangleF(10, 10, 400, 400));
var sf = g.MeasureString("AABB", new Font("Arial", 140), 500, StringFormat.GenericTypographic);
Console.WriteLine(sf.Width);
//windows output 498
//centos 7 output 0
sf.Width
//windows output 498
//centos 7 output 0
and output image
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.