#445 closed defect (fixed)
psImageCut's new prototype and use of psPixels
| Reported by: | Owned by: | Paul Price | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
the prototype for psImageCut has changed in two ways:
- two psVectors, cutCols and cutRows, was replaced by a single psVector*
coords. This however is a problem, a single psVector can't possibly hold both x
and y coordinates sans some odd encoding. I'd use psPixels, but that is defined
with only integer coordinate values. What do you want to do here?
- four parameters giving the start and end coordinates of the cut were replaced
by a single psRegion. Though this is feasible, this is not the typical
definition of psRegion, i.e., an image region. Should there be a struct that
just represents a point (x,y)? psPixelCoord is very close to what we really
need, though again, it is limited by the x & y being integer.
Is there a grand reason why psPixels/psPixelCoord couldn't store x & y in
floating-point so it could be used more widely, e.g., here?
-rdd
Change History (3)
comment:1 by , 21 years ago
| Owner: | changed from to |
|---|
comment:2 by , 21 years ago
| Owner: | changed from to |
|---|
comment:3 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
OK, I give in.
typedef struct {
float x; x coordinate
float y; y coordinate
} psPixelCoord;
psVector *psImageSlice(psVector *out,
psPixels *coords,
const psImage *input,
const psImage *mask,
psMaskType maskVal,
psRegion region,
psImageCutDirection direction,
const psStats *stats);
If you see other places where a float-ised psPixels can be used, please put it
in a new bug.

re:
1) this is clearly a mistake in over-zealously unifying the form of the
psImageSlice and psImageCut APIs. I've replaced the cutCols and cutRows vectors
in the API.
2) i replaced the start/end with the region to emphasize the similarity with
psImageSlice (in which case it is really extracting that region, the collapsing
it along one dimension). But, as you say, these are slightly different concepts
(line segment vs square region). we could use two psPlane values for input.
3) deferred to Paul P.