예제 #1
0
bool GiCanvasIos::drawCachedBitmap2(const GiCanvas* p, float x, float y, bool secondBmp)
{
    bool ret = false;
    
    if (p && p->getCanvasType() == getCanvasType()) {
        GiCanvasIos* gs = (GiCanvasIos*)p;
        int index = secondBmp ? 1 : 0;
        CGImageRef image = gs->m_draw->_cacheserr[index] ? NULL : gs->m_draw->_caches[index];
        CGContextRef context = m_draw->getContext();
        
        if (context && image) {
            CGRect rect = CGRectMake(x, y, m_draw->width(), m_draw->height());
            CGAffineTransform af = CGAffineTransformMake(1, 0, 0, -1, 0, m_draw->height());
            
            CGContextConcatCTM(context, af);
            
            CGInterpolationQuality oldQuality = CGContextGetInterpolationQuality(context);
            CGContextSetInterpolationQuality(context, kCGInterpolationNone);
            CGContextDrawImage(context, rect, image);
            CGContextSetInterpolationQuality(context, oldQuality);
            
            CGContextConcatCTM(context, CGAffineTransformInvert(af));
            ret = true;
        }
    }
    
    return ret;
}
예제 #2
0
bool GiCanvasGdi::drawCachedBitmap2(const GiCanvas* p, float x, float y, bool secondBmp)
{
    if (p && p->getCanvasType() == getCanvasType())
    {
        const GiCanvasGdi* gs = static_cast<const GiCanvasGdi*>(p);
        return gs->xf().getWidth() == xf().getWidth()
            && gs->xf().getHeight() == xf().getHeight()
            && GdiCachedBmp(secondBmp).draw(m_draw, m_draw->getDrawDC(), x, y);
    }
    return false;
}
예제 #3
0
bool GiCanvasGdip::drawCachedBitmap2(const GiCanvas* p, 
                                     float x, float y, bool secondBmp)
{
    bool ret = false;

    if (m_draw->getDrawGs() && p && p->getCanvasType() == getCanvasType())
    {
        const GiCanvasGdip* gs = static_cast<const GiCanvasGdip*>(p);

        if (gs->xf().getWidth() == xf().getWidth()
            && gs->xf().getHeight() == xf().getHeight())
        {
            G::CachedBitmap* pBmp = gdipCachedBmp(secondBmp);
            if (pBmp != NULL)
            {
                ret = (G::Ok == m_draw->getDrawGs()->DrawCachedBitmap(
                    pBmp, mgRound(x), mgRound(y)));
            }
        }
    }

    return ret;
}