« Return to Thread: Blending and Drawing produce different image..

Re: Using pattern fill with a rgb555 pixel format

by Jim Barry-2 :: Rate this Message:

Reply to Author | View in Thread

Jim Barry wrote:

>     void generate(color_type* span, int x, int y, unsigned len)
>     {
>         typedef source_type::pixfmt_type::pixel_type pixel_type;
>         x += m_offset_x;
>         y += m_offset_y;
>         const pixel_type* p = (const pixel_type*)m_src->span(x, y,
> len);
>         do
>         {
>             color_type c = agg::blender_rgb555::make_color(*p);
>             span->r = c.r;
>             span->g = c.g;
>             span->b = c.b;
>             span->a = c.a;
>             p = (const pixel_type*)m_src->next_x();
>             ++span;
>         }
>         while(--len);
>     }

Or, somewhat more succinctly:

    void generate(color_type* span, int x, int y, unsigned len)
    {  
        typedef source_type::pixfmt_type::pixel_type pixel_type;
        x += m_offset_x;
        y += m_offset_y;
        const pixel_type* p = (const pixel_type*)m_src->span(x, y, len);
        do
        {
            *span++ = agg::blender_rgb555::make_color(*p);
            p = (const pixel_type*)m_src->next_x();
        }
        while(--len);
    }

:-)

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Vector-agg-general mailing list
Vector-agg-general@...
https://lists.sourceforge.net/lists/listinfo/vector-agg-general

 « Return to Thread: Blending and Drawing produce different image..