Home » U++ Library support » U++ Library : Other (not classified elsewhere) » GLCtrl - alpha transparency
GLCtrl - alpha transparency [message #61327] |
Wed, 25 December 2024 20:13 |
luoganda
Messages: 214 Registered: November 2016
|
Experienced Member |
|
|
Ok - fake alarm, Premultiply should be called after setting alpha(and yes - this is in the docs).
============================================================ ========
In the attachment there is an image(and src) with an issue when setting alpha value manually.
It seems that when making an image in any software and overlaying it - it works fine, do i miss something when doing it manually?
Here is a sample code:
glCtrl.WhenGLPaint<<[&]{
Size sz=GetSize();
GLDraw w;w.Init(sz);
w.DrawRect(sz,Blue()); //when p->a=10 it is obvious what is not correct
//w.DrawRect(sz,White()); //only on whiteBg it works correctly with any alpha value
//w.DrawRect(sz,Black()); //same as on eg. BlueBg
Image img2=StreamRaster::LoadFileAny("img2.png");
ImageBuffer ib(img2);
for(RGBA*p=~ib,*e=ib.End();p<e;p++)p->a=2;
img2=ib;
w.DrawImage(0,0,img2);
//w.DrawImage(0,0,StreamRaster::LoadFileAny("img2.png"));
//w.DrawImage(0,0,StreamRaster::LoadFileAny("img1.png"));
};
While writing this - i found similar thread(which can be safely deleted.
There it says:
When one sets alpha of upper Image to 0 or 255 it works as expected.
But when eg 10,100, etc is used - blending is kinda weird hybrid.
-
Attachment: scrshot.png
(Size: 29.77KB, Downloaded 42 times)
-
Attachment: GLCtrlTest.7z
(Size: 11.98KB, Downloaded 34 times)
[Updated on: Wed, 25 December 2024 20:39] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Jun 01 13:20:04 CEST 2025
Total time taken to generate the page: 0.02337 seconds
|