2 * Copyright (C) 2009 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 package com.android.wallpaper;
20 import android.content.res.Resources;
21 import android.os.Bundle;
22 import android.renderscript.RenderScriptGL;
23 import android.renderscript.ScriptC;
25 public abstract class RenderScriptScene {
27 protected int mHeight;
28 protected boolean mPreview;
29 protected Resources mResources;
30 protected RenderScriptGL mRS;
31 protected ScriptC mScript;
33 public RenderScriptScene(int width, int height) {
38 public void init(RenderScriptGL rs, Resources res, boolean isPreview) {
42 mScript = createScript();
45 public boolean isPreview() {
49 public int getWidth() {
53 public int getHeight() {
57 public Resources getResources() {
61 public RenderScriptGL getRS() {
65 public ScriptC getScript() {
69 protected abstract ScriptC createScript();
72 mRS.contextBindRootScript(null);
76 mRS.contextBindRootScript(mScript);
79 public void resize(int width, int height) {
84 @SuppressWarnings({"UnusedDeclaration"})
85 public void setOffset(float xOffset, float yOffset, int xPixels, int yPixels) {
88 @SuppressWarnings({"UnusedDeclaration"})
89 public Bundle onCommand(String action, int x, int y, int z, Bundle extras,
90 boolean resultRequested) {