?? truesize.cpp
字號:
// resizeType = 2;
//
*resizeType = _mxarray1_;
//
// else
//
} else {
//
// % Yes, one image and one colorbar
// resizeType = 3;
//
*resizeType = _mxarray2_;
//
// end
//
}
//
// end
//
}
//
// end
//
}
//
//
//
// %--------------------------------------------
// % Subfunction Resize1
// %--------------------------------------------
//
return_:
mwValidateOutput(axHandle, 1, nargout_, "axHandle", "truesize/ParseInputs");
mwValidateOutput(
*imHandle, 2, nargout_, "imHandle", "truesize/ParseInputs");
mwValidateOutput(
*colorbarHandle, 3, nargout_, "colorbarHandle", "truesize/ParseInputs");
mwValidateOutput(*imSize, 4, nargout_, "imSize", "truesize/ParseInputs");
mwValidateOutput(
*resizeType, 5, nargout_, "resizeType", "truesize/ParseInputs");
mwValidateOutput(*msg, 6, nargout_, "msg", "truesize/ParseInputs");
return axHandle;
}
//
// The function "Mtruesize_Resize1" is the implementation version of the
// "truesize/Resize1" M-function from file
// "e:\matlab6.5\toolbox\images\images\truesize.m" (lines 176-316). 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 Resize1(axHandle, imHandle, imSize)
//
static void Mtruesize_Resize1(mwArray axHandle,
mwArray imHandle,
mwArray imSize) {
mwLocalFunctionTable save_local_function_table_
= &_local_function_table_truesize;
mwArray message = mwArray::UNDEFINED;
mwArray deltaY = mwArray::UNDEFINED;
mwArray deltaX = mwArray::UNDEFINED;
mwArray newFigHeight = mwArray::UNDEFINED;
mwArray newFigWidth = mwArray::UNDEFINED;
mwArray gutterHeight = mwArray::UNDEFINED;
mwArray gutterWidth = mwArray::UNDEFINED;
mwArray nonzeroGutters = mwArray::UNDEFINED;
mwArray defAxesPos = mwArray::UNDEFINED;
mwArray done = mwArray::UNDEFINED;
mwArray scale = mwArray::UNDEFINED;
mwArray screenHeight = mwArray::UNDEFINED;
mwArray screenWidth = mwArray::UNDEFINED;
mwArray screenSize = mwArray::UNDEFINED;
mwArray gutterTop = mwArray::UNDEFINED;
mwArray gutterBottom = mwArray::UNDEFINED;
mwArray gutterRight = mwArray::UNDEFINED;
mwArray gutterLeft = mwArray::UNDEFINED;
mwArray figPos = mwArray::UNDEFINED;
mwArray minFigHeight = mwArray::UNDEFINED;
mwArray minFigWidth = mwArray::UNDEFINED;
mwArray figTopBorder = mwArray::UNDEFINED;
mwArray figBottomBorder = mwArray::UNDEFINED;
mwArray figRightBorder = mwArray::UNDEFINED;
mwArray figLeftBorder = mwArray::UNDEFINED;
mwArray rootUnits = mwArray::UNDEFINED;
mwArray figUnits = mwArray::UNDEFINED;
mwArray figHandle = mwArray::UNDEFINED;
mwArray axPos = mwArray::UNDEFINED;
mwArray ans = mwArray::UNDEFINED;
mwArray axUnits = mwArray::UNDEFINED;
mwArray imageHeight = mwArray::UNDEFINED;
mwArray imageWidth = mwArray::UNDEFINED;
//
// % Resize figure containing a single axes
// % object with a single image.
//
// if (isempty(imSize))
//
if (tobool(isempty(mwVa(imSize, "imSize")))) {
//
// % How big is the image?
// imageWidth = size(get(imHandle, 'CData'), 2);
//
imageWidth
= size(
mwValueVarargout(),
Nget(1, mwVarargin(mwVa(imHandle, "imHandle"), _mxarray51_)),
_mxarray1_);
//
// imageHeight = size(get(imHandle, 'CData'), 1);
//
imageHeight
= size(
mwValueVarargout(),
Nget(1, mwVarargin(mwVa(imHandle, "imHandle"), _mxarray51_)),
_mxarray0_);
//
// else
//
} else {
//
// imageWidth = imSize(2);
//
imageWidth = mclIntArrayRef(mwVa(imSize, "imSize"), 2);
//
// imageHeight = imSize(1);
//
imageHeight = mclIntArrayRef(mwVa(imSize, "imSize"), 1);
//
// end
//
}
//
//
// if (imageWidth * imageHeight == 0)
//
if (mclEqBool(
mwVv(imageWidth, "imageWidth") * mwVv(imageHeight, "imageHeight"),
_mxarray53_)) {
//
// % Don't try to handle the degenerate case.
// return;
//
goto return_;
//
// end
//
}
//
//
// axUnits = get(axHandle, 'Units');
//
axUnits = Nget(1, mwVarargin(mwVa(axHandle, "axHandle"), _mxarray54_));
//
// set(axHandle, 'Units', 'pixels');
//
ans.EqAns(
Nset(
0, mwVarargin(mwVa(axHandle, "axHandle"), _mxarray54_, _mxarray56_)));
//
// axPos = get(axHandle, 'Position');
//
axPos = Nget(1, mwVarargin(mwVa(axHandle, "axHandle"), _mxarray58_));
//
//
// figHandle = get(axHandle, 'Parent');
//
figHandle = Nget(1, mwVarargin(mwVa(axHandle, "axHandle"), _mxarray19_));
//
// figUnits = get(figHandle, 'Units');
//
figUnits = Nget(1, mwVarargin(mwVv(figHandle, "figHandle"), _mxarray54_));
//
// rootUnits = get(0, 'Units');
//
rootUnits = Nget(1, mwVarargin(_mxarray53_, _mxarray54_));
//
// set(figHandle, 'Units', 'pixels');
//
ans.EqAns(
Nset(
0, mwVarargin(mwVv(figHandle, "figHandle"), _mxarray54_, _mxarray56_)));
//
// set(0, 'Units', 'pixels');
//
ans.EqAns(Nset(0, mwVarargin(_mxarray53_, _mxarray54_, _mxarray56_)));
//
//
// figLeftBorder = 10; % assume left figure decorations are 10 pixels
//
figLeftBorder = _mxarray60_;
//
// figRightBorder = 10;
//
figRightBorder = _mxarray60_;
//
// figBottomBorder = 10;
//
figBottomBorder = _mxarray60_;
//
// figTopBorder = 100;
//
figTopBorder = _mxarray61_;
//
//
// minFigWidth = 128; % don't try to display a figure smaller than this.
//
minFigWidth = _mxarray62_;
//
// minFigHeight = 128;
//
minFigHeight = _mxarray62_;
//
//
// % What are the gutter sizes?
// figPos = get(figHandle, 'Position');
//
figPos = Nget(1, mwVarargin(mwVv(figHandle, "figHandle"), _mxarray58_));
//
// gutterLeft = max(axPos(1) - 1, 0);
//
gutterLeft
= max(mclIntArrayRef(mwVv(axPos, "axPos"), 1) - _mxarray0_, _mxarray53_);
//
// gutterRight = max(figPos(3) - (axPos(1) + axPos(3)) + 1, 0);
//
gutterRight
= max(
mclIntArrayRef(mwVv(figPos, "figPos"), 3)
- (mclIntArrayRef(mwVv(axPos, "axPos"), 1)
+ mclIntArrayRef(mwVv(axPos, "axPos"), 3))
+ _mxarray0_,
_mxarray53_);
//
// gutterBottom = max(axPos(2) - 1, 0);
//
gutterBottom
= max(mclIntArrayRef(mwVv(axPos, "axPos"), 2) - _mxarray0_, _mxarray53_);
//
// gutterTop = max(figPos(4) - (axPos(2) + axPos(4)) + 1, 0);
//
gutterTop
= max(
mclIntArrayRef(mwVv(figPos, "figPos"), 4)
- (mclIntArrayRef(mwVv(axPos, "axPos"), 2)
+ mclIntArrayRef(mwVv(axPos, "axPos"), 4))
+ _mxarray0_,
_mxarray53_);
//
//
// % What are the screen dimensions
// screenSize = get(0, 'ScreenSize');
//
screenSize = Nget(1, mwVarargin(_mxarray53_, _mxarray63_));
//
// screenWidth = screenSize(3);
//
screenWidth = mclIntArrayRef(mwVv(screenSize, "screenSize"), 3);
//
// screenHeight = screenSize(4);
//
screenHeight = mclIntArrayRef(mwVv(screenSize, "screenSize"), 4);
//
// if ((screenWidth <= 1) | (screenHeight <= 1))
//
{
mwArray a_ = mwVv(screenWidth, "screenWidth") <= _mxarray0_;
if (tobool(a_)
|| tobool(a_ | mwVv(screenHeight, "screenHeight") <= _mxarray0_)) {
//
// screenWidth = Inf;
//
screenWidth = _mxarray65_;
//
// screenHeight = Inf;
//
screenHeight = _mxarray65_;
} else {
}
//
// end
//
}
//
//
// scale = 100;
//
scale = _mxarray61_;
//
// done = 0;
//
done = _mxarray53_;
//
// defAxesPos = get(0,'DefaultAxesPosition');
//
defAxesPos = Nget(1, mwVarargin(_mxarray53_, _mxarray66_));
//
// nonzeroGutters = (gutterLeft > 0);
//
nonzeroGutters = mwVv(gutterLeft, "gutterLeft") > _mxarray53_;
//
// while (~done)
//
while (mclNotBool(mwVv(done, "done"))) {
//
// if (nonzeroGutters)
//
if (tobool(mwVv(nonzeroGutters, "nonzeroGutters"))) {
//
// gutterWidth = round((1 - defAxesPos(3)) * imageWidth / defAxesPos(3));
//
gutterWidth
= round(
(_mxarray0_
- mclIntArrayRef(mwVv(defAxesPos, "defAxesPos"), 3))
* mwVv(imageWidth, "imageWidth")
/ mclIntArrayRef(mwVv(defAxesPos, "defAxesPos"), 3));
//
// gutterHeight = round((1 - defAxesPos(4)) * imageHeight / defAxesPos(4));
//
gutterHeight
= round(
(_mxarray0_
- mclIntArrayRef(mwVv(defAxesPos, "defAxesPos"), 4))
* mwVv(imageHeight, "imageHeight")
/ mclIntArrayRef(mwVv(defAxesPos, "defAxesPos"), 4));
//
// newFigWidth = imageWidth + gutterWidth;
//
newFigWidth
= mwVv(imageWidth, "imageWidth")
+ mwVv(gutterWidth, "gutterWidth");
//
// newFigHeight = imageHeight + gutterHeight;
//
newFigHeight
= mwVv(imageHeight, "imageHeight")
+ mwVv(gutterHeight, "gutterHeight");
//
// else
//
} else {
//
// newFigWidth = imageWidth;
//
newFigWidth = mwVv(imageWidth, "imageWidth");
//
// newFigHeight = imageHeight;
//
newFigHeight = mwVv(imageHeight, "imageHeight");
//
// end
//
}
//
// if (((newFigWidth + figLeftBorder + figRightBorder) > screenWidth) | ...
//
{
mwArray a_
= mwVv(newFigWidth, "newFigWidth")
+ mwVv(figLeftBorder, "figLeftBorder")
+ mwVv(figRightBorder, "figRightBorder")
> mwVv(screenWidth, "screenWidth");
if (tobool(a_)
|| tobool(
a_
| mwVv(newFigHeight, "newFigHeight")
+ mwVv(figBottomBorder, "figBottomBorder")
+ mwVv(figTopBorder, "figTopBorder")
> mwVv(screenHeight, "screenHeight"))) {
//
// ((newFigHeight + figBottomBorder + figTopBorder) > screenHeight))
// scale = 3 * scale / 4;
//
scale = _mxarray2_ * mwVv(scale, "scale") / _mxarray68_;
//
// imageWidth = round(imageWidth * scale / 100);
//
imageWidth
= round(
mwVv(imageWidth, "imageWidth") * mwVv(scale, "scale")
/ _mxarray61_);
//
// imageHeight = round(imageHeight * scale / 100);
//
imageHeight
= round(
mwVv(imageHeight, "imageHeight") * mwVv(scale, "scale")
/ _mxarray61_);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -