LeadSoft.Common.GlobalDomain 10.1.1

dotnet add package LeadSoft.Common.GlobalDomain --version 10.1.1
                    
NuGet\Install-Package LeadSoft.Common.GlobalDomain -Version 10.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LeadSoft.Common.GlobalDomain" Version="10.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LeadSoft.Common.GlobalDomain" Version="10.1.1" />
                    
Directory.Packages.props
<PackageReference Include="LeadSoft.Common.GlobalDomain" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LeadSoft.Common.GlobalDomain --version 10.1.1
                    
#r "nuget: LeadSoft.Common.GlobalDomain, 10.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LeadSoft.Common.GlobalDomain@10.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LeadSoft.Common.GlobalDomain&version=10.1.1
                    
Install as a Cake Addin
#tool nuget:?package=LeadSoft.Common.GlobalDomain&version=10.1.1
                    
Install as a Cake Tool

LeadSoft® Global Domain

Developers Common Global Domain © LeadSoft® 2025

This package contains useful entities and classes for LeadSoft® or external applications that needs a huge amount of functions that makes easy developers day-by-day.

For any development and tool use question, contact developers@leadsoft.inf.br .

Nuget.Org: LeadSoft.Common.GlobalDomain
GitHub Repo: leadsoft-global-domain

Features

  • Controllers
    • LeadSoftErrorController
    • LeadSoftRootController
  • DTOs
  • Entities
  • Helpers
    • PagedRequestExtensions
    • ImageExtensions
  • PagedList.cs
  • PagedRequest.cs
  • PagingMetadata.cs

📦 Helpers

🖼️ ImageExtensions

Métodos de extensão para manipulação de imagens em Stream, usando SkiaSharp internamente — não depende de nenhuma API externa e roda tanto em Windows quanto em Linux (ex.: instâncias EC2/AWS).

📁 Namespace: LeadSoft.Common.GlobalDomain.Helpers

⚠️ Runtime em Linux: o pacote SkiaSharp sozinho só traz o binário nativo para Windows/macOS. Este projeto já referencia SkiaSharp.NativeAssets.Linux.NoDependencies, que resolve isso sem exigir libfontconfig (nada aqui usa texto/fontes). Isso já é transitivo para quem consome este NuGet — não precisa fazer nada a mais. Testado com sucesso em container Amazon Linux 2023 "limpo".

CreateThumbnail(this Stream, int aWidth = 256, int aHeight = 256)

🔹 Gera uma miniatura (thumbnail) a partir de um stream de imagem, respeitando a proporção original (não distorce) e ajustando a imagem dentro dos limites de largura/altura informados.

  • Retorno: novo Stream (PNG) já posicionado no início (Position = 0), pronto para leitura.
  • Boas práticas: o stream de entrada é lido, mas não é descartado (Dispose) pelo método — a responsabilidade de liberar o stream original continua sendo de quem o criou. Sempre envolva o resultado em using.
await using var thumbnail = originalStream.CreateThumbnail(128, 128);
Resize(this Stream, int aWidth = 1024, int aHeight = 1024)

🔹 Redimensiona a imagem mantendo a proporção original, ajustando-a (fit) dentro da largura/altura máximas informadas — usado internamente pelo CreateThumbnail, mas com valores padrão maiores.

  • Retorno: novo Stream (PNG) já posicionado no início (Position = 0).
  • ⚠️ Se a imagem original já for menor ou igual aos limites informados, ela não é ampliada — apenas mantida no tamanho original.
await using var resized = originalStream.Resize(800, 600);

💡 Todos os métodos aceitam aFormat (usando LeadSoft.Common.Library.Enumerators.Enums.FileExtension, padrão Png) e aQuality (padrão 100) para escolher o formato/qualidade de saída. Hoje Png, Jpg/Jpeg e Webp são suportados na codificação — usar outro valor lança NotSupportedException.

