Leptonica  1.54
Файл src/roplow.c
#include <string.h>
#include "allheaders.h"

Макросы

#define COMBINE_PARTIAL(d, s, m)   ( ((d) & ~(m)) | ((s) & (m)) )

Функции

static void rasteropUniWordAlignedLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op)
static void rasteropUniGeneralLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op)
static void rasteropWordAlignedLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 swpl, l_int32 sx, l_int32 sy)
static void rasteropVAlignedLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 swpl, l_int32 sx, l_int32 sy)
static void rasteropGeneralLow (l_uint32 *datad, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 swpl, l_int32 sx, l_int32 sy)
void rasteropUniLow (l_uint32 *datad, l_int32 dpixw, l_int32 dpixh, l_int32 depth, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op)
void rasteropLow (l_uint32 *datad, l_int32 dpixw, l_int32 dpixh, l_int32 depth, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 spixw, l_int32 spixh, l_int32 swpl, l_int32 sx, l_int32 sy)

Переменные

static const l_int32 SHIFT_LEFT = 0
static const l_int32 SHIFT_RIGHT = 1
static const l_uint32 lmask32 []
static const l_uint32 rmask32 []

Макросы

#define COMBINE_PARTIAL (   d,
  s,
 
)    ( ((d) & ~(m)) | ((s) & (m)) )

Функции

static void rasteropGeneralLow ( l_uint32 datad,
l_int32  dwpl,
l_int32  dx,
l_int32  dy,
l_int32  dw,
l_int32  dh,
l_int32  op,
l_uint32 datas,
l_int32  swpl,
l_int32  sx,
l_int32  sy 
) [static]

rasteropGeneralLow()

Input: datad (ptr to dest image data) dwpl (wpl of dest) dx (x val of UL corner of dest rectangle) dy (y val of UL corner of dest rectangle) dw (width of dest rectangle) dh (height of dest rectangle) op (op code) datas (ptr to src image data) swpl (wpl of src) sx (x val of UL corner of src rectangle) sy (y val of UL corner of src rectangle) Return: void

This is called when the src and dest rects are do not have the same (32-bit) word alignment.

The method is a generalization of rasteropVAlignLow(). There, the src image pieces were directly merged with the dest. Here, we shift the source bits to fill words that are aligned with the dest, and then use those "source words" exactly in place of the source words that were used in rasteropVAlignLow().

The critical parameter is thus the shift required for the src. Consider the left edge of the rectangle. The overhang into the src and dest words are found, and the difference is exactly this shift. There are two separate cases, depending on whether the src pixels are shifted left or right. If the src overhang is larger than the dest overhang, the src is shifted to the right, a number of pixels equal to the shift are left over for filling the next dest word, if necessary. But if the dest overhang is larger than the src, the src is shifted to the left, and it may also be necessary to shift an equal number of pixels in from the next src word. However, in both cases, after the first partial (or complete) dest word has been filled, the next src pixels will come from a left shift that exhausts the pixels in the src word.

void rasteropLow ( l_uint32 datad,
l_int32  dpixw,
l_int32  dpixh,
l_int32  depth,
l_int32  dwpl,
l_int32  dx,
l_int32  dy,
l_int32  dw,
l_int32  dh,
l_int32  op,
l_uint32 datas,
l_int32  spixw,
l_int32  spixh,
l_int32  swpl,
l_int32  sx,
l_int32  sy 
)

rasteropLow()

Input: datad (ptr to dest image data) dpixw (width of dest) dpixh (height of dest) depth (depth of src and dest) dwpl (wpl of dest) dx (x val of UL corner of dest rectangle) dy (y val of UL corner of dest rectangle) dw (width of dest rectangle) dh (height of dest rectangle) op (op code) datas (ptr to src image data) spixw (width of src) spixh (height of src) swpl (wpl of src) sx (x val of UL corner of src rectangle) sy (y val of UL corner of src rectangle) Return: void

Action: Scales width, performs clipping, checks alignment, and dispatches for the rasterop.

Warning: the two images must have equal depth. This is not checked.

static void rasteropUniGeneralLow ( l_uint32 datad,
l_int32  dwpl,
l_int32  dx,
l_int32  dy,
l_int32  dw,
l_int32  dh,
l_int32  op 
) [static]

