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 » DrawImage scaling
DrawImage scaling [message #7476] Sun, 31 December 2006 03:27 Go to next message
Coder is currently offline  Coder
Messages: 3
Registered: December 2006
Junior Member
Does Draw::DrawImage support point sampled (non-filtered) scaling now or in the future maybe?
Re: DrawImage scaling [message #7485 is a reply to message #7476] Sun, 31 December 2006 09:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12126
Registered: November 2005
Ultimate Member
No. Support was considered at one point, but issue later remained silent, so it looks like it is not really needed much.

You can always use your routine. If printing is concern, you can register your own DrawData routine and get the same level of support as it was supported internally.

Mirek
Re: DrawImage scaling [message #7499 is a reply to message #7485] Tue, 02 January 2007 02:43 Go to previous messageGo to next message
Coder is currently offline  Coder
Messages: 3
Registered: December 2006
Junior Member
The reason I brought it up, is that most image editors (Gimp, Photoshop, Paintshop Pro, etc) and most image viewers, use nonfiltered zooming, to allow users to see the pixels as they are. In any case, thanks for responding!
Re: DrawImage scaling [message #9430 is a reply to message #7499] Mon, 07 May 2007 21:34 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
I need this too. Is the only alternative that one needs to draw a rectangle to represent each pixel?

Cheers,

Nick
Re: DrawImage scaling [message #9454 is a reply to message #9430] Tue, 08 May 2007 19:21 Go to previous message
mirek is currently offline  mirek
Messages: 12126
Registered: November 2005
Ultimate Member
nixnixnix wrote on Mon, 07 May 2007 15:34

I need this too. Is the only alternative that one needs to draw a rectangle to represent each pixel?

Cheers,

Nick


If "zoom" is all you need, it is trivial to implement:

(IconDes/ImageOp.cpp 170):


Image Magnify(const Image& img, int nx, int ny)
{
	if(nx == 1 && ny == 1)
		return img;
	if(nx == 0 || ny == 0)
		return Image();
	Size sz = img.GetSize();
	bool xdown = nx < 0;
	nx = abs(nx);
	int ncx = xdown ? sz.cx / nx : sz.cx * nx;
	ImageBuffer b(ncx, sz.cy * ny);
	const RGBA *s = ~img;
	const RGBA *e = s + img.GetLength();
	RGBA *t = ~b;
	while(s < e) {
		RGBA *q = t;
		const RGBA *le = s + sz.cx;
		while(s < le) {
			Fill(q, *s, nx);
			q += nx;
			s++;
		}
		for(int n = ny - 1; n--;) {
			memcpy(q, t, ncx * sizeof(RGBA));
			q += ncx;
		}
		t = q;
	}
	return b;
}


BTW, if you are about to do any image processing, IconDes is quite good studying material...

Mirek
Previous Topic: PNG to IML?
Next Topic: Delayed Image Loading
Goto Forum:
  


Current Time: Sat Dec 14 20:30:35 CET 2019

Total time taken to generate the page: 0.01484 seconds