/* */ package quicktime.qd;
/* */
/* */ import quicktime.QTException;
/* */ import quicktime.QTObject;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.QTSession;
/* */ import quicktime.jdirect.QTNative;
/* */ import quicktime.std.StdQTException;
/* */ import quicktime.std.image.GraphicsImporter;
/* */ import quicktime.std.movies.Movie;
/* */ import quicktime.std.movies.MovieController;
/* */ import quicktime.std.movies.Track;
/* */ import quicktime.std.sg.VisualChannel;
/* */ import quicktime.streaming.Presentation;
/* */ import quicktime.streaming.Stream;
/* */ import quicktime.util.QTHandleRef;
/* */
/* */ public final class Region extends QTHandleRef
/* */ implements Cloneable
/* */ {
/* 30 */ private static boolean apriori = QTSession.apriori();
/* */
/* 36 */ private static final boolean isMacOS = (QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4));
/* 37 */ private static final int[] savedPort = { 0 };
/* 38 */ private static final int[] savedDevice = { 0 };
/* */ private QDGraphics recordingGraphics;
/* */
/* */ public static Region fromGraphicsImporter(GraphicsImporter paramGraphicsImporter)
/* */ throws QTException
/* */ {
/* 49 */ int[] arrayOfInt = new int[1];
/* 50 */ int i = GraphicsImportGetClip(QTObject.ID(paramGraphicsImporter), arrayOfInt);
/* 51 */ QTException.checkError(i);
/* 52 */ if (arrayOfInt[0] == 0) return null;
/* 53 */ return arrayOfInt[0] == 0 ? null : new Region(arrayOfInt[0]);
/* */ }
/* */
/* */ public static Region fromGraphicsImporterDefault(GraphicsImporter paramGraphicsImporter)
/* */ throws QTException
/* */ {
/* 64 */ int[] arrayOfInt = { 0 };
/* 65 */ int i = GraphicsImportGetDefaultClip(QTObject.ID(paramGraphicsImporter), arrayOfInt);
/* 66 */ QTException.checkError(i);
/* 67 */ return arrayOfInt[0] == 0 ? null : new Region(arrayOfInt[0]);
/* */ }
/* */
/* */ public static Region fromMovieDisplayClip(Movie paramMovie)
/* */ throws QTException
/* */ {
/* 78 */ int i = GetMovieDisplayClipRgn(QTObject.ID(paramMovie));
/* 79 */ StdQTException.checkError(GetMoviesError());
/* 80 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromMovieDisplayBounds(Movie paramMovie)
/* */ throws QTException
/* */ {
/* 95 */ int i = GetMovieDisplayBoundsRgn(QTObject.ID(paramMovie));
/* 96 */ StdQTException.checkError(GetMoviesError());
/* 97 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromMovieClip(Movie paramMovie)
/* */ throws QTException
/* */ {
/* 108 */ int i = GetMovieClipRgn(QTObject.ID(paramMovie));
/* 109 */ StdQTException.checkError(GetMoviesError());
/* 110 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromPresentationClip(Presentation paramPresentation, Stream paramStream)
/* */ throws QTException
/* */ {
/* 122 */ int[] arrayOfInt = { 0 };
/* 123 */ StdQTException.checkError(QTSPresGetClip(QTObject.ID(paramPresentation), QTObject.ID(paramStream), arrayOfInt));
/* */
/* 125 */ return arrayOfInt[0] == 0 ? null : new Region(arrayOfInt[0]);
/* */ }
/* */
/* */ public static Region fromMovieBounds(Movie paramMovie)
/* */ throws QTException
/* */ {
/* 140 */ int i = GetMovieBoundsRgn(QTObject.ID(paramMovie));
/* 141 */ StdQTException.checkError(GetMoviesError());
/* 142 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromMovieSegment(Movie paramMovie, int paramInt1, int paramInt2)
/* */ throws QTException
/* */ {
/* 155 */ int i = GetMovieSegmentDisplayBoundsRgn(QTObject.ID(paramMovie), paramInt1, paramInt2);
/* 156 */ StdQTException.checkError(GetMoviesError());
/* 157 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromMovieControllerBounds(MovieController paramMovieController)
/* */ throws QTException
/* */ {
/* 169 */ int i = MCGetControllerBoundsRgn(QTObject.ID(paramMovieController));
/* 170 */ StdQTException.checkError(GetMoviesError());
/* 171 */ return new Region(i);
/* */ }
/* */
/* */ public static Region fromMovieControllerWindow(MovieController paramMovieController, QDGraphics paramQDGraphics)
/* */ throws QTException
/* */ {
/* 184 */ if (paramQDGraphics == null) {
/* 185 */ throw new StdQTException(-50);
/* */ }
/* 187 */ int i = 0;
/* */
/* 189 */ synchronized (QTNative.globalsLock) {
/* 190 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 191 */ GetGWorld(savedPort, savedDevice);
/* 192 */ SetGWorld(QTObject.ID(paramQDGraphics), 0);
/* 193 */ i = MCGetWindowRgn(QTObject.ID(paramMovieController), QTObject.ID(paramQDGraphics));
/* 194 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 195 */ SetGWorld(savedPort[0], savedDevice[0]);
/* */ }
/* 197 */ StdQTException.checkError(GetMoviesError());
/* 198 */ return new Region(i);
/* */ }
/* */
/* */ public static Region fromMovieControllerClip(MovieController paramMovieController)
/* */ throws QTException
/* */ {
/* 209 */ synchronized (QTNative.globalsLock) {
/* 210 */ int[] arrayOfInt = new int[1];
/* 211 */ StdQTException.checkError(MCGetClip(QTObject.ID(paramMovieController), arrayOfInt, null));
/* */
/* 214 */ return new Region(arrayOfInt[0]);
/* */ }
/* */ }
/* */
/* */ public static Region fromMovieControllerBadge(MovieController paramMovieController, Region paramRegion, boolean paramBoolean)
/* */ throws QTException
/* */ {
/* 227 */ int[] arrayOfInt = null;
/* 228 */ if (paramBoolean) {
/* 229 */ arrayOfInt = new int[1];
/* */ }
/* 231 */ StdQTException.checkError(MCDrawBadge(QTObject.ID(paramMovieController), QTObject.ID(paramRegion), arrayOfInt));
/* */
/* 233 */ return paramBoolean ? new Region(arrayOfInt[0]) : null;
/* */ }
/* */
/* */ public static Region fromTrackClip(Track paramTrack)
/* */ throws QTException
/* */ {
/* 244 */ int i = GetTrackClipRgn(QTObject.ID(paramTrack));
/* 245 */ StdQTException.checkError(GetMoviesError());
/* 246 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromTrackDisplay(Track paramTrack)
/* */ throws QTException
/* */ {
/* 257 */ int i = GetTrackDisplayBoundsRgn(QTObject.ID(paramTrack));
/* 258 */ StdQTException.checkError(GetMoviesError());
/* 259 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromTrackMovieBounds(Track paramTrack)
/* */ throws QTException
/* */ {
/* 270 */ int i = GetTrackMovieBoundsRgn(QTObject.ID(paramTrack));
/* 271 */ StdQTException.checkError(GetMoviesError());
/* 272 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromTrackBounds(Track paramTrack)
/* */ throws QTException
/* */ {
/* 284 */ int i = GetTrackBoundsRgn(QTObject.ID(paramTrack));
/* 285 */ StdQTException.checkError(GetMoviesError());
/* 286 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromTrackSegment(Track paramTrack, int paramInt1, int paramInt2)
/* */ throws QTException
/* */ {
/* 300 */ int i = GetTrackSegmentDisplayBoundsRgn(QTObject.ID(paramTrack), paramInt1, paramInt2);
/* 301 */ StdQTException.checkError(GetMoviesError());
/* 302 */ return i == 0 ? null : new Region(i);
/* */ }
/* */
/* */ public static Region fromVideoChannel(VisualChannel paramVisualChannel)
/* */ throws QTException
/* */ {
/* 313 */ int[] arrayOfInt = { 0 };
/* 314 */ int i = SGGetChannelClip(QTObject.ID(paramVisualChannel), arrayOfInt);
/* 315 */ StdQTException.checkError(i);
/* 316 */ return arrayOfInt[0] == 0 ? null : new Region(arrayOfInt[0]);
/* */ }
/* */
/* */ public Region()
/* */ throws QTException
/* */ {
/* 324 */ super(allocate(), null, false);
/* */ }
/* */
/* */ private static int allocate() throws QTException {
/* 328 */ int i = NewRgn();
/* 329 */ StdQTException.checkError(MemError());
/* 330 */ return i;
/* */ }
/* */
/* */ public Region(QDRect paramQDRect)
/* */ throws QTException
/* */ {
/* 339 */ this();
/* 340 */ rect(paramQDRect);
/* */ }
/* */
/* */ public Region(PixMap paramPixMap)
/* */ throws QTException
/* */ {
/* 349 */ this();
/* 350 */ int i = 0;
/* 351 */ if (!paramPixMap.isLocked()) {
/* 352 */ paramPixMap.lock();
/* 353 */ i = 1;
/* */ }
/* 355 */ int j = getIntFromPointer(QTObject.ID(paramPixMap), 0);
/* */
/* 357 */ int k = BitMapToRegion(_ID(), j);
/* */
/* 359 */ if (i != 0)
/* 360 */ paramPixMap.unlock();
/* 361 */ QDException.checkError(k);
/* */ }
/* */
/* */ private Region(int paramInt) throws QTException {
/* 365 */ super(paramInt, null, false);
/* */ }
/* */
/* */ public int getSize()
/* */ {
/* 375 */ return super.getSize();
/* */ }
/* */
/* */ public QDRect getRgnBBox()
/* */ {
/* 382 */ if (QTSession.isCurrentOS(4)) {
/* 383 */ localObject = new QDRect();
/* 384 */ GetRegionBounds(_ID(), ((QDRect)localObject).getBytes());
/* 385 */ return localObject;
/* */ }
/* */
/* 388 */ Object localObject = new byte[8];
/* 389 */ getBytesAt(2, 8, (byte[])localObject, 0);
/* 390 */ return QDRect.fromArray((byte[])localObject, 8);
/* */ }
/* */
/* */ public QDRect getBounds()
/* */ {
/* 398 */ return getRgnBBox();
/* */ }
/* */
/* */ public void open(QDGraphics paramQDGraphics)
/* */ throws QDException
/* */ {
/* 408 */ if (paramQDGraphics == null)
/* 409 */ throw new QDException("Graphics must be specified for Open Region");
/* 410 */ if (this.recordingGraphics != null)
/* 411 */ close();
/* 412 */ this.recordingGraphics = paramQDGraphics;
/* 413 */ synchronized (QTNative.globalsLock) {
/* 414 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 415 */ GetGWorld(savedPort, savedDevice);
/* 416 */ SetGWorld(QTObject.ID(this.recordingGraphics), 0);
/* 417 */ OpenRgn();
/* 418 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 419 */ SetGWorld(savedPort[0], savedDevice[0]);
/* */ }
/* */ }
/* */
/* */ public void close()
/* */ throws QDException
/* */ {
/* 428 */ if (this.recordingGraphics != null) {
/* 429 */ synchronized (QTNative.globalsLock) {
/* 430 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 431 */ GetGWorld(savedPort, savedDevice);
/* 432 */ SetGWorld(QTObject.ID(this.recordingGraphics), 0);
/* 433 */ CloseRgn(_ID());
/* 434 */ if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/* 435 */ SetGWorld(savedPort[0], savedDevice[0]);
/* */ }
/* */ }
/* 438 */ this.recordingGraphics = null;
/* */ }
/* */
/* */ public void rect(QDRect paramQDRect)
/* */ {
/* 448 */ RectRgn(_ID(), paramQDRect.getRect());
/* */ }
/* */
/* */ public Region copy()
/* */ throws QTException
/* */ {
/* 458 */ int i = NewRgn();
/* 459 */ if (i == 0) QDException.checkError(-108);
/* 460 */ if ((isMacOS) || (QTSession.isCurrentOS(4)))
/* 461 */ CopyRgn(_ID(), i);
/* */ else
/* 463 */ MacCopyRgn(_ID(), i);
/* 464 */ return new Region(i);
/* */ }
/* */
/* */ public Object clone()
/* */ {
/* */ try
/* */ {
/* 474 */ return copy();
/* */ } catch (QTException localQTException) {
/* 476 */ throw new QTRuntimeException(localQTException);
/* */ }
/* */ }
/* */
/* */ public void setEmpty()
/* */ {
/* 486 */ SetEmptyRgn(_ID());
/* */ }
/* */
/* */ public void setRect(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
/* */ {
/* 501 */ int i = paramInt2 + paramInt4;
/* 502 */ int j = paramInt1 + paramInt3;
/* 503 */ if ((isMacOS) || (QTSession.isCurrentOS(4)))
/* 504 */ SetRectRgn(_ID(), (short)paramInt1, (short)paramInt2, (short)j, (short)i);
/* */ else
/* 506 */ MacSetRectRgn(_ID(), (short)paramInt1, (short)paramInt2, (short)j, (short)i);
/* */ }
/* */
/* */ public void offset(int paramInt1, int paramInt2)
/* */ {
/* 517 */ if ((isMacOS) || (QTSession.isCurrentOS(4)))
/* 518 */ OffsetRgn(_ID(), (short)paramInt1, (short)paramInt2);
/* */ else
/* 520 */ MacOffsetRgn(_ID(), (short)paramInt1, (short)paramInt2);
/* */ }
/* */
/* */ public void inset(int paramInt1, int paramInt2)
/* */ {
/* 530 */ InsetRgn(_ID(), (short)paramInt1, (short)paramInt2);
/* */ }
/* */
/* */ public Region sect(Region paramRegion)
/* */ throws QTException
/* */ {
/* 541 */ int i = NewRgn();
/* 542 */ if (i == 0) QDException.checkError(-108);
/* 543 */ SectRgn(_ID(), QTObject.ID(paramRegion), i);
/* 544 */ return new Region(i);
/* */ }
/* */
/* */ public Region sect(QDRect paramQDRect)
/* */ throws QTException
/* */ {
/* 556 */ int i = NewRgn();
/* 557 */ if (i == 0) QDException.checkError(-108);
/* 558 */ RectRgn(i, paramQDRect.getRect());
/* 559 */ int j = NewRgn();
/* 560 */ if (j == 0) {
/* 561 */ DisposeRgn(i);
/* 562 */ QDException.checkError(-108);
/* */ }
/* 564 */ SectRgn(_ID(), i, j);
/* 565 */ DisposeRgn(i);
/* 566 */ return new Region(j);
/* */ }
/* */
/* */ public Region union(Region paramRegion)
/* */ throws QTException
/* */ {
/* 578 */ int i = NewRgn();
/* 579 */ if (i == 0) QDException.checkError(-108);
/* 580 */ if ((isMacOS) || (QTSession.isCurrentOS(4)))
/* 581 */ UnionRgn(_ID(), QTObject.ID(paramRegion), i);
/* */ else
/* 583 */ MacUnionRgn(_ID(), QTObject.ID(paramRegion), i);
/* 584 */ return new Region(i);
/* */ }
/* */
/* */ public Region union(QDRect paramQDRect)
/* */ throws QTException
/* */ {
/* 596 */ int i = NewRgn();
/* 597 */ if (i == 0) QDException.checkError(-108);
/* 598 */ RectRgn(i, paramQDRect.getRect());
/* 599 */ int j = NewRgn();
/* 600 */ if (j == 0) QDException.checkError(-108);
/* 601 */ if ((isMacOS) || (QTSession.isCurrentOS(4)))
/* 602 */ UnionRgn(_ID(), i, j);
/* */ else
/* 604 */ MacUnionRgn(_ID(), i, j);
/* 605 */ return new Region(j);
/* */ }
/* */
/* */ public Region diff(Region paramRegion)
/* */ throws QTException
/* */ {
/* 616 */ int i = NewRgn();
/* 617 */ if (i == 0) QDException.checkError(-108);
/* 618 */ DiffRgn(_ID(), QTObject.ID(paramRegion), i);
/* 619 */ return new Region(i);
/* */ }
/* */
/* */ public Region xor(Region paramRegion)
/* */ throws QTException
/* */ {
/* 631 */ int i = NewRgn();
/* 632 */ if (i == 0) QDException.checkError(-108);
/* 633 */ if ((isMacOS) || (QTSession.isCurrentOS(4)))
/* 634 */ XorRgn(_ID(), QTObject.ID(paramRegion), i);
/* */ else
/* 636 */ MacXorRgn(_ID(), QTObject.ID(paramRegion), i);
/* 637 */ return new Region(i);
/* */ }
/* */
/* */ public boolean rectIn(QDRect paramQDRect)
/* */ {
/* 647 */ return RectInRgn(paramQDRect.getRect(), _ID()) != 0;
/* */ }
/* */
/* */ public boolean equalRgn(Region paramRegion)
/* */ {
/* 658 */ if ((isMacOS) || (QTSession.isCurrentOS(4))) {
/* 659 */ return EqualRgn(_ID(), QTObject.ID(paramRegion)) != 0;
/* */ }
/* 661 */ return MacEqualRgn(_ID(), QTObject.ID(paramRegion)) != 0;
/* */ }
/* */
/* */ public boolean empty()
/* */ {
/* 670 */ return EmptyRgn(_ID()) != 0;
/* */ }
/* */
/* */ public void map(QDRect paramQDRect1, QDRect paramQDRect2)
/* */ {
/* 680 */ MapRgn(_ID(), paramQDRect1.getRect(), paramQDRect2.getRect());
/* */ }
/* */
/* */ public boolean pointIn(QDPoint paramQDPoint)
/* */ {
/* 690 */ return PtInRgn(paramQDPoint.getPoint(), _ID()) != 0;
/* */ }
/* */
/* */ public String toString()
/* */ {
/* 711 */ return super.toString() + "[rgnBBox=" + getRgnBBox() + "]";
/* */ }
/* */
/* */ private static native void SetGWorld(int paramInt1, int paramInt2);
/* */
/* */ private static native void GetGWorld(int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native void OpenRgn();
/* */
/* */ private static native void CloseRgn(int paramInt);
/* */
/* */ private static native int NewRgn();
/* */
/* */ private static native short MemError();
/* */
/* */ private static native void SectRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int GraphicsImportGetClip(int paramInt, int[] paramArrayOfInt);
/* */
/* */ private static native int GraphicsImportGetDefaultClip(int paramInt, int[] paramArrayOfInt);
/* */
/* */ private static native int GetMovieDisplayClipRgn(int paramInt);
/* */
/* */ private static native short GetMoviesError();
/* */
/* */ private static native int GetMovieDisplayBoundsRgn(int paramInt);
/* */
/* */ private static native int GetMovieClipRgn(int paramInt);
/* */
/* */ private static native int GetMovieBoundsRgn(int paramInt);
/* */
/* */ private static native int GetMovieSegmentDisplayBoundsRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int MCGetControllerBoundsRgn(int paramInt);
/* */
/* */ private static native int MCGetWindowRgn(int paramInt1, int paramInt2);
/* */
/* */ private static native int MCGetClip(int paramInt, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native int MCDrawBadge(int paramInt1, int paramInt2, int[] paramArrayOfInt);
/* */
/* */ private static native int GetTrackClipRgn(int paramInt);
/* */
/* */ private static native int GetTrackDisplayBoundsRgn(int paramInt);
/* */
/* */ private static native int GetTrackMovieBoundsRgn(int paramInt);
/* */
/* */ private static native int GetTrackBoundsRgn(int paramInt);
/* */
/* */ private static native int GetTrackSegmentDisplayBoundsRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int SGGetChannelClip(int paramInt, int[] paramArrayOfInt);
/* */
/* */ private static native short BitMapToRegion(int paramInt1, int paramInt2);
/* */
/* */ private static native void RectRgn(int paramInt, byte[] paramArrayOfByte);
/* */
/* */ private static native void MacCopyRgn(int paramInt1, int paramInt2);
/* */
/* */ private static native void SetEmptyRgn(int paramInt);
/* */
/* */ private static native void MacSetRectRgn(int paramInt, short paramShort1, short paramShort2, short paramShort3, short paramShort4);
/* */
/* */ private static native void MacOffsetRgn(int paramInt, short paramShort1, short paramShort2);
/* */
/* */ private static native void InsetRgn(int paramInt, short paramShort1, short paramShort2);
/* */
/* */ private static native void DisposeRgn(int paramInt);
/* */
/* */ private static native void MacUnionRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native void DiffRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native void MacXorRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native byte RectInRgn(byte[] paramArrayOfByte, int paramInt);
/* */
/* */ private static native byte MacEqualRgn(int paramInt1, int paramInt2);
/* */
/* */ private static native byte EmptyRgn(int paramInt);
/* */
/* */ private static native void MapRgn(int paramInt, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2);
/* */
/* */ private static native byte PtInRgn(int paramInt1, int paramInt2);
/* */
/* */ private static native int getIntFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native void PaintRgn(int paramInt);
/* */
/* */ private static native void CopyRgn(int paramInt1, int paramInt2);
/* */
/* */ private static native void SetRectRgn(int paramInt, short paramShort1, short paramShort2, short paramShort3, short paramShort4);
/* */
/* */ private static native void OffsetRgn(int paramInt, short paramShort1, short paramShort2);
/* */
/* */ private static native void UnionRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native void XorRgn(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native byte EqualRgn(int paramInt1, int paramInt2);
/* */
/* */ private static native byte GetRegionBounds(int paramInt, byte[] paramArrayOfByte);
/* */
/* */ private static native byte IsRegionRectangular(int paramInt);
/* */
/* */ private static native short QTSPresGetClip(int paramInt1, int paramInt2, int[] paramArrayOfInt);
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.qd.Region
* JD-Core Version: 0.6.2
*/