Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGS small update #2984

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@
"requested": "[4.7.0, )",
"resolved": "4.7.0",
"contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA=="
},
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3"
}
},
"Microsoft.NETFramework.ReferenceAssemblies.net48": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "zMk4D+9zyiEWByyQ7oPImPN/Jhpj166Ky0Nlla4eXlNL8hI/BtSJsgR8Inldd4NNpIAH3oh8yym0W2DrhXdSLQ=="
}
}
}
Expand Down
14 changes: 0 additions & 14 deletions source/Cosmos.Build.Tasks/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@
"System.Collections.Immutable": "5.0.0"
}
},
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3"
}
},
"Dapper.StrongName": {
"type": "Transitive",
"resolved": "2.0.90",
Expand All @@ -51,11 +42,6 @@
"resolved": "1.3.0",
"contentHash": "/fn1Tfo7j7k/slViPlM8azJuxQmri7FZ8dQ+gTeLbI29leN/1VK0U/BFcRdJNctsRCUgyKJ2q+I0Tjq07Rc1/Q=="
},
"Microsoft.NETFramework.ReferenceAssemblies.net48": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "zMk4D+9zyiEWByyQ7oPImPN/Jhpj166Ky0Nlla4eXlNL8hI/BtSJsgR8Inldd4NNpIAH3oh8yym0W2DrhXdSLQ=="
},
"Microsoft.VisualStudio.Setup.Configuration.Interop": {
"type": "Transitive",
"resolved": "1.16.30",
Expand Down
4 changes: 2 additions & 2 deletions source/Cosmos.Core_Asm/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@
"System.Reflection.TypeExtensions": "[4.7.0, )",
"System.Runtime.CompilerServices.Unsafe": "[5.0.0, )",
"System.Runtime.Loader": "[4.3.0, )",
"XSharp": "[0.1.0-localbuild, )"
"XSharp": "[10.0.0, )"
}
},
"dapperextensions.strongname": {
Expand Down Expand Up @@ -1150,7 +1150,7 @@
"xsharp": {
"type": "Project",
"dependencies": {
"Spruce": "[0.1.0-localbuild, )"
"Spruce": "[10.0.0, )"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions source/Cosmos.Core_Plugs/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@
"Cosmos.Debug.Kernel": "[0.1.0-localbuild, )",
"Cosmos.IL2CPU": "[0.1.0-localbuild, )",
"System.Reflection.TypeExtensions": "[4.7.0, )",
"XSharp": "[0.1.0-localbuild, )"
"XSharp": "[10.0.0, )"
}
},
"cosmos.debug.kernel": {
Expand All @@ -1136,7 +1136,7 @@
"System.Reflection.TypeExtensions": "[4.7.0, )",
"System.Runtime.CompilerServices.Unsafe": "[5.0.0, )",
"System.Runtime.Loader": "[4.3.0, )",
"XSharp": "[0.1.0-localbuild, )"
"XSharp": "[10.0.0, )"
}
},
"dapperextensions.strongname": {
Expand Down Expand Up @@ -1171,7 +1171,7 @@
"xsharp": {
"type": "Project",
"dependencies": {
"Spruce": "[0.1.0-localbuild, )"
"Spruce": "[10.0.0, )"
}
}
}
Expand Down
38 changes: 24 additions & 14 deletions source/Cosmos.Debug.GDB/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@
"version": 1,
"dependencies": {
".NETFramework,Version=v4.7.2": {
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net472": "1.0.3"
}
},
"Microsoft.NETFramework.ReferenceAssemblies.net472": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "0E7evZXHXaDYYiLRfpyXvCh+yzM2rNTyuZDI+ZO7UUqSc6GfjePiXTdqJGtgIKUwdI81tzQKmaWprnUiPj9hAw=="
},
"Microsoft.Win32.Registry": {
"type": "Transitive",
"resolved": "5.0.0",
Expand Down Expand Up @@ -44,6 +30,30 @@
"Microsoft.Win32.Registry": "[5.0.0, )"
}
}
},
".NETFramework,Version=v4.7.2/win7-x86": {
"Microsoft.Win32.Registry": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
"dependencies": {
"System.Security.AccessControl": "5.0.0",
"System.Security.Principal.Windows": "5.0.0"
}
},
"System.Security.AccessControl": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "dagJ1mHZO3Ani8GH0PHpPEe/oYO+rVdbQjvjJkBRNQkX4t0r1iaeGn8+/ybkSLEan3/slM0t59SVdHzuHf2jmw==",
"dependencies": {
"System.Security.Principal.Windows": "5.0.0"
}
},
"System.Security.Principal.Windows": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
}
}
}
}
2 changes: 1 addition & 1 deletion source/Cosmos.Debug.Kernel.Plugs.Asm/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"xsharp": {
"type": "Project",
"dependencies": {
"Spruce": "[0.1.0-localbuild, )"
"Spruce": "[10.0.0, )"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Plugs/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -1222,4 +1222,4 @@
}
}
}
}
}
40 changes: 40 additions & 0 deletions source/Cosmos.System2/Graphics/Bitmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,46 @@ private void CreateBitmap(Stream stream, ColorOrder colorOrder)
#endregion Pixel Table
}

/// <summary>
Samma2009 marked this conversation as resolved.
Show resolved Hide resolved
/// Resizes a specified Bitmap
/// </summary>
/// <param name="image">The original image</param>
/// <param name="NewW">The new width of the bitmap</param>
/// <param name="NewH">The new height of the bitmap</param>
/// <returns>Resized image</returns>
public static Bitmap Resize(Bitmap image, uint NewW, uint NewH)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename NewW to newWidth and NewH to newHeight

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not fixed

