Hello,
I've been very busy recently, I would like to back to my post:
I would like to send as a parrameter to my assembler function adress of first red data (each pixel of obraz image is split to RGB)
In order to achive this I have to convert uchar to int
void PROJ_ASM_SEPIA::odcien_szarosci_sl()
{
// int *wektor = new int[obraz.height()*obraz.width()*3];
uchar *poczatek;
poczatek = obraz.bits(); //getting adress of first pixel in image obraz (uchar)
const char *adres = reinterpret_cast<const char*>(poczatek); //convertion to const char
int j
= QString::fromLocal8Bit(adres
).
toInt();
//convertion char to int
for(int i = j; i <= obraz.height(); i++){ //adres of first pixel (j) as a starting point of the loop
int licznik = 0;
for(int k = 1; k <= obraz.width(); k++){ //every pixel is split to RGB data - red green blue - data is stored in wektor
QRgb tempColorRgb = obraz.pixel(k,i);
wektor[i * obraz.width() + k + licznik] = tempColor.red();
licznik++;
wektor[i * obraz.width() + k + licznik] = tempColor.green();
licznik++;
wektor[i * obraz.width() + k + licznik] = tempColor.blue();
if (k == obraz.width())
k = 1;
}
}
odcien_szar(wektor[0],obraz.width(),obraz.height()); //assembler function calling with adress of first data (red of first pixel)
}
void PROJ_ASM_SEPIA::odcien_szarosci_sl()
{
// int *wektor = new int[obraz.height()*obraz.width()*3];
uchar *poczatek;
poczatek = obraz.bits(); //getting adress of first pixel in image obraz (uchar)
const char *adres = reinterpret_cast<const char*>(poczatek); //convertion to const char
int j = QString::fromLocal8Bit(adres).toInt(); //convertion char to int
for(int i = j; i <= obraz.height(); i++){ //adres of first pixel (j) as a starting point of the loop
int licznik = 0;
for(int k = 1; k <= obraz.width(); k++){ //every pixel is split to RGB data - red green blue - data is stored in wektor
QRgb tempColorRgb = obraz.pixel(k,i);
QColor tempColor = QColor(tempColorRgb);
wektor[i * obraz.width() + k + licznik] = tempColor.red();
licznik++;
wektor[i * obraz.width() + k + licznik] = tempColor.green();
licznik++;
wektor[i * obraz.width() + k + licznik] = tempColor.blue();
if (k == obraz.width())
k = 1;
}
}
odcien_szar(wektor[0],obraz.width(),obraz.height()); //assembler function calling with adress of first data (red of first pixel)
}
To copy to clipboard, switch view to plain text mode
The point is that the assembler function (gray scale) get adress of first pixel to make some calculations over rest of pixels.
Bookmarks