Image accessor)

Source: Internet
Author: User
Tags image filter
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
  1. # Include <agg_image_accessors.h>
Type
  1. Template <class pixfmt>
  2. Class fill: image_accessor_clip // fill the image with the specified color
  3. Template <class pixfmt>
  4. Class tip: image_accessor_clone // fill the image with edges outside of the image
  5. Template <class pixfmt>
  6. Class metadata: image_accessor_no_clip // The image is not readable. Otherwise, an exception is thrown.
  7. Template <class pixfmt, class wrapx, class wrapy>
  8. 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:

  1. ...
  2. // Line segment Generator
  3. // Typedef Syntax: span_image_filter_rgb_bilinear_clip <plaintext: pixfmt_bgr24,
  4. // Interpolator_type> span_gen_type; // This is the span generator.
  5. // Span_gen_type span_gen (pixf_img, kernel: rgba (0, 0), ip );
  6. // Image accessors
  7. Typedef authorization: image_accessor_clone <authorization: pixfmt_bgr24> image_accessor_type;
  8. Image_accessor_type accessor (pixf_img );
  9. // Use span_image_filter_rgb_bilinear
  10. Typedef Syntax: span_image_filter_rgb_bilinear <
  11. Image_accessor_type,
  12. Interpolator_type> span_gen_type;
  13. Span_gen_type span_gen (accessor, ip );
  14. ...

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

  1. // Typedef failed: image_accessor_clone <failed: pixfmt_bgr24> image_accessor_type;
  2. Typedef Syntax: image_accessor_wrap <Syntax: pixfmt_bgr24,
  3. 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
  1. # Include <agg_image_filters.h>
Type
  1. Image_filter_bilinear;
  2. Image_filter_blackman;
  3. Image_filter_blackman [36 | 64 | 100 | 144 | 196 | 256];
  4. Image_filter_kaiser;
  5. Image_filter_lanczos;
  6. Image_filter_lanczos [36 | 64 | 100 | 144 | 196 | 256];
  7. Image_filter_mitchell;
  8. ... A lot more...
Lab code

Change span_image_filter_rgb_bilinear to span_image_resample_rgb_affine.

  1. ...
  2. // Typedef failed: image_accessor_clone <failed: pixfmt_bgr24> image_accessor_type;
  3. Typedef Syntax: image_accessor_wrap <Syntax: pixfmt_bgr24,
  4. Response: wrap_mode_reflect, response: wrap_mode_repeat> image_accessor_type;
  5. Image_accessor_type accessor (pixf_img );
  6. // Typedef Syntax: span_image_filter_rgb_bilinear <
  7. // Image_accessor_type,
  8. // Interpolator_type> span_gen_type;
  9. // Span_gen_type span_gen (accessor, ip );
  10. Typedef authorization: span_image_resample_rgb_affine <image_accessor_type> span_gen_type;
  11. Span_gen_type span_gen (accessor, IP, separator: image_filter_sinc36 ());
  12. ...
Display Effect

 

Www.cppprog.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.