« 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

Stéphane CHAU wrote:
> Can we use images as fill patterns if we use pixel format that are not
> defined as 32 bits ?

Just off the top of my head, you could copy and rename span_pattern_rgba to span_pattern_rgb555, and change the "generate" method to something like this:

    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);
    }



------------------------------------------------------------------------------
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..