[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] GSoC-2017-kushal c84c32d 09/70: fixed mono rendering
From: |
Kushal K S V S |
Subject: |
[freetype2] GSoC-2017-kushal c84c32d 09/70: fixed mono rendering |
Date: |
Sun, 18 Mar 2018 11:21:09 -0400 (EDT) |
branch: GSoC-2017-kushal
commit c84c32d576332fcfd1393a4baf9578701ed8628a
Author: Kushal K S V S <address@hidden>
Commit: Kushal K S V S <address@hidden>
fixed mono rendering
---
tests/make_png/bitmap.c | 27 +++++++++++++++++++++++++--
tests/make_png/make_png.c | 2 +-
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c
index 54b9c13..fdb41a7 100644
--- a/tests/make_png/bitmap.c
+++ b/tests/make_png/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/tests/make_png/make_png.c b/tests/make_png/make_png.c
index 099dbbc..ad57935 100644
--- a/tests/make_png/make_png.c
+++ b/tests/make_png/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,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] GSoC-2017-kushal c84c32d 09/70: fixed mono rendering,
Kushal K S V S <=