{
Bitmap tmp = new Bitmap(1,1,image.Depth);
tmp.RawData = image.RawData;
tmp.Resize(NewW,NewH);
return tmp;
}

/// <summary>
/// Gets a rectangle of pixels and stores it into a bitmap
/// </summary>
/// <param name="X">The x coordinate of the rectangle</param>
/// <param name="Y">The y coordinate of the rectangle</param>
/// <param name="W">The width of the rectangle</param>
/// <param name="H">The height of the rectangle</param>
/// <returns>Bitmap</returns>
public static Bitmap FromCanvasRegion(Canvas canvas, int X, int Y, ushort W, ushort H)
{

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the additional new lines and tabbing of the function

Bitmap tmp = new Bitmap(W, H, canvas.Mode.ColorDepth);

Samma2009 marked this conversation as resolved.
Show resolved Hide resolved
for (int x = X; x < W + X; x++)
{
for (int y = Y; y < H + Y; y++)
{
tmp.SetPixel(canvas.GetPointColor(x, y), x - X, y - Y);
}
}

return tmp;

}

/// <summary>
/// Saves the given image as a BMP file.
/// </summary>
Expand Down
7 changes: 5 additions & 2 deletions source/Cosmos.System2/Graphics/Canvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public virtual void DrawEllipse(Color color, int xCenter, int yCenter, int xR, i
/// <param name="yCenter">The Y center coordinate.</param>
/// <param name="xR">The X radius.</param>
/// <param name="yR">The Y radius.</param>
public virtual void DrawFilledEllipse(Color color, int xCenter, int yCenter, int yR, int xR)
public virtual void DrawFilledEllipse(Color color, int xCenter, int yCenter, int xR, int yR)
{
for (int y = -yR; y <= yR; y++)
{
Expand Down Expand Up @@ -641,7 +641,10 @@ public void DrawImageAlpha(Image image, int x, int y)
for (int yi = 0; yi < image.Height; yi++)
{
color = Color.FromArgb(image.RawData[xi + (yi * image.Width)]);
DrawPoint(color, x + xi, y + yi);
if (color.A > 0)
{
DrawPoint(color, x + xi, y + yi);
}
}
}
}
Expand Down
48 changes: 48 additions & 0 deletions source/Cosmos.System2/Graphics/Image.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;

namespace Cosmos.System.Graphics
Expand Down Expand Up @@ -43,6 +44,53 @@ protected Image(uint width, uint height, ColorDepth color)
Height = height;
Depth = color;
}

/// <summary>
/// Resizes the Image
/// </summary>
/// <param name="NewW">The new width of the bitmap</param>
/// <param name="NewH">The new height of the bitmap</param>
public void Resize(uint NewW, uint NewH)
{
this.RawData = ScaleImage(this, (int)NewW, (int)NewH);
this.Width = NewW;
this.Height = NewH;
}

/// <summary>
/// Sets a pixel of the image
/// </summary>
/// <param name="color">The color of the pixel</param>
/// <param name="X">The x coordinate of the pixel</param>
/// <param name="Y">The y coordinate of the pixel</param>
public void SetPixel(Color color,int X,int Y)
{
RawData[X + (Y * Width)] = color.ToArgb();
}

static int[] ScaleImage(Image image, int newWidth, int newHeight)
Samma2009 marked this conversation as resolved.
Show resolved Hide resolved
{
int[] pixels = image.RawData;
int w1 = (int)image.Width;
int h1 = (int)image.Height;
int[] temp = new int[newWidth * newHeight];
int xRatio = (int)((w1 << 16) / newWidth) + 1;
int yRatio = (int)((h1 << 16) / newHeight) + 1;
int x2, y2;

for (int i = 0; i < newHeight; i++)
{
for (int j = 0; j < newWidth; j++)
{
x2 = (j * xRatio) >> 16;
y2 = (i * yRatio) >> 16;
temp[(i * newWidth) + j] = pixels[(y2 * w1) + x2];
}
}

return temp;
}

}

/// <summary>
Expand Down
14 changes: 0 additions & 14 deletions source/Cosmos.VS.DebugEngine/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
"version": 1,
"dependencies": {
".NETFramework,Version=v4.8": {
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3"
}
},
"Microsoft.VisualStudio.Debugger.Engine": {
"type": "Direct",
"requested": "[17.0.2012801, )",
Expand Down Expand Up @@ -243,11 +234,6 @@
"resolved": "1.1.3",
"contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
},
"Microsoft.NETFramework.ReferenceAssemblies.net48": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "zMk4D+9zyiEWByyQ7oPImPN/Jhpj166Ky0Nlla4eXlNL8hI/BtSJsgR8Inldd4NNpIAH3oh8yym0W2DrhXdSLQ=="
},
"Microsoft.ServiceHub.Analyzers": {
"type": "Transitive",
"resolved": "3.0.3078",
Expand Down
14 changes: 0 additions & 14 deletions source/Cosmos.VS.Windows/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
"version": 1,
"dependencies": {
".NETFramework,Version=v4.8": {
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3"
}
},
"Microsoft.VisualStudio.SDK": {
"type": "Direct",
"requested": "[17.0.31902.203, )",
Expand Down Expand Up @@ -179,11 +170,6 @@
"resolved": "1.1.3",
"contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
},
"Microsoft.NETFramework.ReferenceAssemblies.net48": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "zMk4D+9zyiEWByyQ7oPImPN/Jhpj166Ky0Nlla4eXlNL8hI/BtSJsgR8Inldd4NNpIAH3oh8yym0W2DrhXdSLQ=="
},
"Microsoft.ServiceHub.Analyzers": {
"type": "Transitive",
"resolved": "3.0.3078",
Expand Down