You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Added RenderTexture::saveToFileAsNonPMA() to save images without PMA.
Set the PMA parameter to true when calling initWithRawData() inside RenderTexture::newImage(), since textures are PMA.
Renamed Image::premultipliedAlpha() to Image::premultiplyAlpha() to better reflect it's action, and made it public.
Added Image::reversePremultipliedAlpha() to allow the reversing of the PMA.
Updated CCImage-ios.mm to set the correct bitmapInfo for PMA and non-PMA images before saving a file.
Updated RenderTextureTest::RenderTextureSave() to cater for non-PMA file saving.
* [CCImage-ios.mm] Fixed indentation.
* Corrects the PMA setting on the internal Texture2D instance created by RenderTexture.
Copy file name to clipboardExpand all lines: cocos/renderer/CCTexture2D.h
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -226,10 +226,11 @@ class CC_DLL Texture2D : public Ref
226
226
@param pixelsWide The image width.
227
227
@param pixelsHigh The image height.
228
228
@param contentSize The image content size.
229
+
@param preMultipliedAlpha The texture has premultiplied alpha
229
230
* @js NA
230
231
* @lua NA
231
232
*/
232
-
boolinitWithData(constvoid *data, ssize_t dataLen, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, const Size& contentSize);
233
+
boolinitWithData(constvoid *data, ssize_t dataLen, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, const Size& contentSize, bool preMultipliedAlpha = false);
233
234
234
235
/** Initializes with mipmaps.
235
236
@@ -238,8 +239,9 @@ class CC_DLL Texture2D : public Ref
238
239
@param pixelFormat The image pixelFormat.
239
240
@param pixelsWide The image width.
240
241
@param pixelsHigh The image height.
242
+
@param preMultipliedAlpha The texture has premultiplied alpha
241
243
*/
242
-
boolinitWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh);
244
+
boolinitWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, bool preMultipliedAlpha = false);
0 commit comments