Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

J2ME - Rescale Image

// description of your code here

private Image rescaleImage(Image image, int width, int height)
	{
		int sourceWidth = image.getWidth();
		int sourceHeight = image.getHeight();
	
		Image newImage = Image.createImage(width, height);
		Graphics g = newImage.getGraphics();
		
		for(int y=0; y<height; y++)
		{
			for(int x=0; x<width; x++)
			{
				g.setClip(x, y, 1, 1);
				int dx = x * sourceWidth / width;
				int dy = y * sourceHeight / height;
				g.drawImage(image, x-dx, y-dy, Graphics.LEFT | Graphics.TOP);
			}
		}
		
		return Image.createImage(newImage);
	}

Linux - XTerm font size

// Aumenta la dimensione del carattere sul terminale

xterm -geometry 640x480 -fn *-fixed-*-*-*-20-*
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS