Bonjour
Je cherche à copier une partie d'un array dans un autre array. Ces deux arrays représentent une image (background) et une petite portion de cette image.
Pour aller vite, je cherche à utiliser memcpy, mais le compilateur ne veut pas.
Voici le code (sur ESP32) :
Déclarations :
uint16_t bg[MAX_N][X_SIZE * Y_SIZE];
uint16_t fullBg[TFT_WIDTH * TFT_HEIGHT];
Copie :
// Transfer background portion
int i0 = x[n] + y[n] * tft.width();
int i1 = i0 + Y_SIZE * tft.width();
int j = 0;
for (int i = i0; i < i1; i = i + tft.width(), j = j + X_SIZE)
memcpy(bg[n][j], fullBg[i], X_SIZE * 2);
- L'image complète (fullBg) est de taille tft.width() * tft.height().
- La portion à copier est de taille X_SIZE * Y_SIZE et commence au pixel de coordonnées x[n] et y[n].
- Le tout est dans une boucle for (int n = ...)
Message de compilation :
invalid conversion from 'uint16_t {aka short unsigned int}' to 'void*' [-fpermissive]
Je comprends qu'il y a un problème au niveau du type de fullBg, puisque le prototype de memcpy est :
void * memcpy ( void * destination, const void * source, size_t num );
Mais comment faire alors ?