[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] GSoC-2017-kushal 43002bb 24/70: Adding functions to Remove a
From: |
Kushal K S V S |
Subject: |
[freetype2] GSoC-2017-kushal 43002bb 24/70: Adding functions to Remove and Adjust the Height and Width differences between glyphs |
Date: |
Sun, 18 Mar 2018 11:21:11 -0400 (EDT) |
branch: GSoC-2017-kushal
commit 43002bb592609ac9b923f1dcf481e72b7e5bc98a
Author: Kushal K S V S <address@hidden>
Commit: Kushal K S V S <address@hidden>
Adding functions to Remove and Adjust the Height and Width differences
between glyphs
---
tests/make_png/bitmap.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 84 insertions(+), 2 deletions(-)
diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c
index 76218f8..f3d26c2 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)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] GSoC-2017-kushal 43002bb 24/70: Adding functions to Remove and Adjust the Height and Width differences between glyphs,
Kushal K S V S <=