Blender V4.3
transform.cc File Reference
#include <type_traits>
#include "BLI_math_color_blend.h"
#include "BLI_math_interp.hh"
#include "BLI_math_matrix.hh"
#include "BLI_math_vector.h"
#include "BLI_rect.h"
#include "BLI_task.hh"
#include "IMB_imbuf.hh"
#include "IMB_interp.hh"

Go to the source code of this file.

Classes

struct  blender::imbuf::transform::TransformContext
 

Namespaces

namespace  blender
 
namespace  blender::imbuf
 
namespace  blender::imbuf::transform
 

Functions

static bool blender::imbuf::transform::should_discard (const TransformContext &ctx, const float2 &uv)
 
template<typename T >
static Tblender::imbuf::transform::init_pixel_pointer (const ImBuf *image, int x, int y)
 
template<>
ucharblender::imbuf::transform::init_pixel_pointer (const ImBuf *image, int x, int y)
 
template<>
floatblender::imbuf::transform::init_pixel_pointer (const ImBuf *image, int x, int y)
 
static float blender::imbuf::transform::wrap_uv (float value, int size)
 
template<eIMBInterpolationFilterMode Filter, typename T , int NumChannels, bool WrapUV>
static void blender::imbuf::transform::sample_image (const ImBuf *source, float u, float v, T *r_sample)
 
static void blender::imbuf::transform::add_subsample (const float src[4], float dst[4])
 
static void blender::imbuf::transform::add_subsample (const uchar src[4], float dst[4])
 
static void blender::imbuf::transform::store_premul_float_sample (const float sample[4], float dst[4])
 
static void blender::imbuf::transform::store_premul_float_sample (const float sample[4], uchar dst[4])
 
template<int SrcChannels>
static void blender::imbuf::transform::store_sample (const uchar *sample, uchar *dst)
 
template<int SrcChannels>
static void blender::imbuf::transform::store_sample (const float *sample, float *dst)
 
template<eIMBInterpolationFilterMode Filter, typename T , int SrcChannels, bool CropSource, bool WrapUV>
static void blender::imbuf::transform::process_scanlines (const TransformContext &ctx, IndexRange y_range)
 
template<eIMBInterpolationFilterMode Filter, typename T , int SrcChannels>
static void blender::imbuf::transform::transform_scanlines (const TransformContext &ctx, IndexRange y_range)
 
template<eIMBInterpolationFilterMode Filter>
static void blender::imbuf::transform::transform_scanlines_filter (const TransformContext &ctx, IndexRange y_range)
 
static float blender::imbuf::transform::calc_coverage (float2 pos, int2 ipos, float2 delta, bool is_steep)
 
static void blender::imbuf::transform::edge_aa (const TransformContext &ctx)
 
void IMB_transform (const ImBuf *src, ImBuf *dst, const eIMBTransformMode mode, const eIMBInterpolationFilterMode filter, const float transform_matrix[4][4], const rctf *src_crop)
 Transform source image buffer onto destination image buffer using a transform matrix.
 

Function Documentation

◆ IMB_transform()

void IMB_transform ( const ImBuf * src,
ImBuf * dst,
eIMBTransformMode mode,
eIMBInterpolationFilterMode filter,
const float transform_matrix[4][4],
const rctf * src_crop )

Transform source image buffer onto destination image buffer using a transform matrix.

Parameters
srcImage buffer to read from.
dstImage buffer to write to. rect or rect_float must already be initialized.
  • dst buffer must be a 4 channel buffers.
  • Only one data type buffer will be used (rect_float has priority over rect)
modeCropping/Wrap repeat effect to apply during transformation.
filterInterpolation to use during sampling.
transform_matrixTransformation matrix to use. The given matrix should transform between dst pixel space to src pixel space. One unit is one pixel.
src_cropCropping region how to crop the source buffer. Should only be passed when mode is set to IMB_TRANSFORM_MODE_CROP_SRC. For any other mode this should be empty.

During transformation no data/color conversion will happens. When transforming between float images the number of channels of the source buffer may be between 1 and 4. When source buffer has one channel the data will be read as a gray scale value.

Definition at line 466 of file imbuf/intern/transform.cc.

References BLI_assert_msg, ImBuf::channels, blender::imbuf::transform::TransformContext::dst, blender::imbuf::transform::TransformContext::dst_region_y_range, IMB_FILTER_BILINEAR, IMB_FILTER_BOX, IMB_FILTER_CUBIC_BSPLINE, IMB_FILTER_CUBIC_MITCHELL, IMB_TRANSFORM_MODE_CROP_SRC, blender::imbuf::transform::TransformContext::init(), blender::imbuf::transform::TransformContext::mode, blender::threading::parallel_for(), blender::imbuf::transform::TransformContext::src, blender::imbuf::transform::TransformContext::src_crop, and blender::imbuf::transform::transform_scanlines_filter().

Referenced by imb_scale_via_transform(), sequencer_preprocess_transform_crop(), blender::imbuf::tests::TEST(), blender::imbuf::tests::transform_2x_smaller(), and blender::imbuf::tests::transform_fractional_larger().