Page 1 of 1

getImageMode() never called!

Posted: Sat Mar 23, 2013 12:31 pm
by 17064597
So how would you get a tiled/centered image on the panel/wall?

Re: getImageMode() never called!

Posted: Mon Mar 25, 2013 4:49 pm
by yeray
Hi Kristoffer,
getImageMode() never called!
It's a public function you can use to check the value of the imageMode property. Internally, it is directly used the imageMode property in the

Code: Select all

chartEvent
.
znakeeye wrote:So how would you get a tiled/centered image on the panel/wall?
Here you have an example of how to use the CENTER mode:

Code: Select all

	private void initializeChart() {
		tChart1.getAspect().setView3D(false);
		tChart1.getLegend().setVisible(false);
		  
		Bar bar1 = new Bar(tChart1.getChart());
		bar1.fillSampleValues();
		
		checkExternalStorage();

		Image im = null;
		if (mExternalStorageAvailable) {
			if (mExternalStorageWriteable) {
				final File ExtPath = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Download");
				ExtPath.mkdirs();
				String path = ExtPath.getAbsolutePath() + File.separator + "flower.jpg";
				im = new Image(path);		        
			}
		}
		
		ChartImage chIm = new ChartImage(tChart1.getChart());
		chIm.setImage(im);
		chIm.setImageMode(ImageMode.TILE);
		//chIm.setImageMode(ImageMode.CENTER);
	}

	private boolean mExternalStorageAvailable = false;
	private boolean mExternalStorageWriteable = false;
	private void checkExternalStorage() {
		final String state = Environment.getExternalStorageState();

		if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_SHARED.equals(state)) {
			// We can read and write the media
			mExternalStorageAvailable = mExternalStorageWriteable = true;
		} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
			// We can only read the media
			mExternalStorageAvailable = true;
			mExternalStorageWriteable = false;
		} else {
			// Something else is wrong. It may be one of many other states, but
			// all we need
			// to know is we can neither read nor write
			mExternalStorageAvailable = mExternalStorageWriteable = false;
		}
	}
center.png
center.png (16.5 KiB) Viewed 1158 times
However, I'm afraid the TILE and STRETCH modes aren't implemented yet. I've added it to the wish list to be implemented in next releases (TJ71016548).