rasteropUniGeneralLow()

Input: datad (ptr to dest image data) dwpl (wpl of dest) dx (x val of UL corner of dest rectangle) dy (y val of UL corner of dest rectangle) dw (width of dest rectangle) dh (height of dest rectangle) op (op code) Return: void

void rasteropUniLow ( l_uint32 datad,
l_int32  dpixw,
l_int32  dpixh,
l_int32  depth,
l_int32  dwpl,
l_int32  dx,
l_int32  dy,
l_int32  dw,
l_int32  dh,
l_int32  op 
)

rasteropUniLow()

Input: datad (ptr to dest image data) dpixw (width of dest) dpixh (height of dest) depth (depth of src and dest) dwpl (wpl of dest) dx (x val of UL corner of dest rectangle) dy (y val of UL corner of dest rectangle) dw (width of dest rectangle) dh (height of dest rectangle) op (op code) Return: void

Action: scales width, performs clipping, checks alignment, and dispatches for the rasterop.

static void rasteropUniWordAlignedLow ( l_uint32 datad,
l_int32  dwpl,
l_int32  dx,
l_int32  dy,
l_int32  dw,
l_int32  dh,
l_int32  op 
) [static]

rasteropUniWordAlignedLow()

Input: datad (ptr to dest image data) dwpl (wpl of dest) dx (x val of UL corner of dest rectangle) dy (y val of UL corner of dest rectangle) dw (width of dest rectangle) dh (height of dest rectangle) op (op code) Return: void

This is called when the dest rect is left aligned on (32-bit) word boundaries. That is: dx & 31 == 0.

We make an optimized implementation of this because it is a common case: e.g., operating on a full dest image.

static void rasteropVAlignedLow ( l_uint32 datad,
l_int32  dwpl,
l_int32  dx,
l_int32  dy,
l_int32  dw,
l_int32  dh,
l_int32  op,
l_uint32 datas,
l_int32  swpl,
l_int32  sx,
l_int32  sy 
) [static]

rasteropVAlignedLow()

Input: datad (ptr to dest image data) dwpl (wpl of dest) dx (x val of UL corner of dest rectangle) dy (y val of UL corner of dest rectangle) dw (width of dest rectangle) dh (height of dest rectangle) op (op code) datas (ptr to src image data) swpl (wpl of src) sx (x val of UL corner of src rectangle) sy (y val of UL corner of src rectangle) Return: void

This is called when the left side of the src and dest rects have the same alignment relative to (32-bit) word boundaries; i.e., (dx & 31) == (sx & 31)

static void rasteropWordAlignedLow ( l_uint32 datad,
l_int32  dwpl,
l_int32  dx,
l_int32  dy,
l_int32  dw,
l_int32  dh,
l_int32  op,
l_uint32 datas,
l_int32  swpl,
l_int32  sx,
l_int32  sy 
) [static]

rasteropWordAlignedLow()

Input: datad (ptr to dest image data) dwpl (wpl of dest) dx (x val of UL corner of dest rectangle) dy (y val of UL corner of dest rectangle) dw (width of dest rectangle) dh (height of dest rectangle) op (op code) datas (ptr to src image data) swpl (wpl of src) sx (x val of UL corner of src rectangle) sy (y val of UL corner of src rectangle) Return: void

This is called when both the src and dest rects are left aligned on (32-bit) word boundaries. That is: dx & 31 == 0 and sx & 31 == 0

We make an optimized implementation of this because it is a common case: e.g., two images are rasterop'd starting from their UL corners (0,0).


Переменные

const l_uint32 lmask32[] [static]
Инициализатор
 {0x0,
    0x80000000, 0xc0000000, 0xe0000000, 0xf0000000,
    0xf8000000, 0xfc000000, 0xfe000000, 0xff000000,
    0xff800000, 0xffc00000, 0xffe00000, 0xfff00000,
    0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000,
    0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000,
    0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00,
    0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
    0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff}
const l_uint32 rmask32[] [static]
Инициализатор
 {0x0,
    0x00000001, 0x00000003, 0x00000007, 0x0000000f,
    0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
    0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
    0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
    0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
    0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
    0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
    0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff}
const l_int32 SHIFT_LEFT = 0 [static]
const l_int32 SHIFT_RIGHT = 1 [static]