TrimTransparency(this Stream, int aBorderPx = 0, byte aAlphaTolerance = 0, ...)

✂️ Corta as margens transparentes ao redor do conteúdo visível da imagem, deixando opcionalmente uma borda transparente de aBorderPx pixels ao redor do resultado.

  • aAlphaTolerance: pixels com alpha ≤ esse valor são tratados como "transparentes" na detecção dos limites — útil para lidar com bordas de anti-aliasing que não são 100% transparentes.
  • ⚠️ Se a imagem inteira for transparente, o resultado degenera para 1x1 pixel (mais a borda, se houver).
await using var trimmed = originalStream.TrimTransparency(aBorderPx: 10, aAlphaTolerance: 5);
CenterOnCanvas(this Stream, int aCanvasWidth, int aCanvasHeight, ...)

🎯 Centraliza a imagem (sem redimensionar) sobre um canvas transparente do tamanho informado.

  • ⚠️ Se a imagem for maior que o canvas em algum eixo, o excedente é cortado igualmente dos dois lados.
await using var centered = originalStream.CenterOnCanvas(500, 500);
🧩 Combinações prontas

Os métodos acima podem ser encadeados livremente (stream.TrimTransparency(10).Resize(500, 500).CenterOnCanvas(500, 500), ou na ordem inversa), e a classe já traz duas combinações prontas para os casos mais comuns:

  • ResizeToSquare(this Stream, int aSize = 512, ...) — redimensiona (fit, sem distorcer) e centraliza em um canvas quadrado transparente de aSize x aSize.
  • TrimAndFit(this Stream, int aWidth, int aHeight, int aBorderPx = 0, byte aAlphaTolerance = 0, ...) — corta a transparência, redimensiona o conteúdo restante e centraliza no canvas final aWidth x aHeight.
await using var square = originalStream.ResizeToSquare(300);
await using var thumb = originalStream.TrimAndFit(200, 200, aBorderPx: 8);

Tech

Framework requirements to run:

  • Microsoft .NET 10.0
  • Open Source (MIT License).

Development

Development by LeadSoft® Soluções Web Team.

Nossa empresa

LeadSoft Soluções Web Ltda CNPJ 38.043.762/0001-48

Como nos encontrar:
INFORMAÇÕES DE CONTATO Se você tiver alguma dúvida sobre estes Termos ou Serviços, entre em contato conosco em

developers@leadsoft.inf.br.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on LeadSoft.Common.GlobalDomain:

Package Downloads
Dafitech.Inforlube.Authenticator

Authenticator for Inforlube Solutions This tool verifies the identity of applications and retrieve endpoint information and settings. For any development and tool use question, contact lucas.resende@inforlube.com .

LeadSoft.Common.DataAccess

LeadSoft® Common Data Access library. It's possible to connect to many databases.

Dafitech.Adapter.Grpc.Daas

Dafitech Grpc protofiles adapter.

LeadSoft.Adapter.RavenDBIdentity

LeadSoft® RavenDB Identity Classes.

LeadSoft.Adapter.Azure.EntraID

Pacote Open Source para integração com Azure EntraID via Dependency Injection.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.1.1 62 9/15/2026
10.1.0 57 9/15/2026
10.0.16 158 8/17/2026
10.0.15 168 7/28/2026
10.0.14 120 7/14/2026
10.0.12 108 7/14/2026
10.0.11 163 7/6/2026
10.0.10 155 6/17/2026
10.0.8 129 6/15/2026
10.0.7 471 3/19/2026
10.0.6 180 2/10/2026
10.0.5 153 1/27/2026
10.0.4 505 12/11/2025
10.0.3 271 12/4/2025
10.0.2 736 12/1/2025
10.0.1 640 12/1/2025
10.0.0 1,620 12/1/2025 10.0.0 is deprecated because it has critical bugs.
9.3.3 655 12/1/2025
9.3.2 287 10/7/2025
9.3.1 248 10/7/2025
Loading failed