Skip to content

Commit

Permalink
swap parameter order in region _transformed() APIs so that output par…
Browse files Browse the repository at this point in the history
…ameters are at the end
  • Loading branch information
farindk committed Oct 15, 2023
1 parent f0b30d8 commit 588b096
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
15 changes: 7 additions & 8 deletions libheif/heif_regions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ struct heif_error heif_region_get_point(const struct heif_region* region, int32_
}


struct heif_error heif_region_get_point_transformed(const struct heif_region* region, double* x, double* y,
heif_item_id image_id)
struct heif_error heif_region_get_point_transformed(const struct heif_region* region, heif_item_id image_id, double* x, double* y)
{
if (!x || !y) {
return heif_error_invalid_parameter_value;
Expand Down Expand Up @@ -435,9 +434,9 @@ struct heif_error heif_region_get_rectangle(const struct heif_region* region,


struct heif_error heif_region_get_rectangle_transformed(const struct heif_region* region,
heif_item_id image_id,
double* x, double* y,
double* width, double* height,
heif_item_id image_id)
double* width, double* height)
{
const std::shared_ptr<RegionGeometry_Rectangle> rect = std::dynamic_pointer_cast<RegionGeometry_Rectangle>(region->region);
if (rect) {
Expand Down Expand Up @@ -477,9 +476,9 @@ struct heif_error heif_region_get_ellipse(const struct heif_region* region,


struct heif_error heif_region_get_ellipse_transformed(const struct heif_region* region,
heif_item_id image_id,
double* x, double* y,
double* radius_x, double* radius_y,
heif_item_id image_id)
double* radius_x, double* radius_y)
{
const std::shared_ptr<RegionGeometry_Ellipse> ellipse = std::dynamic_pointer_cast<RegionGeometry_Ellipse>(region->region);
if (ellipse) {
Expand Down Expand Up @@ -578,12 +577,12 @@ static struct heif_error heif_region_get_poly_points_scaled(const struct heif_re
}


struct heif_error heif_region_get_polygon_points_transformed(const struct heif_region* region, double* pts, heif_item_id image_id)
struct heif_error heif_region_get_polygon_points_transformed(const struct heif_region* region, heif_item_id image_id, double* pts)
{
return heif_region_get_poly_points_scaled(region, pts, image_id);
}

struct heif_error heif_region_get_polyline_points_transformed(const struct heif_region* region, double* pts, heif_item_id image_id)
struct heif_error heif_region_get_polyline_points_transformed(const struct heif_region* region, heif_item_id image_id, double* pts)
{
return heif_region_get_poly_points_scaled(region, pts, image_id);
}
Expand Down
29 changes: 14 additions & 15 deletions libheif/heif_regions.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,15 @@ struct heif_error heif_region_get_point(const struct heif_region* region, int32_
* This returns the coordinates in pixels after all transformative properties have been applied.
*
* @param region the region to query, which must be of type #heif_region_type_point.
* @param image_id the identifier for the image to transform / scale the region to
* @param out_x the X coordinate, where 0 is the left-most column.
* @param out_y the Y coordinate, where 0 is the top-most row.
* @param image_id the identifier for the image to transform / scale the region to
* @return heif_error_ok on success, or an error value indicating the problem on failure
*
* \sa heif_region_get_point() for a version that returns the values in the reference coordinate space.
*/
LIBHEIF_API
struct heif_error heif_region_get_point_transformed(const struct heif_region* region, double* out_x, double* out_y,
heif_item_id image_id);
struct heif_error heif_region_get_point_transformed(const struct heif_region* region, heif_item_id image_id, double* out_x, double* out_y);

/**
* Get the values for a rectangle region.
Expand Down Expand Up @@ -339,20 +338,20 @@ struct heif_error heif_region_get_rectangle(const struct heif_region* region,
* part of the region.
*
* @param region the region to query, which must be of type #heif_region_type_rectangle.
* @param image_id the identifier for the image to transform / scale the region to
* @param out_x the X coordinate for the top left corner, where 0 is the left-most column.
* @param out_y the Y coordinate for the top left corner, where 0 is the top-most row.
* @param out_width the width of the rectangle
* @param out_height the height of the rectangle
* @param image_id the identifier for the image to transform / scale the region to
* @return heif_error_ok on success, or an error value indicating the problem on failure
*
* \sa heif_region_get_rectangle() for a version that returns the values in the reference coordinate space.
*/
LIBHEIF_API
struct heif_error heif_region_get_rectangle_transformed(const struct heif_region* region,
heif_item_id image_id,
double* out_x, double* out_y,
double* out_width, double* out_height,
heif_item_id image_id);
double* out_width, double* out_height);

/**
* Get the values for an ellipse region.
Expand Down Expand Up @@ -386,20 +385,20 @@ struct heif_error heif_region_get_ellipse(const struct heif_region* region,
* part of the region.
*
* @param region the region to query, which must be of type #heif_region_type_ellipse.
* @param image_id the identifier for the image to transform / scale the region to
* @param out_x the X coordinate for the centre point, where 0 is the left-most column.
* @param out_y the Y coordinate for the centre point, where 0 is the top-most row.
* @param out_radius_x the radius value in the X direction.
* @param out_radius_y the radius value in the Y direction
* @param image_id the identifier for the image to transform / scale the region to
* @return heif_error_ok on success, or an error value indicating the problem on failure
*
* \sa heif_region_get_ellipse() for a version that returns the values in the reference coordinate space.
*/
LIBHEIF_API
struct heif_error heif_region_get_ellipse_transformed(const struct heif_region* region,
heif_item_id image_id,
double* out_x, double* out_y,
double* out_radius_x, double* out_radius_y,
heif_item_id image_id);
double* out_radius_x, double* out_radius_y);

/**
* Get the number of points in a polygon.
Expand Down Expand Up @@ -444,17 +443,17 @@ struct heif_error heif_region_get_polygon_points(const struct heif_region* regio
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
*
* @param region the region to equery, which must be of type #heif_region_type_polygon
* @param image_id the identifier for the image to transform / scale the region to
* @param out_pts_array the array to return the points in, which must have twice as many entries as there are points
* in the polygon.
* @param image_id the identifier for the image to transform / scale the region to
* @return heif_error_ok on success, or an error value indicating the problem on failure
*
* \sa heif_region_get_polygon_points() for a version that returns the values in the reference coordinate space.
*/
LIBHEIF_API
struct heif_error heif_region_get_polygon_points_transformed(const struct heif_region* region,
double* out_pts_array,
heif_item_id image_id);
heif_item_id image_id,
double* out_pts_array);
/**
* Get the number of points in a polyline.
*
Expand Down Expand Up @@ -508,17 +507,17 @@ struct heif_error heif_region_get_polyline_points(const struct heif_region* regi
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
*
* @param region the region to equery, which must be of type #heif_region_type_polyline
* @param image_id the identifier for the image to transform / scale the region to
* @param out_pts_array the array to return the points in, which must have twice as many entries as there are points
* in the polyline.
* @param image_id the identifier for the image to transform / scale the region to
* @return heif_error_ok on success, or an error value indicating the problem on failure
*
* \sa heif_region_get_polyline_points() for a version that returns the values in the reference coordinate space.
*/
LIBHEIF_API
struct heif_error heif_region_get_polyline_points_transformed(const struct heif_region* region,
double* out_pts_array,
heif_item_id image_id);
heif_item_id image_id,
double* out_pts_array);

/**
* Get a referenced item mask region.
Expand Down

0 comments on commit 588b096

Please sign in to comment.