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 » U++ Widgets - General questions or Mixed problems » ScrollView - a question - maybe proposal..
Re: ScrollView - a question - maybe proposal.. [message #51068 is a reply to message #51014] Thu, 17 January 2019 19:20 Go to previous messageGo to previous message
luoganda is currently offline  luoganda
Messages: 197
Registered: November 2016
Experienced Member
ok, i wrote a small ImageDraw helper utility,
this somehow works, but it's slowwwww..
Any improvements here or suggestions are welcome.

Also - i recommend adding GetSize() to ImageDraw, to get Width/Height without getting image itself overhead.

class SMXImageDraw{
	ImageDraw *id=NULL;
	public:
	~SMXImageDraw(){Clear();}
	void Set(int w,int h){Clear();id=new ImageDraw(w,h);}
	void Clear(){if(!id)return;delete id;id=NULL;}
	void ScrollImageX(int x); //does (quick)x sanity checks
	ImageDraw &Get(){return *id;}
	bool Empty(){return id==NULL;}
};

void SMXImageDraw::ScrollImageX(int x){
	int absx=abs(x);
	if(x==0||!id/*||absx>=id->GetSize().cx*/)return; // <== here, ImageDraw::GetSize() could come handy
	Image img=(Image)*id;//->GetStraight();
	if(absx>=img.GetWidth())return;
	int nx=x<0?0:x;
	id->DrawImage(nx,0,img,Rect((x<0?absx:0),0,nx+(img.GetWidth()-(x<0?0:absx)),img.GetHeight()));
}

[Updated on: Thu, 17 January 2019 19:33]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: no resources | There were errors
Next Topic: cc1plus.exe: out of memory allocating 65536 bytes
Goto Forum:
  


Current Time: Tue May 21 23:00:20 CEST 2024

Total time taken to generate the page: 0.02267 seconds