Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

gamma_ctrl.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include "agg_rendering_buffer.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_scanline_p.h"
#include "agg_renderer_scanline.h"
#include "agg_gsv_text.h"
#include "agg_conv_stroke.h"
#include "agg_path_storage.h"
#include "ctrl/agg_gamma_ctrl.h"
#include "platform/agg_platform_support.h"
#include "pixel_formats.h"

Go to the source code of this file.

Classes

class  the_application

Defines

#define AGG_BGR24

Enumerations

enum  flip_y_e { flip_y = true }

Functions

void read_gamma (const char *fname)
void write_gamma_bin (const char *fname)
void write_gamma_txt (const char *fname)
int agg_main (int argc, char *argv[])

Variables

agg::gamma_ctrl< agg::rgba8g_ctrl (10.0, 10.0, 300.0, 200.0,!flip_y)


Define Documentation

#define AGG_BGR24
 

Definition at line 13 of file gamma_ctrl.cpp.


Enumeration Type Documentation

enum flip_y_e
 

Enumerator:
flip_y 

Definition at line 23 of file gamma_ctrl.cpp.

00023 { flip_y = true };


Function Documentation

int agg_main int  argc,
char *  argv[]
 

Definition at line 237 of file gamma_ctrl.cpp.

References platform_support::caption(), flip_y, platform_support::init(), pix_format, platform_support::run(), and agg::window_resize.

00238 {
00239     the_application app(pix_format, flip_y);
00240     app.caption("Anti-Aliasing Gamma Correction");
00241 
00242     if(app.init(500, 400, agg::window_resize))
00243     {
00244         return app.run();
00245     }
00246     return 1;
00247 }

void read_gamma const char *  fname  ) 
 

Definition at line 28 of file gamma_ctrl.cpp.

References g_ctrl, and gamma_ctrl_impl::values().

Referenced by the_application::on_init().

00029 {
00030     FILE* fd = fopen(fname, "rb");
00031     if(fd)
00032     {
00033         char buf[32];
00034         double kx1, ky1, kx2, ky2;
00035         fgets(buf, 30, fd); kx1 = atof(buf);
00036         fgets(buf, 30, fd); ky1 = atof(buf);
00037         fgets(buf, 30, fd); kx2 = atof(buf);
00038         fgets(buf, 30, fd); ky2 = atof(buf);
00039         g_ctrl.values(kx1, ky1, kx2, ky2);
00040         fclose(fd);
00041     }
00042 }

void write_gamma_bin const char *  fname  ) 
 

Definition at line 46 of file gamma_ctrl.cpp.

References g_ctrl, and gamma_ctrl_impl::gamma().

Referenced by the_application::~the_application().

00047 {
00048     const unsigned char* gamma = g_ctrl.gamma();
00049     FILE* fd = fopen(fname, "wb");
00050     if(fd)
00051     {
00052         fwrite(gamma, 256, 1, fd);
00053         fclose(fd);
00054     }
00055 }

void write_gamma_txt const char *  fname  ) 
 

Definition at line 58 of file gamma_ctrl.cpp.

References g_ctrl, gamma_ctrl_impl::gamma(), and gamma_ctrl_impl::values().

Referenced by the_application::~the_application().

00059 {
00060     const unsigned char* gamma = g_ctrl.gamma();
00061     FILE* fd = fopen(fname, "w");
00062     if(fd)
00063     {
00064         double kx1, ky1, kx2, ky2;
00065         g_ctrl.values(&kx1, &ky1, &kx2, &ky2);
00066         fprintf(fd, "%5.3f\n", kx1);
00067         fprintf(fd, "%5.3f\n", ky1);
00068         fprintf(fd, "%5.3f\n", kx2);
00069         fprintf(fd, "%5.3f\n", ky2);
00070         for(int i = 0; i < 16; i++)
00071         {
00072             for(int j = 0; j < 16; j++)
00073             {
00074                 fprintf(fd, "%3d,", gamma[i*16 + j]);
00075             }
00076             fprintf(fd, "\n");
00077         }
00078         fclose(fd);
00079     }
00080 }


Variable Documentation

agg::gamma_ctrl<agg::rgba8> g_ctrl(10.0, 10.0, 300.0, 200.0,!flip_y)
 

Referenced by the_application::on_draw(), read_gamma(), the_application::the_application(), write_gamma_bin(), and write_gamma_txt().


© sourcejam.com 2005-2008