Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Transparent Background - Image control
Transparent Background - Image control [message #42323] Fri, 07 March 2014 12:15 Go to next message
deep is currently offline  deep
Messages: 227
Registered: July 2011
Location: Bangalore
Experienced Member
Hi

I was working on showing LED on screen,

I want to get final effect as shown in left side image Red Led.

What I get is Like Green Led. Corners Black.

Attached my sample code.

index.php?t=getfile&id=4455&private=0
  • Attachment: Image1.png
    (Size: 8.14KB, Downloaded 450 times)
  • Attachment: LED.7z
    (Size: 6.86KB, Downloaded 413 times)


Warm Regards

Deepak
Re: Transparent Background - Image control [message #42325 is a reply to message #42323] Fri, 07 March 2014 13:46 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 591
Registered: November 2008
Location: France
Contributor
Hi Deep,

ledCtrl.Transparent();

may do the trick

If it doesn't then this means that the ledCtrl draws some background ( it doesn't rely on Ctrl basics ) ... and it therefore needs to be modified.
Re: Transparent Background - Image control [message #42327 is a reply to message #42325] Fri, 07 March 2014 14:22 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 227
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Didier,

Thank you for your response.

I checked with ParentCtrl and ImageCtrl.

protected:
//	ParentCtrl Led;
	ImageCtrl Led;

----------
void psSimLED::Paint(Draw& w)
{
//	Size sz = GetSize();
//	DrawPainter dp(w, sz);
//	dp.DrawImage(0,0,psSimLedImg::redLed());

	w.DrawImage(0,0,psSimLedImg::redLed());

}



Initial code DrawPainter used. Now commented.
Changed to w.DrawImage.. And it is working as expected now.



Warm Regards

Deepak
Re: Transparent Background - Image control [message #42328 is a reply to message #42327] Fri, 07 March 2014 16:03 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 591
Registered: November 2008
Location: France
Contributor
Looks like DrawPainter is missing initialization of an image buffer.

I also stumbled on this kind of issue some time ago when using ImageBuffer and didn't initialize it : if there is no init of the whole buffer then alpha management does not work ==> and you get those black corners

Here is sample code showing the initialization of the ImageBuffer :
RGBA bckgColor;   bckgColor.r = 0; bckgColor.g = 0; bckgColor.b = 0; bckgColor.a = 0;
ImageBuffer ib(_plotRect.Size());
Upp::Fill( ib.Begin(), bckgColor, ib.GetLength() );
BufferPainter bp(ib, _drawMode);
PaintPlotData(bp, scale);
dw.DrawImage(0, 0, ib);


NB : using painter to draw images is useless (and slower), so if you don't draw anything else : do not use Painter

[Updated on: Fri, 07 March 2014 16:07]

Report message to a moderator

Re: Transparent Background - Image control [message #42341 is a reply to message #42328] Sat, 08 March 2014 07:44 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 227
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Didier,

Didier wrote on Fri, 07 March 2014 20:33

Looks like DrawPainter is missing initialization of an image buffer.



What you say is right.

I need only image swap. Will use only Draw.


Warm Regards

Deepak
Re: Transparent Background - Image control LED image Display [message #42351 is a reply to message #42341] Sat, 08 March 2014 15:06 Go to previous message
deep is currently offline  deep
Messages: 227
Registered: July 2011
Location: Bangalore
Experienced Member
Hi,

I want LED image display with Label.

I discovered Label and StaticText class has following functions
Derived from LabelBase

Label.SetImage
Label.SetLeftImage
Label.SetRightImage

index.php?t=getfile&id=4458&private=0

I always assumed Label and StaticText are text only class.

!!! Works great for me
Lesson : Search in UPP code base first. Lots of hidden features !!!
  • Attachment: Image1.png
    (Size: 1.65KB, Downloaded 609 times)


Warm Regards

Deepak
Previous Topic: Clickable SetImage in Button
Next Topic: Flipped image in clipboard
Goto Forum:
  


Current Time: Sat Jan 16 09:34:24 CET 2021

Total time taken to generate the page: 0.00882 seconds