From: JungYumin Date: Thu, 20 Jun 2013 06:05:58 +0000 (+0900) Subject: Fixed transparent issue of RGB565 X-Git-Tag: accepted/tizen/20130925.002707~2^2~7 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fframework%2Fnative%2Fimage.git;a=commitdiff_plain;h=d028387dd758b6607879c35e561c700baf9f7599 Fixed transparent issue of RGB565 Change-Id: I688ca07fe95eee5c644dea133ab3bb686f12ec3e Signed-off-by: JungYumin --- diff --git a/src/FMedia_GifDecoderImpl.cpp b/src/FMedia_GifDecoderImpl.cpp index 4f3556f..5f206cd 100644 --- a/src/FMedia_GifDecoderImpl.cpp +++ b/src/FMedia_GifDecoderImpl.cpp @@ -165,6 +165,42 @@ _GifDecoderImpl::GetNextBitmapN(long& duration, Tizen::Graphics::BufferScaling b ? BITMAP_PIXEL_FORMAT_RGB565 : BITMAP_PIXEL_FORMAT_ARGB8888; r = pBitmap->Construct(*pByteBuffer.get(), dim, pixelFormat, bufferScaling); SysTryReturn(NID_MEDIA, r == E_SUCCESS, null,r, "pBmp->Construct:%s", GetErrorMessage(r)); + + // Set transparency in case of rgb565 format + if (pixelFormat == BITMAP_PIXEL_FORMAT_RGB565) + { + short rgb565Chroma = 0; + Boolean transparency(false); + Integer chromaKey(0); + byte red = 0; + byte green = 0; + byte blue = 0; + Color *pMaskingColor = null; + + r = __pGifDecoder->GetValue(L"transparency", transparency); + SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBitmap.release(), E_SUCCESS, "[%s] Propagated.", GetErrorMessage(r)); + if (transparency.ToBool() == true) + { + r = __pGifDecoder->GetValue(L"chromaKey", chromaKey); + SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBitmap.release(), E_SUCCESS, "[%s] Propagated.", GetErrorMessage(r)); + + rgb565Chroma = chromaKey.ToShort(); + red = (rgb565Chroma & 0xf800) >> 8; + red = red | (red >> 5); + green = (rgb565Chroma & 0x07e0) >> 3; + green = green | (green >> 6); + blue = (rgb565Chroma & 0x001f) << 3; + blue = blue | (blue >> 5); + + pMaskingColor = new Color(red, green, blue); + SysTryReturn(NID_MEDIA, pMaskingColor != null, pBitmap.release(), E_SUCCESS, + "[%s] Could not apply masking color.", GetErrorMessage(r)); + r = pBitmap->SetMaskingColor(pMaskingColor); + delete pMaskingColor; + SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBitmap.release(), E_SUCCESS, + "[%s] Could not set masking color.", GetErrorMessage(r)); + } + } } SetLastResult(E_SUCCESS); return pBitmap.release(); diff --git a/src/FMedia_ImageBufferImpl.cpp b/src/FMedia_ImageBufferImpl.cpp index 2210c1c..e280ddc 100644 --- a/src/FMedia_ImageBufferImpl.cpp +++ b/src/FMedia_ImageBufferImpl.cpp @@ -200,7 +200,7 @@ _ImageBufferImpl::Construct(const Tizen::Base::ByteBuffer &srcImageBuf, const Ti Tizen::Graphics::Rectangle transformRegion; int orientationInfo = 0; Boolean transparency(false); - Integer chromaKey; + Integer chromaKey(0); r = dec.Construct(srcImageBuf); SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Decoder construct failed.", GetErrorMessage(r)); @@ -329,7 +329,7 @@ _ImageBufferImpl::Construct(const Tizen::Base::ByteBuffer &srcImageBuf, const Ti } else { - __maskColor = chromaKey.ToInt(); + __maskColor = chromaKey.value; } } } @@ -376,7 +376,7 @@ _ImageBufferImpl::Construct(const Tizen::Base::ByteBuffer &srcImageBuf, const Ti } else { - __maskColor = chromaKey.ToInt(); + __maskColor = chromaKey.value; } } } @@ -413,7 +413,7 @@ _ImageBufferImpl::Construct(const Tizen::Base::ByteBuffer &srcImageBuf, const Ti } else { - __maskColor = chromaKey.ToInt(); + __maskColor = chromaKey.value; } } } @@ -528,7 +528,7 @@ _ImageBufferImpl::Construct(const Tizen::Base::ByteBuffer &srcImageBuf, int dest std::unique_ptr pDstBuf; Tizen::Graphics::Rectangle transformRegion; Boolean transparency(false); - Integer chromaKey; + Integer chromaKey(0); r = dec.Construct(srcImageBuf); SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Decoder construct failed.", GetErrorMessage(r)); @@ -574,7 +574,7 @@ _ImageBufferImpl::Construct(const Tizen::Base::ByteBuffer &srcImageBuf, int dest } else { - __maskColor = chromaKey.ToInt(); + __maskColor = chromaKey.value; } } } diff --git a/src/FMedia_ImageImpl.cpp b/src/FMedia_ImageImpl.cpp index a32ed92..6567bce 100644 --- a/src/FMedia_ImageImpl.cpp +++ b/src/FMedia_ImageImpl.cpp @@ -168,7 +168,7 @@ _ImageImpl::DecodeToBitmapN(const Tizen::Base::ByteBuffer& srcImageBuf, Tizen::G { short rgb565Chroma = 0; Boolean transparency(false); - Short chromaKey(0); + Integer chromaKey(0); byte red = 0; byte green = 0; byte blue = 0; @@ -255,7 +255,7 @@ _ImageImpl::DecodeToBitmapN(const Tizen::Base::ByteBuffer& srcImageBuf, Tizen::G { short rgb565Chroma = 0; Boolean transparency(false); - Short chromaKey(0); + Integer chromaKey(0); byte red = 0; byte green = 0; byte blue = 0; @@ -335,7 +335,7 @@ _ImageImpl::DecodeToBitmapN(const Tizen::Base::ByteBuffer& srcImageBuf, Tizen::G { short rgb565Chroma = 0; Boolean transparency(false); - Short chromaKey(0); + Integer chromaKey(0); byte red = 0; byte green = 0; byte blue = 0;