📄 flames.c
字号:
}
for (; i < 2; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 2, mprhs[0], mprhs[1]);
Mflames_animate_it(mprhs[0], mprhs[1]);
mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
}
/*
* The function "Mflames" is the implementation version of the "flames"
* M-function from file "c:\matlab6p5\matlab编译器\flames\flames.m" (lines
* 1-40). It contains the actual compiled code for that M-function. It is a
* static function and must only be called from one of the interface functions,
* appearing below.
*/
/*
* function flames
*/
static void Mflames(void) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_flames);
mxArray * theSize = NULL;
mxArray * theImage = NULL;
mxArray * x = NULL;
mxArray * b = NULL;
mxArray * a = NULL;
mxArray * X = NULL;
mxArray * menu2 = NULL;
mxArray * menu1 = NULL;
mxArray * ans = NULL;
/*
* %FLAMES creates an animation of the MathWorks logo rising through flames
*
* % Copyright (c) 1984-2000 by The MathWorks, Inc.
* % $Revision: 1.4 $
*
* figure('Menubar','None','NumberTitle','Off','Name','Demo','UserData',1);
*/
mclAssignAns(
&ans,
mlfNFigure(
0,
_mxarray0_,
_mxarray2_,
_mxarray4_,
_mxarray6_,
_mxarray8_,
_mxarray10_,
_mxarray12_,
_mxarray14_,
NULL));
/*
* set(gcf,'DoubleBuffer','On','Renderer','Painters','Resize','Off');
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfGcf(),
_mxarray15_,
_mxarray17_,
_mxarray19_,
_mxarray21_,
_mxarray23_,
_mxarray6_,
NULL));
/*
* menu1 = uimenu('Label','&File');
*/
mlfAssign(&menu1, mlfNUimenu(1, _mxarray25_, _mxarray27_, NULL));
/*
* menu2 = uimenu(menu1,'Label','E&xit');
*/
mlfAssign(
&menu2,
mlfNUimenu(1, mclVv(menu1, "menu1"), _mxarray25_, _mxarray29_, NULL));
/*
*
* %Only function calls are allowed in the C/C++ Graphics Library callbacks
* set(menu2,'Callback','set(gcf,''UserData'','''');');
*/
mclAssignAns(
&ans, mlfNSet(0, mclVv(menu2, "menu2"), _mxarray31_, _mxarray33_, NULL));
/*
*
* X=[];
*/
mlfAssign(&X, _mxarray35_);
/*
* load flames.mat X
*/
mlfLoad(_mxarray36_, "X", &X, NULL);
/*
*
* [a,b] = size(X);
*/
mlfSize(mlfVarargout(&a, &b, NULL), mclVv(X, "X"), NULL);
/*
* x = ones(a,b)*.01;
*/
mlfAssign(
&x, mclMtimes(mlfOnes(mclVv(a, "a"), mclVv(b, "b"), NULL), _mxarray38_));
/*
* x(end,:) = 201;
*/
mclArrayAssign2(
&x,
_mxarray39_,
mlfEnd(mclVv(x, "x"), _mxarray14_, _mxarray40_),
mlfCreateColonIndex());
/*
* x(end-1,:) = 140;
*/
mclArrayAssign2(
&x,
_mxarray41_,
mclMinus(mlfEnd(mclVv(x, "x"), _mxarray14_, _mxarray40_), _mxarray14_),
mlfCreateColonIndex());
/*
* x(end-2,:) = 60;
*/
mclArrayAssign2(
&x,
_mxarray42_,
mclMinus(mlfEnd(mclVv(x, "x"), _mxarray14_, _mxarray40_), _mxarray40_),
mlfCreateColonIndex());
/*
* theImage = image(x);
*/
mlfAssign(&theImage, mlfNImage(1, mclVv(x, "x"), NULL));
/*
* set(theImage,'CDataMapping','Direct');
*/
mclAssignAns(
&ans,
mlfNSet(0, mclVv(theImage, "theImage"), _mxarray43_, _mxarray45_, NULL));
/*
* colormap([hot(200);[0 0 0]]);
*/
mclAssignAns(
&ans,
mlfNColormap(
0, mlfVertcat(mlfHot(_mxarray47_), _mxarray48_, NULL), NULL));
/*
* axis off;
*/
mclAssignAns(&ans, mlfNAxis(0, NULL, NULL, _mxarray50_, NULL));
/*
* axis image;
*/
mclAssignAns(&ans, mlfNAxis(0, NULL, NULL, _mxarray52_, NULL));
/*
* set(gca,'YLim',[1 size(x,1)-2]);
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfGca(NULL),
_mxarray54_,
mlfHorzcat(
_mxarray14_,
mclMinus(
mlfSize(mclValueVarargout(), mclVv(x, "x"), _mxarray14_),
_mxarray40_),
NULL),
NULL));
/*
* set(gca,'Units','Pixels','Position',[15 15 1.5*a+30 1.5*b+30]);
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfGca(NULL),
_mxarray56_,
_mxarray58_,
_mxarray60_,
mlfHorzcat(
_mxarray62_,
_mxarray62_,
mclPlus(mclMtimes(_mxarray63_, mclVv(a, "a")), _mxarray64_),
mclPlus(mclMtimes(_mxarray63_, mclVv(b, "b")), _mxarray64_),
NULL),
NULL));
/*
* theSize = get(0,'ScreenSize');
*/
mlfAssign(&theSize, mlfNGet(1, _mxarray65_, _mxarray66_, NULL));
/*
* set(gcf,'Units','Pixels','Position',...
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfGcf(),
_mxarray56_,
_mxarray58_,
_mxarray60_,
mlfHorzcat(
mclMrdivide(
mclMinus(
mclIntArrayRef1(mclVv(theSize, "theSize"), 3),
mclPlus(mclMtimes(_mxarray63_, mclVv(a, "a")), _mxarray42_)),
_mxarray40_),
mclMrdivide(
mclMinus(
mclIntArrayRef1(mclVv(theSize, "theSize"), 4),
mclPlus(mclMtimes(_mxarray63_, mclVv(b, "b")), _mxarray42_)),
_mxarray40_),
mclPlus(mclMtimes(_mxarray63_, mclVv(a, "a")), _mxarray42_),
mclPlus(mclMtimes(_mxarray63_, mclVv(b, "b")), _mxarray42_),
NULL),
_mxarray68_,
_mxarray48_,
NULL));
/*
* [(theSize(3)-(1.5*a+60))/2 (theSize(4)-(1.5*b+60))/2 (1.5*a+60) (1.5*b+60)],...
* 'Color',[0 0 0]);
* animate_it(theImage,X);
*/
mlfFlames_animate_it(mclVv(theImage, "theImage"), mclVv(X, "X"));
/*
*
* %All figures must be closed for a C/C++ Graphics Library
* %application to exit
* close all;
*/
mclAssignAns(&ans, mlfNClose(0, _mxarray70_, NULL));
mxDestroyArray(ans);
mxDestroyArray(menu1);
mxDestroyArray(menu2);
mxDestroyArray(X);
mxDestroyArray(a);
mxDestroyArray(b);
mxDestroyArray(x);
mxDestroyArray(theImage);
mxDestroyArray(theSize);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
/*
*
*/
}
/*
* The function "Mflames_animate_it" is the implementation version of the
* "flames/animate_it" M-function from file
* "c:\matlab6p5\matlab编译器\flames\flames.m" (lines 40-94). It contains the
* actual compiled code for that M-function. It is a static function and must
* only be called from one of the interface functions, appearing below.
*/
/*
* function animate_it(theImage,theLogo);
*/
static void Mflames_animate_it(mxArray * theImage, mxArray * theLogo) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_flames);
mxArray * ans = NULL;
mxArray * theTemp = NULL;
mxArray * upAndLeftAndRight = NULL;
mxArray * movedUp2 = NULL;
mxArray * movedUp = NULL;
mxArray * i = NULL;
mxArray * theLogical = NULL;
mxArray * theRand = NULL;
mxArray * theOnes = NULL;
mxArray * theZeros2 = NULL;
mxArray * theZeros = NULL;
mxArray * b = NULL;
mxArray * a = NULL;
mxArray * X = NULL;
mclCopyArray(&theImage);
mclCopyArray(&theLogo);
/*
* %The algorithm used takes the last image used and based on a pixel-by-pixel
* %basis deterime the next image. It uses the following rule for pixel X: that
* %the new pixel value is based on the old value plus the two pixels below and
* %the two pixels two down and one to the right and left. Add in a bit of
* %randomness, normalize the matrix to one, and where ever the picture
* %is 1, set that pixel to one.
*
* X = get(theImage,'CData');
*/
mlfAssign(&X, mlfNGet(1, mclVa(theImage, "theImage"), _mxarray72_, NULL));
/*
*
* [a,b] = size(X);
*/
mlfSize(mlfVarargout(&a, &b, NULL), mclVv(X, "X"), NULL);
/*
*
* %Pre-allocation of matricies speed up loops
* theZeros = zeros(a,1);
*/
mlfAssign(&theZeros, mlfZeros(mclVv(a, "a"), _mxarray14_, NULL));
/*
* theZeros2 = zeros(1,b);
*/
mlfAssign(&theZeros2, mlfZeros(_mxarray14_, mclVv(b, "b"), NULL));
/*
* theOnes = ones(1,b);
*/
mlfAssign(&theOnes, mlfOnes(_mxarray14_, mclVv(b, "b"), NULL));
/*
* theRand = rand(a,b);
*/
mlfAssign(&theRand, mlfNRand(1, mclVv(a, "a"), mclVv(b, "b"), NULL));
/*
* theLogical = [theLogo(1:end,:)];
*/
mlfAssign(
&theLogical,
mclArrayRef2(
mclVa(theLogo, "theLogo"),
mlfColon(
_mxarray14_,
mlfEnd(mclVa(theLogo, "theLogo"), _mxarray14_, _mxarray40_),
NULL),
mlfCreateColonIndex()));
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -