freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] GSoC-2017-kushal 94edac8 26/52: Apply effects and stitch 4 s


From: Kushal K S V S
Subject: [freetype2] GSoC-2017-kushal 94edac8 26/52: Apply effects and stitch 4 sub-images together
Date: Fri, 25 Aug 2017 15:09:38 -0400 (EDT)

branch: GSoC-2017-kushal
commit 94edac86687820f99f1bf0a1e5d8bb67040cb381
Author: Kushal K S V S <address@hidden>
Commit: Kushal K S V S <address@hidden>

    Apply effects and stitch 4 sub-images together
---
 tests/make_png/make_sprite.c | 63 ++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 29 deletions(-)

diff --git a/tests/make_png/make_sprite.c b/tests/make_png/make_sprite.c
index c603d5a..b2304d3 100644
--- a/tests/make_png/make_sprite.c
+++ b/tests/make_png/make_sprite.c
@@ -51,13 +51,13 @@ int main(int argc, char const *argv[])
   int alignment = 4;
   char * output_file_name = ( char * )calloc(20,sizeof(char));
 
-  IMAGE base_png;
-  IMAGE test_png;
-  IMAGE after_effect_1;
-  IMAGE after_effect_2;
-  IMAGE combi_effect_1;
-  IMAGE combi_effect_2;
-  IMAGE output;
+  IMAGE* base_png        = (IMAGE*)malloc(sizeof(IMAGE));
+  IMAGE* test_png        = (IMAGE*)malloc(sizeof(IMAGE));
+  IMAGE* after_effect_1  = (IMAGE*)malloc(sizeof(IMAGE));
+  IMAGE* after_effect_2  = (IMAGE*)malloc(sizeof(IMAGE));
+  IMAGE* combi_effect_1  = (IMAGE*)malloc(sizeof(IMAGE));
+  IMAGE* combi_effect_2  = (IMAGE*)malloc(sizeof(IMAGE));
+  IMAGE* output          = (IMAGE*)malloc(sizeof(IMAGE));
 
   HASH_128 *  base_murmur = (HASH_128 *) malloc(sizeof(HASH_128)) ;
   HASH_128 *  test_murmur = (HASH_128 *) malloc(sizeof(HASH_128)) ;  
@@ -384,38 +384,43 @@ int main(int argc, char const *argv[])
     //   exit(1);
     // }
     
-    sprintf( output_file_name, "./images/sprite_%d", i );
+    sprintf( output_file_name, "./images/sprite_%d.png", i );
 
-    if (Is_Different != 0)
+    if ( Is_Different != 0 )
     {
-      if (render_mode == 0)
+      if ( render_mode == 0 )
       {
-        Make_PNG( &base_target, &base_png, i, render_mode );
-        Make_PNG( &test_target, &test_png, i, render_mode );
-  // Will be used
-        // Add_effect( &base_png, &test_png, &after_effect_1, 1);
-        // Add_effect( &base_png, &test_png, &after_effect_2, 2);
+        // Monochrome rendering to be added 
+      }else{
 
-        Stitch( &base_png, &test_png, &combi_effect_1);
-        // Stitch( &after_effect_1, &after_effect_2, &combi_effect_2);
+        Make_PNG( base_bitmap, base_png, i, render_mode );
+        Make_PNG( test_bitmap, test_png, i, render_mode );
 
-        // Stitch( &combi_effect_1, &combi_effect_2, &output);
+        if ( base_png->height < test_png->height)
+        {
+          base_png = Adjust_Height(base_png, test_png );
+        }else if ( base_png->height > test_png->height )
+        {
+          test_png = Adjust_Height(test_png, base_png );
+        }
 
-        Generate_PNG ( &combi_effect_1, output_file_name, render_mode );
-      }else{
+        if ( base_png->width < test_png->width )
+        {
+          base_png = Adjust_Width(base_png, test_png );
+        }else if ( base_png->width > test_png->width )
+        {
+          test_png = Adjust_Width(test_png, base_png );
+        }
 
-        Make_PNG( base_bitmap, &base_png, i, render_mode );
-        Make_PNG( test_bitmap, &test_png, i, render_mode );
-  // Will be used
-        // Add_effect( &base_png, &test_png, &after_effect_1, 1);
-        // Add_effect( &base_png, &test_png, &after_effect_2, 2);
+        Add_effect( base_png, test_png, after_effect_1, 1 );
+        Add_effect( base_png, test_png, after_effect_2, 2 );
 
-        Stitch( &base_png, &test_png, &combi_effect_1);
-        // Stitch( &after_effect_1, &after_effect_2, &combi_effect_2);
+        Stitch( base_png, test_png, combi_effect_1);
+        Stitch( after_effect_1, after_effect_2, combi_effect_2 );
 
-        // Stitch( &combi_effect_1, &combi_effect_2, &output);
+        Stitch( combi_effect_1, combi_effect_2, output );
 
-        Generate_PNG ( &combi_effect_1, output_file_name, render_mode );
+        Generate_PNG ( output, output_file_name, render_mode );
       } 
     }
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]