c++ cli - 256 grayscale Array for an Histogram VS C++ 2008 -


i'm trying make simple "count" array in visual studio c++ 2008. objective make histogram (without displaying it) of 256 bit grayscale image.

#pragma once using namespace system::collections::generic; using namespace system::windows::forms; using namespace system::drawing; using namespace system;  ref class histograma { public:      histograma(void);     histograma(system::io::filestream^ archivo, list<panel^>^ paneles);     array^ ejecutar();  private:     array ^resultado;     bitmap^ imagen; }; 

and implementation here

#include "stdafx.h" #include "histograma.h"  histograma::histograma(void) {     resultado = array::createinstance(int::typeid,256); }  histograma::histograma(system::io::filestream^ archivo, list<panel^> ^paneles) {     histograma();     imagen = gcnew bitmap(archivo); }  array^ histograma::ejecutar() {     system::byte valor;     for(int x=0; x < imagen->width ; x++)     {         for(int y=0; y < imagen->height ; y++)         {             valor = imagen->getpixel(x,y).toargb();             resultado[valor]++;         }     }     return resultado; } 

i'm getting c2039 error: 'default' not memeber of 'system::array'

any ideas? has realy simple i'm doing bad, have no idea of be.

thanks in advance

change declaration to:

array<int> ^resultado; 

and in constructor:

resultado = gcnew array<int>(256); 

edit:

you can keep original system::array declaration , instead use tedious syntax:

resultado->setvalue((int)(resultado->getvalue(valor)) + 1, valor); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -