#include <stdio.h>#include <stdlib.h>#include <math.h>#include "agg_rendering_buffer.h"#include "agg_rasterizer_scanline_aa.h"#include "agg_ellipse.h"#include "agg_trans_affine.h"#include "agg_conv_transform.h"#include "agg_pixfmt_rgb.h"#include "agg_span_allocator.h"#include "agg_span_image_filter_rgb.h"#include "agg_scanline_u.h"#include "agg_renderer_scanline.h"#include "agg_span_interpolator_linear.h"#include "agg_span_interpolator_adaptor.h"#include "agg_span_gradient.h"#include "agg_image_accessors.h"#include "ctrl/agg_slider_ctrl.h"#include "ctrl/agg_rbox_ctrl.h"#include "platform/agg_platform_support.h"Go to the source code of this file.
Classes | |
| class | periodic_distortion |
| class | distortion_wave |
| class | distortion_swirl |
| class | distortion_swirl_wave |
| class | distortion_wave_swirl |
| class | the_application |
Enumerations | |
| enum | flip_y_e { flip_y = true } |
Functions | |
| void | calculate_wave (int *x, int *y, double cx, double cy, double period, double amplitude, double phase) |
| void | calculate_swirl (int *x, int *y, double cx, double cy, double amplitude, double phase) |
| int | agg_main (int argc, char *argv[]) |
Variables | |
| static agg::int8u | g_gradient_colors [] |
|
|
Definition at line 23 of file distortions.cpp. 00023 { flip_y = true };
|
|
||||||||||||
|
Definition at line 675 of file distortions.cpp. References platform_support::caption(), flip_y, platform_support::img_ext(), platform_support::init(), platform_support::load_img(), platform_support::message(), agg::pix_format_bgr24, platform_support::rbuf_img(), platform_support::run(), platform_support::wait_mode(), and agg::window_resize. 00676 { 00677 the_application app(agg::pix_format_bgr24, flip_y); 00678 app.caption("Image and Gradient Distortions"); 00679 00680 const char* img_name = "spheres"; 00681 if(argc >= 2) img_name = argv[1]; 00682 if(!app.load_img(0, img_name)) 00683 { 00684 char buf[256]; 00685 if(strcmp(img_name, "spheres") == 0) 00686 { 00687 sprintf(buf, "File not found: %s%s. Download http://www.antigrain.com/%s%s\n" 00688 "or copy it from another directory if available.", 00689 img_name, app.img_ext(), img_name, app.img_ext()); 00690 } 00691 else 00692 { 00693 sprintf(buf, "File not found: %s%s", img_name, app.img_ext()); 00694 } 00695 app.message(buf); 00696 return 1; 00697 } 00698 00699 if(app.init(app.rbuf_img(0).width() + 300, app.rbuf_img(0).height() + 40 + 20, agg::window_resize)) 00700 { 00701 app.wait_mode(false); 00702 return app.run(); 00703 } 00704 return 0; 00705 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 333 of file distortions.cpp. References agg::image_subpixel_scale. Referenced by distortion_wave_swirl::calculate(), distortion_swirl_wave::calculate(), and distortion_swirl::calculate(). 00336 { 00337 double xd = double(*x) / agg::image_subpixel_scale - cx; 00338 double yd = double(*y) / agg::image_subpixel_scale - cy; 00339 double a = double(100.0 - sqrt(xd * xd + yd * yd)) / 100.0 * (0.1 / -amplitude); 00340 double sa = sin(a - phase/25.0); 00341 double ca = cos(a - phase/25.0); 00342 *x = int((xd * ca - yd * sa + cx) * agg::image_subpixel_scale); 00343 *y = int((xd * sa + yd * ca + cy) * agg::image_subpixel_scale); 00344 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 316 of file distortions.cpp. References agg::image_subpixel_scale. Referenced by distortion_wave_swirl::calculate(), distortion_swirl_wave::calculate(), and distortion_wave::calculate(). 00319 { 00320 double xd = double(*x) / agg::image_subpixel_scale - cx; 00321 double yd = double(*y) / agg::image_subpixel_scale - cy; 00322 double d = sqrt(xd*xd + yd*yd); 00323 if(d > 1) 00324 { 00325 double a = cos(d / (16.0 * period) - phase) * (1.0 / (amplitude * d)) + 1.0; 00326 *x = int((xd * a + cx) * agg::image_subpixel_scale); 00327 *y = int((yd * a + cy) * agg::image_subpixel_scale); 00328 } 00329 }
|
|
|
Definition at line 26 of file distortions.cpp. Referenced by the_application::the_application(). |