Skip to content

Commit

Permalink
COMMON: Added sail_scan_line()
Browse files Browse the repository at this point in the history
  • Loading branch information
HappySeaFox committed Nov 9, 2023
1 parent 0edc7e2 commit 3b5cdc8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sail-common/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,12 @@ sail_status_t sail_mirror_horizontally(struct sail_image *image) {

return SAIL_OK;
}

void* sail_scan_line(const struct sail_image *image, unsigned row) {

if (SAIL_UNLIKELY(image == NULL || image->pixels == NULL)) {
return NULL;
}

return (uint8_t *)image->pixels + image->bytes_per_line * row;
}
6 changes: 6 additions & 0 deletions src/sail-common/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ SAIL_EXPORT sail_status_t sail_mirror_vertically(struct sail_image *image);
*/
SAIL_EXPORT sail_status_t sail_mirror_horizontally(struct sail_image *image);

/*
* Returns the scan line at the given row.
* Return NULL if the image or its pixels is NULL.
*/
SAIL_EXPORT void* sail_scan_line(const struct sail_image *image, unsigned row);

/* extern "C" */
#ifdef __cplusplus
}
Expand Down

0 comments on commit 3b5cdc8

Please sign in to comment.