summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal K S V S <kkushal32@gmail.com>2017-07-14 18:01:06 +0530
committerKushal K S V S <kkushal32@gmail.com>2017-07-14 18:01:06 +0530
commit9da27cf41c9a10297e47629aa7ac021596e805ec (patch)
tree2aa84869674e65bd7df58c232180c5257540ddb0
parentdfd68a27ee79540ea1b20033ef4dba07e3bc0fa0 (diff)
downloadfreetype2-9da27cf41c9a10297e47629aa7ac021596e805ec.tar.gz
Adding functions to Remove and Adjust the Height and Width differences between glyphs
-rw-r--r--tests/make_png/bitmap.c86
1 files changed, 84 insertions, 2 deletions
diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c
index 76218f8ed..f3d26c246 100644
--- a/tests/make_png/bitmap.c
+++ b/tests/make_png/bitmap.c
@@ -330,8 +330,90 @@ void Read_PNG(char *filename, IMAGE * after_effect) {
fclose(fp);
}
+IMAGE* Adjust_Height(IMAGE* small, IMAGE* big){
+
+ int h_delta;
+ IMAGE* result = (IMAGE*)malloc(sizeof(IMAGE));
+
+ result->height = big->height;
+ result->width = small->width;
+ result->pixels = (PIXEL*)malloc(result->width * result->height * sizeof(PIXEL));
+
+ h_delta = big->height - small->height;
+
+ for (int y = 0; y < h_delta; ++y)
+ {
+ for (int x = 0; x < result->width; ++x)
+ {
+ PIXEL * pixel_result = Pixel_At ( result, x, y);
+
+ pixel_result->red = 255;
+ pixel_result->green = 255;
+ pixel_result->blue = 255;
+ pixel_result->alpha = 255;
+ }
+ }
+
+ for (int y = h_delta; y < result->height; ++y)
+ {
+ for (int x = 0; x < result->width; ++x)
+ {
+ PIXEL * pixel_small = Pixel_At ( small, x, y - h_delta);
+ PIXEL * pixel_result = Pixel_At ( result, x, y);
+
+ pixel_result->red = pixel_small->red;
+ pixel_result->green = pixel_small->green;
+ pixel_result->blue = pixel_small->blue;
+ pixel_result->alpha = pixel_small->alpha;
+ }
+ }
+ return result;
+}
+
+IMAGE* Adjust_Width(IMAGE* small, IMAGE* big){
+
+ int w_delta;
+ IMAGE* result = (IMAGE*)malloc(sizeof(IMAGE));
+
+ result->height = small->height;
+ result->width = big->width;
+ result->pixels = (PIXEL*)malloc(result->width * result->height * sizeof(PIXEL));
+
+ w_delta = big->width - small->width;
+
+ for (int x = small->width; x < big->width; ++x)
+ {
+ for (int y = 0; y < result->height; ++y)
+ {
+ PIXEL * pixel_result = Pixel_At ( result, x, y);
+
+ pixel_result->red = 255;
+ pixel_result->green = 255;
+ pixel_result->blue = 255;
+ pixel_result->alpha = 255;
+ }
+ }
+
+ for (int y = 0; y < result->height; ++y)
+ {
+ for (int x = 0; x < small->width; ++x)
+ {
+ PIXEL * pixel_small = Pixel_At ( small, x, y);
+ PIXEL * pixel_result = Pixel_At ( result, x, y);
+
+ pixel_result->red = pixel_small->red;
+ pixel_result->green = pixel_small->green;
+ pixel_result->blue = pixel_small->blue;
+ pixel_result->alpha = pixel_small->alpha;
+ }
+ }
+ return result;
+}
+
void Add_effect(IMAGE* base, IMAGE* test, IMAGE* out, int Effect_ID)
{
+ out->width = base->width;
+ out->height = base->height;
out->pixels = (PIXEL*)malloc(base->width * base->height * sizeof(PIXEL));
for(int y = 0; y < base->height; y++) {
@@ -385,9 +467,9 @@ void Add_effect(IMAGE* base, IMAGE* test, IMAGE* out, int Effect_ID)
void Stitch(IMAGE* left, IMAGE* right, IMAGE* result){
result->width = left->width + right->width;
- result->height = left->height; // Horizontal clipping
+ result->height = MAX(left->height, right->height); // Horizontal clipping
- result->pixels = (PIXEL*)malloc(result->width * result->height * sizeof(PIXEL));
+ result->pixels = (PIXEL*)calloc(result->width * result->height, sizeof(PIXEL));
for (int y = 0; y < left->height; ++y)
{