rgb_net - RGB.NET.Corsair 0.0.1
Corsair-Metapackage of RGB.NET
PM> Install-Package RGB.NET.Corsair -Version 0.0.1 -Source https://www.myget.org/F/rgb_net/api/v3/index.json
> nuget.exe install RGB.NET.Corsair -Version 0.0.1 -Source https://www.myget.org/F/rgb_net/api/v3/index.json
> dotnet add package RGB.NET.Corsair --version 0.0.1 --source https://www.myget.org/F/rgb_net/api/v3/index.json
source https://www.myget.org/F/rgb_net/api/v3/index.json
nuget RGB.NET.Corsair ~> 0.0.1
Copy to clipboard
> choco install RGB.NET.Corsair --version 0.0.1 --source https://www.myget.org/F/rgb_net/api/v2
Import-Module PowerShellGet
Register-PSRepository -Name "rgb_net" -SourceLocation "https://www.myget.org/F/rgb_net/api/v2"
Install-Module -Name "RGB.NET.Corsair" -RequiredVersion "0.0.1" -Repository "rgb_net"
Copy to clipboard
RGB.NET
IMPORTANT NOTE
This is a library to integrate RGB-devices into your own application. It does not contain any executables!
If you're looking for a full blown software solution to manage your RGB-devices, take a look at Artemis.
Getting Started
Setup
- Add the RGB.NET.Core and Devices-Nugets for all devices you want to use.
- For some of the vendors SDK-libraries are needed. Check the contained Readmes for more information in that case.
- Create a new
RGBSurface.
RGBSurface surface = new RGBSurface();
- Initialize the providers for all devices you want to use and add the devices to the surface. For example:
CorsairDeviceProvider.Instance.Initialize(throwExceptions: true);
surface.Attach(CorsairDeviceProvider.Instance.Devices);
The Initialize-method allows to load only devices of specific types by setting a filter and for debugging purposes allows to enable exception throwing. (By default they are catched and provided through the Exception-event.)
You can also use the Load-Extension on the surface.
surface.Load(CorsairDeviceProvider.Instance);
While most device-providers are implemented in a way that supports fast loading like this some may have a different loading procedures. (For example the
WS281XDeviceProviderrequires device-definitions before loading.)
- Add an update-trigger. In most cases the TimerUpdateTrigger is preferable, but you can also implement your own to fit your needs.
surface.RegisterUpdateTrigger(new TimerUpdateTrigger());
If you want to trigger updates manually the
ManualUpdateTriggershould be used.
- This step is optional but recommended. For rendering the location of each LED on the surface can be important. Since not all SDKs provide useful layout-information you might want to add Layouts to your devices. (TODO: add wiki article for this) Same goes for the location of the device on the surface. If you don't care about the exact location of the devices you can use:
surface.AlignDevices();
The basic setup is now complete and you can start setting up your rendering.
Basic Rendering
As an example we'll add a moving rainbow over all devices on the surface.
- Create a led-group containing all leds on the surface (all devices)
ILedGroup allLeds = new ListLedGroup(surface, surface.Leds);
- Create a rainbow-gradient.
RainbowGradient rainbow = new RainbowGradient();
- Add a decorator to the gradient to make it move. (Decorators are
rainbow.AddDecorator(new MoveGradientDecorator(surface));
- Create a texture (the size - in this example 10, 10 - is not important here since the gradient shoukd be stretched anyway)
ITexture texture = new ConicalGradientTexture(new Size(10, 10), rainbow);
- Add a brush rendering the texture to the led-group
allLeds.Brush = new TextureBrush(texture);
Full example
RGBSurface surface = new RGBSurface();
surface.Load(CorsairDeviceProvider.Instance);
surface.AlignDevices();
surface.RegisterUpdateTrigger(new TimerUpdateTrigger());
ILedGroup allLeds = new ListLedGroup(surface, surface.Leds);
RainbowGradient rainbow = new RainbowGradient();
rainbow.AddDecorator(new MoveGradientDecorator(surface));
ITexture texture = new ConicalGradientTexture(new Size(10, 10), rainbow);
allLeds.Brush = new TextureBrush(texture);
OwnersDarth Affe |
AuthorsDarth Affe |
Project URLhttps://github.com/DarthAffe/RGB.NET |
LicenseLGPL-2.1 |
Info189 total downloads |
| 189 downloads for version 0.0.1 |
| Download (44.63 KB) |
| Found on the current feed only |
Package history
| Version | Size | Last updated | Downloads | Mirrored? | |||
|---|---|---|---|---|---|---|---|
|
|
0.0.1 | 44.63 KB | Mon, 02 Apr 2018 08:21:58 GMT | 189 |
|