documentation update

This commit is contained in:
Phuntsok Drak-pa 2018-11-27 15:49:24 +01:00
parent 1d014a20a7
commit fe41a56c66
No known key found for this signature in database
GPG Key ID: 9CB34B6827C66D22
3 changed files with 5 additions and 14 deletions

View File

@ -38,7 +38,7 @@ PROJECT_NAME = "Compression par surfaces unies"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 0.4 PROJECT_NUMBER = 1.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

View File

@ -57,18 +57,16 @@ void addPixelToSelectedZone(Image *t_img, int64_t t_idx, Zone *t_zone) {
} }
for (left_limit = t_idx; left_limit - (y - 1) * (int64_t)t_img->sizeX >= 0; for (left_limit = t_idx; left_limit - (y - 1) * (int64_t)t_img->sizeX >= 0;
--left_limit) { /* fetch right limit of segment */ --left_limit) {
current_pixel = darrayGet(t_img->pixels, (size_t)left_limit); current_pixel = darrayGet(t_img->pixels, (size_t)left_limit);
if (current_pixel->visited || !sameColor(current_pixel, t_zone)) { if (current_pixel->visited || !sameColor(current_pixel, t_zone)) {
break; break;
} }
(*current_pixel).visited = 1; (*current_pixel).visited = 1;
} }
/* Add segment to its zone */
darrayPushBack(t_zone->segments, darrayPushBack(t_zone->segments,
newSegment((uint32_t)right_limit, (uint32_t)left_limit)); newSegment((uint32_t)right_limit, (uint32_t)left_limit));
for (; left_limit <= right_limit; for (; left_limit <= right_limit; ++left_limit) {
++left_limit) { /* process every pixel up and down the segment */
addPixelToSelectedZone(t_img, t_idx + t_img->sizeX, t_zone); addPixelToSelectedZone(t_img, t_idx + t_img->sizeX, t_zone);
} }
} }
@ -86,25 +84,17 @@ void chooseZoneForPixel(Image *t_img, int64_t t_idx, darray *t_zones) {
Zone *current_zone; Zone *current_zone;
Pixel *pixel; Pixel *pixel;
size_t i; size_t i;
pixel = darrayGet(t_img->pixels, (size_t)t_idx); pixel = darrayGet(t_img->pixels, (size_t)t_idx);
/* if the pixel has already been visited, no need to continue */
if (pixel->visited) { if (pixel->visited) {
return; return;
} }
/* for each known zone, see if it matches the current pixel's color */
for (i = 0; i < darraySize(t_zones); ++i) { for (i = 0; i < darraySize(t_zones); ++i) {
current_zone = darrayGet(t_zones, i); current_zone = darrayGet(t_zones, i);
/* if it does, add selected pixel and its neighbouring pixels of the same
* color */
if (sameColor(pixel, current_zone)) { if (sameColor(pixel, current_zone)) {
addPixelToSelectedZone(t_img, t_idx, current_zone); addPixelToSelectedZone(t_img, t_idx, current_zone);
return; return;
} }
} }
/* if none of the same color was found, create a new one, add it to the image
* and add the selected pixel and its neighbours of the same color to the zone
*/
current_zone = newZone(pixel->red, pixel->green, pixel->blue); current_zone = newZone(pixel->red, pixel->green, pixel->blue);
darrayPushBack(t_zones, current_zone); darrayPushBack(t_zones, current_zone);
addPixelToSelectedZone(t_img, t_idx, current_zone); addPixelToSelectedZone(t_img, t_idx, current_zone);

View File

@ -200,11 +200,12 @@ int imageLoadPPM(const char *t_filename, Image *t_img) {
} }
/** /**
() * Ouvre le fichier image avec son nom de fichier passé par le paramètre * Ouvre le fichier image avec son nom de fichier passé par le paramètre
* `filename` et y écrit les informations trouvées dans lobjet `img`. * `filename` et y écrit les informations trouvées dans lobjet `img`.
* *
* \param[in] t_filename Nom du fichier image à ouvrir * \param[in] t_filename Nom du fichier image à ouvrir
* \param[in] t_img Objet \ref Image à écrire * \param[in] t_img Objet \ref Image à écrire
* \param[in] t_data Données décompressées de limage au format natif ppm
*/ */
void imageSavePPM(const char *t_filename, Image *t_img, uint8_t *t_data) { void imageSavePPM(const char *t_filename, Image *t_img, uint8_t *t_data) {
FILE *fp; FILE *fp;