Rop.Winforms10.Helpers
1.0.1
dotnet add package Rop.Winforms10.Helpers --version 1.0.1
NuGet\Install-Package Rop.Winforms10.Helpers -Version 1.0.1
<PackageReference Include="Rop.Winforms10.Helpers" Version="1.0.1" />
<PackageVersion Include="Rop.Winforms10.Helpers" Version="1.0.1" />
<PackageReference Include="Rop.Winforms10.Helpers" />
paket add Rop.Winforms10.Helpers --version 1.0.1
#r "nuget: Rop.Winforms10.Helpers, 1.0.1"
#:package Rop.Winforms10.Helpers@1.0.1
#addin nuget:?package=Rop.Winforms10.Helpers&version=1.0.1
#tool nuget:?package=Rop.Winforms10.Helpers&version=1.0.1
Rop.Winforms10.Helpers
Helper classes for WinForms on .NET 10. Provides utilities for bitmap processing, drawing extensions, geometry helpers, color manipulation, and font metrics.
Installation
dotnet add package Rop.Winforms10.Helpers
Features
Bitmaps (Rop.Winforms10.Bitmaps)
Low-level bitmap and color manipulation with explicit memory layout control.
- ImageHelper — Convert between
byte[]andImage/Bitmapwith optional format conversion. - Bitmap8 — 8-bit indexed bitmap wrapper with palette support and flood-fill.
- Pixels8 / Pixels32 — Typed pixel buffers (
byteandColor32) with Span access per scanline. - Color24 / Color32 — Explicit-layout (
StructLayout.Explicit) color structs with implicit conversion to/fromSystem.Drawing.Color, bitwise operators (|,&,^,!), scaling (*,<<,>>), and bit-mask creation. - OctTree — Octree-based color quantization for reducing palettes.
using Rop.Winforms10.Bitmaps;
// Convert bytes to image
Image img = ImageHelper.ImageFromBytes(byteArray);
Bitmap bmp = ImageHelper.BitmapFromBytes(byteArray);
// 8-bit indexed with flood fill
var bmp8 = new Bitmap8(myBitmap);
bmp8.Flood(new Point(10, 10), 3);
// Color32 bitwise operations
Color32 c = Color.Red;
Color32 inverted = !c;
Color32 halfBright = c * 0.5f;
Drawing (Rop.Winforms10.Drawing)
Extensions for Graphics, color manipulation, and geometric helpers.
Graphics Extensions (HelperDrawing):
- Load fonts from in-memory byte arrays.
- Measure and draw text aligned to baseline.
- Draw text with
ContentAlignmentwithin a rectangle. - Convert between
GraphicsUnitvalues.
using Rop.Winforms10.Drawing;
// Load font from embedded resource
pfc.AddMemoryFont(File.ReadAllBytes("MyFont.ttf"));
// Draw text aligned to baseline
g.DrawOnBaseline("Hello", font, Brushes.Black, new PointF(10, 30));
// Draw aligned text
g.DrawAligmentString("Centered", font, brush, rect, ContentAlignment.MiddleCenter, sf);
Colors (Rop.Winforms10.Drawing.Colors):
- ColorHelper — Extension methods on
Color: OkLCh adjustments (lightness, chroma, hue), ARGB delta, transparent/empty checks. - ColorOkLch — OkLCh color space representation with delta operations and alpha support.
- ColorF — Floating-point color (1.0f = 255) with component scaling.
- ColorNames — Named color lookup utilities.
using Rop.Winforms10.Drawing.Colors;
Color lighter = myColor.AddL(0.1f); // increase lightness in OkLCh
Color vivid = myColor.AddC(0.05f); // increase chroma
Color shifted = myColor.AddH(15); // shift hue by 15 degrees
Geometry (Rop.Winforms10.Drawing.Geom):
- HelperGeom — Extension methods for
PointF,SizeF,RectangleF: distance, diagonal, center calculation, arithmetic operations, zip (interpolation), midpoint wrapping, tuple deconstruction. - HelperGeom.Integer / HelperGeom.Float — Point and size arithmetic for
intandfloattypes. - HelperRectangle — Rectangle helpers: fit to bounds, find intersection, proportional resize.
- HelperUnits — Conversion between
GraphicsUnitvalues (pixels ↔ points ↔ millimeters ↔ inches). - BorderHelper — Draw borders with specified corner styles (square, round).
- RoundedRectangle — Rounded rectangle geometry calculation.
- RectangleD — Double-precision rectangle struct.
- RectangleCorners — Corner radius specification per corner.
- GraphicsPathEx —
GraphicsPathextensions.
using Rop.Winforms10.Drawing.Geom;
float dist = PointF.Distance(p1, p2);
SizeF diff = PointF.Diff(p1, p2);
PointF center = rect.Center();
float mm = 10f.MillimetersToPixels(g);
Fonts (Rop.Winforms10.Fonts)
Font metrics and text measurement with baseline/ascender awareness.
- FontHelper — Extension methods on
FontandGraphics: ascent in points/units/pixels, points-to-pixels conversion, text measurement with ascent. - FontSizeF — Size with an
Ascentfield for baseline-aware layout. - FontRectangleF — Rectangle with
Ascent,Descent, andBaseLineproperties. IncludesAscentBoundsandDescentBoundscomputed rectangles.
using Rop.Winforms10.Fonts;
int ascentPx = myFont.GetAscentPixels(graphics);
FontRectangleF rect = g.MeasureStringWithBaseLine(myFont, new PointF(10, 30), "Hello World");
// Access baseline-aware regions
RectangleF ascentArea = rect.AscentBounds;
RectangleF descentArea = rect.DescentBounds;
Requirements
- .NET 10 (
net10.0-windows) - Windows Forms (
UseWindowsForms=true)
License
GPL-3.0-or-later
Author
Ramon Ordiales Plaza
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Rop.Winforms10.Helpers:
| Package | Downloads |
|---|---|
|
Rop.Winforms10.DuotoneIcons
DuoTone Icon classes for Winforms |
|
|
Rop.Winforms10
Base forms, KeyValue-aware ComboBox/ListBox controls, and helpers for WinForms on .NET 10 |
GitHub repositories
This package is not used by any popular GitHub repositories.