summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal K S V S <kkushal32@gmail.com>2017-06-29 03:44:14 +0530
committerKushal K S V S <kkushal32@gmail.com>2017-06-29 03:44:14 +0530
commitc1f8256354df6951f78dc3f2bcf6805f78775565 (patch)
tree32a447ca76c5ff6763bd5feff69f393c62db0513
parentf5ff8af50c9659ce061d7e2faa29d3f1b7115b1d (diff)
downloadfreetype2-c1f8256354df6951f78dc3f2bcf6805f78775565.tar.gz
fixed mono renering
-rw-r--r--new/bitmap.c27
-rw-r--r--new/make_png.c2
2 files changed, 26 insertions, 3 deletions
diff --git a/new/bitmap.c b/new/bitmap.c
index 54b9c13f4..fdb41a720 100644
--- a/new/bitmap.c
+++ b/new/bitmap.c
@@ -133,8 +133,7 @@ void Make_PNG(FT_Bitmap* bitmap,char* name,int i,int render_mode){
switch(render_mode){
- case 0 :
- case 1 : fruit.width = bitmap->width; // MONO and GRAY
+ case 0 : fruit.width = bitmap->width; // MONO and GRAY
fruit.height = bitmap->rows;
fruit.pixels = calloc (fruit.width * fruit.height, sizeof (PIXEL));
@@ -146,6 +145,30 @@ void Make_PNG(FT_Bitmap* bitmap,char* name,int i,int render_mode){
p = (y * bitmap->pitch ) + x;
value = bitmap->buffer[p];
+
+ if ( value != 0x00 ){
+ value = 0xff;
+ }else{
+ value = 0x00;
+ }
+
+ pixel->red = 255- value;
+ pixel->green = 255- value;
+ pixel->blue = 255- value;
+ pixel->alpha = 255;
+ }
+ }
+ break;
+ case 1 : fruit.width = bitmap->width; // MONO and GRAY
+ fruit.height = bitmap->rows;
+
+ fruit.pixels = calloc (fruit.width * fruit.height, sizeof (PIXEL));
+
+ for (y = 0; y < fruit.height; y++) {
+ for (x = 0; x < fruit.width; x++) {
+
+ PIXEL * pixel = Pixel_At (& fruit, x, y);
+ p = (y * bitmap->pitch ) + x;
pixel->red = 255- value;
pixel->green = 255- value;
diff --git a/new/make_png.c b/new/make_png.c
index 099dbbcb3..ad579356a 100644
--- a/new/make_png.c
+++ b/new/make_png.c
@@ -126,7 +126,7 @@ int main (int argc, char const *argv[])
size,
render_type);
- for (i = 0; i <face->num_glyphs; ++i)
+ for (i = 0; i <50; ++i)
{
error = FT_Load_Glyph( face,
i,