:Evaluate:BeginPackage["QT`"] :Evaluate:QTGet::usage = "QTGet[] return the {x,y} where you click the mouse on QuickTime movie window. If file is not opened, 0 will return." :Evaluate:QTPix::usage = "QTPix[{x1,y1},{x2,y2}] return the graphic object of RasterArray of the area {x1,y1},{x2,y2}. QtPix[{x,y}] return the single RasterArray of {x,y}." :Evaluate:QTStep::usage = "QTStep[n] move film n steps.\n If n < 0, film will move backward.\n If n == 0, film will move to start." :Evaluate:QTImage::usage = "QTImage[{x1,y1},{x2,y2}] return the Pixcel's list of RGB value of the area {x1,y1},{x2,y2}.\n QTImage[{x,y}] return the Pixcel RGB value of {x,y} point." :Evaluate:Image2Pix::usage = "Image2Pix[image] convert list of RGB value to RasterArray format." :Evaluate:Pix2Image::usage = "Pix2Image[pix] convert RasterArray Graphics object format to list of RGB value format." :Evaluate:Begin["`Private`"] :Evaluate: QTPix[{x1_,y1_},{x2_,y2_}] := Module[{h=Abs[x1-x2]+1, v=Abs[y1-y2]+1}, Graphics[ RasterArray[ Partition[ Map[(#/.List->RGBColor)&, Partition[ Map[(If[#<0,#+65537,#]/65536.0)&, GetPix[{Min[x1,x2],Max[y1,y2]},h, v]], 3] ], h] ], AspectRatio->v/h]] :Evaluate: QTImage[{x1_,y1_},{x2_,y2_}] := Module[{h=Abs[x1-x2]+1, v=Abs[y1-y2]+1}, Partition[ Partition[ Map[(If[#<0,#+65537,#]/65536.0)&, GetPix[{Min[x1,x2],Max[y1,y2]},h, v]], 3], h]] :Evaluate: QTImage[{x_,y_}] := QTImage[{x,y},{x,y}] :Evaluate: QTPix[{x_,y_}] := QTPix[{x,y},{x,y}] :Evaluate: Image2Pix[image_] := Module[{d=Dimensions[image]}, Graphics[RasterArray[ Partition[ Map[(#/.List->RGBColor)&, Partition[Flatten[image],3] ], d[[2]]] ], AspectRatio->d[[1]]/d[[2]]]] :Evaluate: Pix2Image[pix_] := pix[[1,1]]/.RGBColor->List :Begin: :Function: get_mouse :Pattern: QTGet[] :Arguments: {} :ArgumentTypes: {} :ReturnType: Manual :End: :Begin: :Function: get_pixrect :Pattern: GetPix[{x_,y_}, h_, v_] :Arguments: {x, y, h, v} :ArgumentTypes: {Integer,Integer,Integer,Integer} :ReturnType: Manual :End: :Begin: :Function: dostep :Pattern: QTStep[n_] :Arguments: {n} :ArgumentTypes: {Integer} :ReturnType: Integer :End: :Evaluate:End[] :Evaluate:EndPackage[]