Loading...
Searching...
No Matches
Produce a bounded crop/resample view over a source BGRA image.
More...
#include <image_framing.h>
|
| struct | Sample |
| struct | Crop |
| | Source-space crop and uniform scale needed for an output frame. More...
|
| struct | View |
|
| View | apply (const unsigned char *bgra, int sourceWidth, int sourceHeight, int stride, int width, int height, int inset=0, double rotationDegrees=0, double rotationBoundDegrees=0) |
| | Frame BGRA pixels into a crop, resampled image, or rotated image.
|
|
| static Crop | crop (int sourceWidth, int sourceHeight, int width, int height, int inset=0, double rotationBoundDegrees=0) |
| | Fit an output aspect ratio inside source bounds and rotation margin.
|
|
| static Channels | splat (float value) |
| | Broadcast a scalar to all four portable BGRA lanes.
|
| static Channels | sum (Channels first, Channels second) |
| | Accumulate channel values without mixing color and alpha.
|
| static Channels | difference (Channels first, Channels second) |
| | Form independent channel deltas for interpolation.
|
| static Channels | product (Channels first, Channels second) |
| | Multiply each channel by its corresponding weight.
|
| static Channels | load (const float *values) |
| | Load four floating-point channel values in BGRA order.
|
| static void | store (float *target, Channels values) |
| | Store channels in the order expected by byte conversion.
|
| static Channels | channels (const unsigned char *pixel) |
| | Widen a packed BGRA pixel for floating-point interpolation.
|
| template<typename SamplePixel> |
| static void | writeRow (unsigned char *destination, int width, SamplePixel &&sample) |
| | Write one sampled row to the byte raster.
|
| static void | samples (std::vector< Sample > &result, int count, int sourceSize, double offset, double scale) |
| | Precompute bilinear indices and fractions along one output axis.
|
Produce a bounded crop/resample view over a source BGRA image.
The view may borrow the source pixels for an exact crop or point to this object's reusable output buffer after resampling/rotation. In the latter case, the bytes remain valid only until the next call to apply.
Definition at line 62 of file image_framing.h.
◆ Channels
◆ apply()
| View pangea_survey::ImageFraming::apply |
( |
const unsigned char * | bgra, |
|
|
int | sourceWidth, |
|
|
int | sourceHeight, |
|
|
int | stride, |
|
|
int | width, |
|
|
int | height, |
|
|
int | inset = 0, |
|
|
double | rotationDegrees = 0, |
|
|
double | rotationBoundDegrees = 0 ) |
|
inline |
Frame BGRA pixels into a crop, resampled image, or rotated image.
- Parameters
-
| [in] | bgra | Borrowed source pixel buffer. |
| [in] | sourceWidth | Source width in pixels. |
| [in] | sourceHeight | Source height in pixels. |
| [in] | stride | Source row stride in bytes. |
| [in] | width | Requested output width in pixels. |
| [in] | height | Requested output height in pixels. |
| [in] | inset | Excluded border in source pixels. |
| [in] | rotationDegrees | Applied rotation in the renderer's image coordinates. |
| [in] | rotationBoundDegrees | Maximum rotation used when selecting a safe crop. |
- Returns
- BGRA view and the source crop represented by its pixels.
- Exceptions
-
| std::runtime_error | If input bounds or the rotated footprint are invalid. |
- Note
- A returned pointer to internal storage is invalidated by the next call.
Definition at line 277 of file image_framing.h.
◆ channels()
| Channels pangea_survey::ImageFraming::channels |
( |
const unsigned char * | pixel | ) |
|
|
inlinestaticprivate |
Widen a packed BGRA pixel for floating-point interpolation.
- Parameters
-
| pixel | Four readable bytes in BGRA order. |
- Returns
- The same channel values without byte-range arithmetic.
Definition at line 184 of file image_framing.h.
◆ crop()
| Crop pangea_survey::ImageFraming::crop |
( |
int | sourceWidth, |
|
|
int | sourceHeight, |
|
|
int | width, |
|
|
int | height, |
|
|
int | inset = 0, |
|
|
double | rotationBoundDegrees = 0 ) |
|
inlinestatic |
Fit an output aspect ratio inside source bounds and rotation margin.
- Parameters
-
| [in] | sourceWidth | Source image width in pixels. |
| [in] | sourceHeight | Source image height in pixels. |
| [in] | width | Requested output width in pixels. |
| [in] | height | Requested output height in pixels. |
| [in] | inset | Minimum source-edge margin in pixels. |
| [in] | rotationBoundDegrees | Maximum absolute rotation to accommodate. |
- Returns
- Centered crop rectangle and the common scale for both axes.
- Exceptions
-
| std::runtime_error | If dimensions, margin, or rotation are invalid. |
Definition at line 239 of file image_framing.h.
◆ difference()
Form independent channel deltas for interpolation.
- Parameters
-
| first | Reference values. |
| second | Values to subtract. |
- Returns
- Lane-wise difference.
Definition at line 158 of file image_framing.h.
◆ load()
| Channels pangea_survey::ImageFraming::load |
( |
const float * | values | ) |
|
|
inlinestaticprivate |
Load four floating-point channel values in BGRA order.
- Parameters
-
| values | Four readable floats. |
- Returns
- Loaded channels.
Definition at line 173 of file image_framing.h.
◆ product()
Multiply each channel by its corresponding weight.
- Parameters
-
| first | First lane vector. |
| second | Second lane vector. |
- Returns
- Lane-wise product.
Definition at line 166 of file image_framing.h.
◆ samples()
| void pangea_survey::ImageFraming::samples |
( |
std::vector< Sample > & | result, |
|
|
int | count, |
|
|
int | sourceSize, |
|
|
double | offset, |
|
|
double | scale ) |
|
inlinestaticprivate |
Precompute bilinear indices and fractions along one output axis.
- Parameters
-
| [out] | result | One entry per output sample. |
| count | Output samples on the axis. |
| sourceSize | Positive source extent in pixels. |
| offset | Crop offset in source pixels. |
| scale | Source pixels per output sample. |
Map pixel centers and clamp before computing neighbors. Reusing these entries avoids repeated coordinate arithmetic in each row.
Definition at line 212 of file image_framing.h.
◆ splat()
| Channels pangea_survey::ImageFraming::splat |
( |
float | value | ) |
|
|
inlinestaticprivate |
Broadcast a scalar to all four portable BGRA lanes.
- Parameters
-
| value | Weight to broadcast. |
- Returns
- Four identical lanes.
Definition at line 145 of file image_framing.h.
◆ store()
| void pangea_survey::ImageFraming::store |
( |
float * | target, |
|
|
Channels | values ) |
|
inlinestaticprivate |
Store channels in the order expected by byte conversion.
- Parameters
-
| [out] | target | Four writable floats. |
| values | Channel values in BGRA order. |
Definition at line 177 of file image_framing.h.
◆ sum()
Accumulate channel values without mixing color and alpha.
- Parameters
-
| first | Left operand. |
| second | Right operand. |
- Returns
- Lane-wise sum.
Definition at line 150 of file image_framing.h.
◆ writeRow()
template<typename SamplePixel>
| void pangea_survey::ImageFraming::writeRow |
( |
unsigned char * | destination, |
|
|
int | width, |
|
|
SamplePixel && | sample ) |
|
inlinestaticprivate |
Write one sampled row to the byte raster.
- Template Parameters
-
| SamplePixel | Callable yielding four lanes for an output column. |
- Parameters
-
| [out] | destination | Row storage of at least four bytes per pixel. |
| width | Output column count. |
| sample | Interpolating sampler. |
Round and clamp at the byte boundary, not during interpolation.
Definition at line 195 of file image_framing.h.
◆ buffer_
| std::vector<unsigned char> pangea_survey::ImageFraming::buffer_ |
|
private |
◆ columns_
| std::vector<Sample> pangea_survey::ImageFraming::columns_ |
|
private |
◆ height_
| int pangea_survey::ImageFraming::height_ = 0 |
|
private |
◆ horizontal_
| std::vector<float> pangea_survey::ImageFraming::horizontal_[2] |
|
private |
◆ inset_
| int pangea_survey::ImageFraming::inset_ = 0 |
|
private |
◆ rotationBound_
| double pangea_survey::ImageFraming::rotationBound_ = 0 |
|
private |
◆ rows_
| std::vector<Sample> pangea_survey::ImageFraming::rows_ |
|
private |
◆ sourceHeight_
| int pangea_survey::ImageFraming::sourceHeight_ = 0 |
|
private |
◆ sourceWidth_
| int pangea_survey::ImageFraming::sourceWidth_ = 0 |
|
private |
◆ width_
| int pangea_survey::ImageFraming::width_ = 0 |
|
private |
The documentation for this class was generated from the following file: