Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 1 | /* |
Stephen Hines | adeb809 | 2012-04-20 14:26:06 -0700 | [diff] [blame] | 2 | * Copyright (C) 2008-2012 The Android Open Source Project |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
| 17 | package android.renderscript; |
| 18 | |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 19 | import android.util.SparseArray; |
| 20 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 21 | /** |
Jason Sams | a23d4e7 | 2011-01-04 18:59:12 -0800 | [diff] [blame] | 22 | * |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 23 | **/ |
| 24 | public class Script extends BaseObj { |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * KernelID is an identifier for a Script + root function pair. It is used |
| 28 | * as an identifier for ScriptGroup creation. |
| 29 | * |
| 30 | * This class should not be directly created. Instead use the method in the |
| 31 | * reflected or intrinsic code "getKernelID_funcname()". |
| 32 | * |
| 33 | */ |
| 34 | public static final class KernelID extends BaseObj { |
| 35 | Script mScript; |
| 36 | int mSlot; |
| 37 | int mSig; |
| 38 | KernelID(int id, RenderScript rs, Script s, int slot, int sig) { |
| 39 | super(id, rs); |
| 40 | mScript = s; |
| 41 | mSlot = slot; |
| 42 | mSig = sig; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | private final SparseArray<KernelID> mKIDs = new SparseArray<KernelID>(); |
| 47 | /** |
| 48 | * Only to be used by generated reflected classes. |
| 49 | * |
| 50 | * |
| 51 | * @param slot |
| 52 | * @param sig |
| 53 | * @param ein |
| 54 | * @param eout |
| 55 | * |
| 56 | * @return KernelID |
| 57 | */ |
| 58 | protected KernelID createKernelID(int slot, int sig, Element ein, Element eout) { |
| 59 | KernelID k = mKIDs.get(slot); |
| 60 | if (k != null) { |
| 61 | return k; |
| 62 | } |
| 63 | |
| 64 | int id = mRS.nScriptKernelIDCreate(getID(mRS), slot, sig); |
| 65 | if (id == 0) { |
| 66 | throw new RSDriverException("Failed to create KernelID"); |
| 67 | } |
| 68 | |
| 69 | k = new KernelID(id, mRS, this, slot, sig); |
| 70 | mKIDs.put(slot, k); |
| 71 | return k; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * FieldID is an identifier for a Script + exported field pair. It is used |
| 76 | * as an identifier for ScriptGroup creation. |
| 77 | * |
| 78 | * This class should not be directly created. Instead use the method in the |
| 79 | * reflected or intrinsic code "getFieldID_funcname()". |
| 80 | * |
| 81 | */ |
| 82 | public static final class FieldID extends BaseObj { |
| 83 | Script mScript; |
| 84 | int mSlot; |
| 85 | FieldID(int id, RenderScript rs, Script s, int slot) { |
| 86 | super(id, rs); |
| 87 | mScript = s; |
| 88 | mSlot = slot; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | private final SparseArray<FieldID> mFIDs = new SparseArray(); |
| 93 | /** |
| 94 | * Only to be used by generated reflected classes. |
| 95 | * |
| 96 | * @param slot |
| 97 | * @param e |
| 98 | * |
| 99 | * @return FieldID |
| 100 | */ |
| 101 | protected FieldID createFieldID(int slot, Element e) { |
| 102 | FieldID f = mFIDs.get(slot); |
| 103 | if (f != null) { |
| 104 | return f; |
| 105 | } |
| 106 | |
| 107 | int id = mRS.nScriptFieldIDCreate(getID(mRS), slot); |
| 108 | if (id == 0) { |
| 109 | throw new RSDriverException("Failed to create FieldID"); |
| 110 | } |
| 111 | |
| 112 | f = new FieldID(id, mRS, this, slot); |
| 113 | mFIDs.put(slot, f); |
| 114 | return f; |
| 115 | } |
| 116 | |
| 117 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 118 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 119 | * Only intended for use by generated reflected code. |
| 120 | * |
| 121 | * @param slot |
| 122 | */ |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 123 | protected void invoke(int slot) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 124 | mRS.nScriptInvoke(getID(mRS), slot); |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 125 | } |
| 126 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 127 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 128 | * Only intended for use by generated reflected code. |
| 129 | * |
| 130 | * @param slot |
| 131 | * @param v |
| 132 | */ |
Jason Sams | 96ed4cf | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 133 | protected void invoke(int slot, FieldPacker v) { |
| 134 | if (v != null) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 135 | mRS.nScriptInvokeV(getID(mRS), slot, v.getData()); |
Jason Sams | 96ed4cf | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 136 | } else { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 137 | mRS.nScriptInvoke(getID(mRS), slot); |
Jason Sams | 96ed4cf | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 138 | } |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 139 | } |
| 140 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 141 | /** |
Jason Sams | 6e494d3 | 2011-04-27 16:33:11 -0700 | [diff] [blame] | 142 | * Only intended for use by generated reflected code. |
| 143 | * |
| 144 | * @param slot |
| 145 | * @param ain |
| 146 | * @param aout |
| 147 | * @param v |
| 148 | */ |
| 149 | protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v) { |
| 150 | if (ain == null && aout == null) { |
| 151 | throw new RSIllegalArgumentException( |
| 152 | "At least one of ain or aout is required to be non-null."); |
| 153 | } |
| 154 | int in_id = 0; |
| 155 | if (ain != null) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 156 | in_id = ain.getID(mRS); |
Jason Sams | 6e494d3 | 2011-04-27 16:33:11 -0700 | [diff] [blame] | 157 | } |
| 158 | int out_id = 0; |
| 159 | if (aout != null) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 160 | out_id = aout.getID(mRS); |
Jason Sams | 6e494d3 | 2011-04-27 16:33:11 -0700 | [diff] [blame] | 161 | } |
| 162 | byte[] params = null; |
| 163 | if (v != null) { |
| 164 | params = v.getData(); |
| 165 | } |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 166 | mRS.nScriptForEach(getID(mRS), slot, in_id, out_id, params); |
Jason Sams | 6e494d3 | 2011-04-27 16:33:11 -0700 | [diff] [blame] | 167 | } |
| 168 | |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 169 | protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v, LaunchOptions sc) { |
| 170 | if (ain == null && aout == null) { |
| 171 | throw new RSIllegalArgumentException( |
| 172 | "At least one of ain or aout is required to be non-null."); |
| 173 | } |
Tim Murray | ba9dd06 | 2013-02-12 16:22:34 -0800 | [diff] [blame^] | 174 | |
| 175 | if (sc == null) { |
| 176 | forEach(slot, ain, aout, v); |
| 177 | return; |
| 178 | } |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 179 | int in_id = 0; |
| 180 | if (ain != null) { |
| 181 | in_id = ain.getID(mRS); |
| 182 | } |
| 183 | int out_id = 0; |
| 184 | if (aout != null) { |
| 185 | out_id = aout.getID(mRS); |
| 186 | } |
| 187 | byte[] params = null; |
| 188 | if (v != null) { |
| 189 | params = v.getData(); |
| 190 | } |
| 191 | mRS.nScriptForEachClipped(getID(mRS), slot, in_id, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend); |
| 192 | } |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 193 | |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 194 | Script(int id, RenderScript rs) { |
Alex Sakhartchouk | 0de9444 | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 195 | super(id, rs); |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 198 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 199 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 200 | * Only intended for use by generated reflected code. |
| 201 | * |
| 202 | * @param va |
| 203 | * @param slot |
| 204 | */ |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 205 | public void bindAllocation(Allocation va, int slot) { |
Jason Sams | 771bebb | 2009-12-07 12:40:12 -0800 | [diff] [blame] | 206 | mRS.validate(); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 207 | if (va != null) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 208 | mRS.nScriptBindAllocation(getID(mRS), va.getID(mRS), slot); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 209 | } else { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 210 | mRS.nScriptBindAllocation(getID(mRS), 0, slot); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 211 | } |
| 212 | } |
| 213 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 214 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 215 | * Only intended for use by generated reflected code. |
| 216 | * |
| 217 | * @param index |
| 218 | * @param v |
| 219 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 220 | public void setVar(int index, float v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 221 | mRS.nScriptSetVarF(getID(mRS), index, v); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 222 | } |
| 223 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 224 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 225 | * Only intended for use by generated reflected code. |
| 226 | * |
| 227 | * @param index |
| 228 | * @param v |
| 229 | */ |
Stephen Hines | ca54ec3 | 2010-09-20 17:20:30 -0700 | [diff] [blame] | 230 | public void setVar(int index, double v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 231 | mRS.nScriptSetVarD(getID(mRS), index, v); |
Stephen Hines | ca54ec3 | 2010-09-20 17:20:30 -0700 | [diff] [blame] | 232 | } |
| 233 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 234 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 235 | * Only intended for use by generated reflected code. |
| 236 | * |
| 237 | * @param index |
| 238 | * @param v |
| 239 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 240 | public void setVar(int index, int v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 241 | mRS.nScriptSetVarI(getID(mRS), index, v); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 242 | } |
| 243 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 244 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 245 | * Only intended for use by generated reflected code. |
| 246 | * |
| 247 | * @param index |
| 248 | * @param v |
| 249 | */ |
Stephen Hines | 031ec58c | 2010-10-11 10:54:21 -0700 | [diff] [blame] | 250 | public void setVar(int index, long v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 251 | mRS.nScriptSetVarJ(getID(mRS), index, v); |
Stephen Hines | 031ec58c | 2010-10-11 10:54:21 -0700 | [diff] [blame] | 252 | } |
| 253 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 254 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 255 | * Only intended for use by generated reflected code. |
| 256 | * |
| 257 | * @param index |
| 258 | * @param v |
| 259 | */ |
Jason Sams | 0b9a22c | 2010-07-02 15:35:19 -0700 | [diff] [blame] | 260 | public void setVar(int index, boolean v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 261 | mRS.nScriptSetVarI(getID(mRS), index, v ? 1 : 0); |
Jason Sams | 0b9a22c | 2010-07-02 15:35:19 -0700 | [diff] [blame] | 262 | } |
| 263 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 264 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 265 | * Only intended for use by generated reflected code. |
| 266 | * |
| 267 | * @param index |
| 268 | * @param o |
| 269 | */ |
Jason Sams | 6f4cf0b | 2010-11-16 17:37:02 -0800 | [diff] [blame] | 270 | public void setVar(int index, BaseObj o) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 271 | mRS.nScriptSetVarObj(getID(mRS), index, (o == null) ? 0 : o.getID(mRS)); |
Jason Sams | 6f4cf0b | 2010-11-16 17:37:02 -0800 | [diff] [blame] | 272 | } |
| 273 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 274 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 275 | * Only intended for use by generated reflected code. |
| 276 | * |
| 277 | * @param index |
| 278 | * @param v |
| 279 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 280 | public void setVar(int index, FieldPacker v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 281 | mRS.nScriptSetVarV(getID(mRS), index, v.getData()); |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 282 | } |
| 283 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 284 | /** |
Stephen Hines | adeb809 | 2012-04-20 14:26:06 -0700 | [diff] [blame] | 285 | * Only intended for use by generated reflected code. |
| 286 | * |
| 287 | * @param index |
| 288 | * @param v |
| 289 | * @param e |
| 290 | * @param dims |
| 291 | */ |
| 292 | public void setVar(int index, FieldPacker v, Element e, int[] dims) { |
| 293 | mRS.nScriptSetVarVE(getID(mRS), index, v.getData(), e.getID(mRS), dims); |
| 294 | } |
| 295 | |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 296 | public void setTimeZone(String timeZone) { |
Jason Sams | 771bebb | 2009-12-07 12:40:12 -0800 | [diff] [blame] | 297 | mRS.validate(); |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 298 | try { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 299 | mRS.nScriptSetTimeZone(getID(mRS), timeZone.getBytes("UTF-8")); |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 300 | } catch (java.io.UnsupportedEncodingException e) { |
| 301 | throw new RuntimeException(e); |
| 302 | } |
| 303 | } |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 304 | |
| 305 | public static class Builder { |
| 306 | RenderScript mRS; |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 307 | |
| 308 | Builder(RenderScript rs) { |
| 309 | mRS = rs; |
| 310 | } |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 311 | } |
| 312 | |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 313 | |
| 314 | public static class FieldBase { |
| 315 | protected Element mElement; |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 316 | protected Allocation mAllocation; |
| 317 | |
| 318 | protected void init(RenderScript rs, int dimx) { |
Jason Sams | 5476b45 | 2010-12-08 16:14:36 -0800 | [diff] [blame] | 319 | mAllocation = Allocation.createSized(rs, mElement, dimx, Allocation.USAGE_SCRIPT); |
| 320 | } |
| 321 | |
| 322 | protected void init(RenderScript rs, int dimx, int usages) { |
| 323 | mAllocation = Allocation.createSized(rs, mElement, dimx, Allocation.USAGE_SCRIPT | usages); |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | protected FieldBase() { |
| 327 | } |
| 328 | |
| 329 | public Element getElement() { |
| 330 | return mElement; |
| 331 | } |
| 332 | |
| 333 | public Type getType() { |
Jason Sams | 31a7e42 | 2010-10-26 13:09:17 -0700 | [diff] [blame] | 334 | return mAllocation.getType(); |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | public Allocation getAllocation() { |
| 338 | return mAllocation; |
| 339 | } |
| 340 | |
| 341 | //@Override |
| 342 | public void updateAllocation() { |
| 343 | } |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 344 | } |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 345 | |
| 346 | public static final class LaunchOptions { |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 347 | protected int xstart = 0; |
| 348 | protected int ystart = 0; |
| 349 | protected int xend = 0; |
| 350 | protected int yend = 0; |
| 351 | protected int zstart = 0; |
| 352 | protected int zend = 0; |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 353 | |
| 354 | protected int strategy; |
| 355 | |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 356 | public LaunchOptions setX(int xstartArg, int xendArg) { |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 357 | if (xstartArg < 0 || xendArg <= xstartArg) { |
| 358 | throw new RSIllegalArgumentException("Invalid dimensions"); |
| 359 | } |
| 360 | xstart = xstartArg; |
| 361 | xend = xendArg; |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 362 | return this; |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 363 | } |
| 364 | |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 365 | public LaunchOptions setY(int ystartArg, int yendArg) { |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 366 | if (ystartArg < 0 || yendArg <= ystartArg) { |
| 367 | throw new RSIllegalArgumentException("Invalid dimensions"); |
| 368 | } |
| 369 | ystart = ystartArg; |
| 370 | yend = yendArg; |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 371 | return this; |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 372 | } |
| 373 | |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 374 | public LaunchOptions setZ(int zstartArg, int zendArg) { |
| 375 | if (zstartArg < 0 || zendArg <= zstartArg) { |
| 376 | throw new RSIllegalArgumentException("Invalid dimensions"); |
| 377 | } |
| 378 | zstart = zstartArg; |
| 379 | zend = zendArg; |
| 380 | return this; |
| 381 | } |
| 382 | |
| 383 | |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 384 | public int getXStart() { |
| 385 | return xstart; |
| 386 | } |
| 387 | public int getXEnd() { |
| 388 | return xend; |
| 389 | } |
| 390 | public int getYStart() { |
| 391 | return ystart; |
| 392 | } |
| 393 | public int getYEnd() { |
| 394 | return yend; |
| 395 | } |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 396 | public int getZStart() { |
| 397 | return zstart; |
| 398 | } |
| 399 | public int getZEnd() { |
| 400 | return zend; |
| 401 | } |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 402 | |
| 403 | } |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 404 | } |
| 405 | |