#include <stdio.h>
#include <stdlib.h>
#include <rfb/rfb.h>
#include "scale.h"
Functions | |
int | scale_vectors (int orig, int scaled, int **line, int **l_off, int **r_off) |
int scale_vectors | ( | int | orig, | |
int | scaled, | |||
int ** | line, | |||
int ** | l_off, | |||
int ** | r_off | |||
) |
Calculates scaling vectors that can be used for 'nearest neighbour' image sampling.
When magnifying, pixels from the source image are replicated, when minifying (scaling down), pixels from the source image are dropped.
Example: scale factor = 2.0 source 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 ... line 00 00 01 01 02 02 03 03 04 04 05 05 06 06 07 07 08 08 09 09 10 10 ... l_off 00 02 04 06 08 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 ... r_off 01 03 05 07 09 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 ...
orig | original size | |
scaled | scaled size | |
line | scale vector (return value) | |
l_off | scale vector offsets, left to right (return value, optional) | |
r_off | scale vector offsets, right to left (return value, optional) |