Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8562

Output data type of Rgba32 using pManager.AddGenericParameter

$
0
0

@hyungjoo237 wrote:

Hi all,

I am trying to write my own component in C#. The output should be an array of Rgba32 ( SixLabors.ImageSharp.PixelFormats.Rgba32 ) type.
Since the type is not System.Drawing.Color pManager.AddColourParameter couldnt be used, so I am using pManager.AddGenericParameter instead. To test I created an array pointCloudColor and tried to output with both methods AddColourParameter and AddGenericParameter.

protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
   pManager.AddGenericParameter("Color of Pointcloud", "C", "Color of Pointcloud", GH_ParamAccess.list);}

protected override void SolveInstance(IGH_DataAccess DA)
{

      pointCloudColor = new List<System.Drawing.Color>();

      ...
      
     System.Drawing.Color color2 = System.Drawing.Color.FromArgb(r, g, b);
     pointCloudColor.Add(color2);


     DA.SetDataList(0, color2 );

}

and

protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
   pManager.AddGenericParameter("Color of Pointcloud", "C", "Color of Pointcloud", GH_ParamAccess.list);}

protected override void SolveInstance(IGH_DataAccess DA)
{

      pointCloudColor = new List<System.Drawing.Color>();

      ...
      
     System.Drawing.Color color2 = System.Drawing.Color.FromArgb(r, g, b);
     pointCloudColor.Add(color2);


     DA.SetDataList(0, color2 );

}

It seems like that with AddGenericParameter the component needs 5x more time for the output.

  • What could be the reason ?

  • What is the best way to output an array of Rgba32 ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8562

Trending Articles