Document directory
- Image accessors
- Image Filter)
Image accessors
Some people may have tried to modify the span_image_filter_rgb_bilinear_clip in the sample code when reading the line segment generator section (for example, change it to span_image_filter_rgb_bilinear ). However, an error occurs during compilation because the source template accepted by most of the Line Segment generator classes is not pixelformat Renderer, but image accessor, which is the image accesser.
Header file
- # Include <agg_image_accessors.h>
Type
- Template <class pixfmt>
- Class fill: image_accessor_clip // fill the image with the specified color
- Template <class pixfmt>
- Class tip: image_accessor_clone // fill the image with edges outside of the image
- Template <class pixfmt>
- Class metadata: image_accessor_no_clip // The image is not readable. Otherwise, an exception is thrown.
- Template <class pixfmt, class wrapx, class wrapy>
- Class scheme: image_accessor_wrap // tiled image, which is specified by wrapx and wrapy.
Lab code
Change the span_image_filter_rgb_bilinear_clip section in the sample code to the following code:
- ...
- // Line segment Generator
- // Typedef Syntax: span_image_filter_rgb_bilinear_clip <plaintext: pixfmt_bgr24,
- // Interpolator_type> span_gen_type; // This is the span generator.
- // Span_gen_type span_gen (pixf_img, kernel: rgba (0, 0), ip );
- // Image accessors
- Typedef authorization: image_accessor_clone <authorization: pixfmt_bgr24> image_accessor_type;
- Image_accessor_type accessor (pixf_img );
- // Use span_image_filter_rgb_bilinear
- Typedef Syntax: span_image_filter_rgb_bilinear <
- Image_accessor_type,
- Interpolator_type> span_gen_type;
- Span_gen_type span_gen (accessor, ip );
- ...
We recommend that you change the following RAS. add_path (ELL) to Ras. add_path (ccell)
Display Effect
The image_accessor_wrap class must specify wrapx and wrapy. The options include:
wrap_mode_reflect wrap_mode_reflect_auto_pow2 wrap_mode_pow2 wrap_mode_repeat wrap_mode_repeat_auto_pow2 wrap_mode_repeat_pow2
For example, change the definition of image_accessor_type in this example
- // Typedef failed: image_accessor_clone <failed: pixfmt_bgr24> image_accessor_type;
- Typedef Syntax: image_accessor_wrap <Syntax: pixfmt_bgr24,
- Response: wrap_mode_reflect, response: wrap_mode_repeat> image_accessor_type;
Display Effect:
(In order to highlight the effect, the source is reduced using the matrix img_ctx)
Image Filter)
In some line segment generators, such as span_image_filter _ [gray | RGB | rgba], span_image_resample _ [gray | RGB | rgba, their constructor also has the "const image_filter_lut & filter" parameter, which is used to transform the pixel value of the image. Their names are prefixed with image_filter, which is called image filter in filters ).
Header file
- # Include <agg_image_filters.h>
Type
- Image_filter_bilinear;
- Image_filter_blackman;
- Image_filter_blackman [36 | 64 | 100 | 144 | 196 | 256];
- Image_filter_kaiser;
- Image_filter_lanczos;
- Image_filter_lanczos [36 | 64 | 100 | 144 | 196 | 256];
- Image_filter_mitchell;
- ... A lot more...
Lab code
Change span_image_filter_rgb_bilinear to span_image_resample_rgb_affine.
- ...
- // Typedef failed: image_accessor_clone <failed: pixfmt_bgr24> image_accessor_type;
- Typedef Syntax: image_accessor_wrap <Syntax: pixfmt_bgr24,
- Response: wrap_mode_reflect, response: wrap_mode_repeat> image_accessor_type;
- Image_accessor_type accessor (pixf_img );
- // Typedef Syntax: span_image_filter_rgb_bilinear <
- // Image_accessor_type,
- // Interpolator_type> span_gen_type;
- // Span_gen_type span_gen (accessor, ip );
- Typedef authorization: span_image_resample_rgb_affine <image_accessor_type> span_gen_type;
- Span_gen_type span_gen (accessor, IP, separator: image_filter_sinc36 ());
- ...
Display Effect
Www.cppprog.com