r = pBmp->Construct(*pBuf.get(), outDim, pixelFormat, BUFFER_SCALING_AUTO);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagated. ", GetErrorMessage(r));
+ // Set transparency in case of rgb565 format
+ if (pixelFormat == BITMAP_PIXEL_FORMAT_RGB565)
+ {
+ short rgb565Chroma = 0;
+ Boolean transparency(false);
+ Short chromaKey(0);
+ byte red = 0;
+ byte green = 0;
+ byte blue = 0;
+ Color *pMaskingColor = null;
+
+ r = dec.GetValue(L"transparency", transparency);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.release(), E_SUCCESS, "[%s] Propagated.", GetErrorMessage(r));
+ if (transparency.ToBool() == true)
+ {
+ r = dec.GetValue(L"chromaKey", chromaKey);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.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, pBmp.release(), E_SUCCESS,
+ "[%s] Could not apply masking color.", GetErrorMessage(r));
+ r = pBmp->SetMaskingColor(pMaskingColor);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.release(), E_SUCCESS,
+ "[%s] Could not set masking color.", GetErrorMessage(r));
+ }
+ }
+
SetLastResult(E_SUCCESS);
return pBmp.release();
}
r = pBmp->Construct(*pBuf.get(), outDim, pixelFormat, bufferScaling);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagated. ", GetErrorMessage(r));
+ // Set transparency in case of rgb565 format
+ if (pixelFormat == BITMAP_PIXEL_FORMAT_RGB565)
+ {
+ short rgb565Chroma = 0;
+ Boolean transparency(false);
+ Short chromaKey(0);
+ byte red = 0;
+ byte green = 0;
+ byte blue = 0;
+ Color *pMaskingColor = null;
+
+ r = dec.GetValue(L"transparency", transparency);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.release(), E_SUCCESS, "[%s] Propagated.", GetErrorMessage(r));
+ if (transparency.ToBool() == true)
+ {
+ r = dec.GetValue(L"chromaKey", chromaKey);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.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, pBmp.release(), E_SUCCESS,
+ "[%s] Could not apply masking color.", GetErrorMessage(r));
+ r = pBmp->SetMaskingColor(pMaskingColor);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.release(), E_SUCCESS,
+ "[%s] Could not set masking color.", GetErrorMessage(r));
+ }
+ }
+
SetLastResult(E_SUCCESS);
return pBmp.release();
}
"[%s] new Bitmap", GetErrorMessage(GetLastResult()));
pBmp.reset(_BitmapImpl::GetNonScaledBitmapN(*pBuf.get(), tmpDim, pixelFormat, destDim));
+
+ // Set transparency in case of rgb565 format
+ if (pixelFormat == BITMAP_PIXEL_FORMAT_RGB565)
+ {
+ short rgb565Chroma = 0;
+ Boolean transparency(false);
+ Short chromaKey(0);
+ byte red = 0;
+ byte green = 0;
+ byte blue = 0;
+ Color *pMaskingColor = null;
+
+ r = dec.GetValue(L"transparency", transparency);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.release(), E_SUCCESS, "[%s] Propagated.", GetErrorMessage(r));
+ if (transparency.ToBool() == true)
+ {
+ r = dec.GetValue(L"chromaKey", chromaKey);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.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, pBmp.release(), E_SUCCESS,
+ "[%s] Could not apply masking color.", GetErrorMessage(r));
+ r = pBmp->SetMaskingColor(pMaskingColor);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, pBmp.release(), E_SUCCESS,
+ "[%s] Could not set masking color.", GetErrorMessage(r));
+ }
+ }
+
SetLastResult(E_SUCCESS);
return pBmp.release();
}