Image: remove trailing whitespace
This commit is contained in:
@@ -292,13 +292,13 @@ int ImageBase::pointTo(void* pSrcPixelData, unsigned long width, unsigned long h
|
||||
}
|
||||
|
||||
// Gets the value of a sample at the given pixel position
|
||||
// Returns 0 for valid value or -1 if coordinates or sample index are out of range or
|
||||
// Returns 0 for valid value or -1 if coordinates or sample index are out of range or
|
||||
// if there is no image data
|
||||
int ImageBase::getSample(int x, int y, unsigned short sampleIndex, double &value)
|
||||
{
|
||||
if ((!_pPixelData) ||
|
||||
if ((!_pPixelData) ||
|
||||
(sampleIndex >= _numSamples) ||
|
||||
(x < 0) || (x >= (int)_width) ||
|
||||
(x < 0) || (x >= (int)_width) ||
|
||||
(y < 0) || (y >= (int)_height))
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
unsigned short getNumSamples() const { return _numSamples; }
|
||||
unsigned short getNumBitsPerSample() const { return _numBitsPerSample; }
|
||||
unsigned short getNumBytesPerPixel() const { return _numBytesPerPixel; }
|
||||
|
||||
|
||||
virtual void clear();
|
||||
virtual int createCopy(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample);
|
||||
virtual int pointTo(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample, bool takeOwnership);
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -46,4 +46,3 @@
|
||||
|
||||
#endif // _PreComp_
|
||||
#endif
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ ImageView::ImageView(QWidget* parent)
|
||||
setMouseTracking(true);
|
||||
|
||||
// enable the mouse events
|
||||
_mouseEventsEnabled = true;
|
||||
_mouseEventsEnabled = true;
|
||||
|
||||
// Create the default status bar for displaying messages
|
||||
enableStatusBar(true);
|
||||
@@ -203,7 +203,7 @@ void ImageView::showOriginalColors()
|
||||
// Create a color map
|
||||
// (All red entries come first, then green, then blue, then alpha)
|
||||
// returns 0 for OK, -1 for memory allocation error
|
||||
// numRequestedEntries ... requested number of map entries (used if not greater than system maximum or
|
||||
// numRequestedEntries ... requested number of map entries (used if not greater than system maximum or
|
||||
// if not greater than the maximum number of intensity values in the current image).
|
||||
// Pass zero to use the maximum possible. Always check the actual number of entries
|
||||
// created using getNumColorMapEntries() after a call to this method.
|
||||
@@ -532,8 +532,8 @@ QString ImageView::createStatusBarText()
|
||||
|
||||
// Create text for status bar
|
||||
QString txt;
|
||||
if ((colorFormat == IB_CF_GREY8) ||
|
||||
(colorFormat == IB_CF_GREY16) ||
|
||||
if ((colorFormat == IB_CF_GREY8) ||
|
||||
(colorFormat == IB_CF_GREY16) ||
|
||||
(colorFormat == IB_CF_GREY32))
|
||||
{
|
||||
double grey_value;
|
||||
@@ -546,7 +546,7 @@ QString ImageView::createStatusBarText()
|
||||
txt = QString::fromLatin1("x,y = %1 | %2 = %3")
|
||||
.arg(tr("outside image"), tr("zoom")).arg(zoomFactor,0,'f',1);
|
||||
}
|
||||
else if ((colorFormat == IB_CF_RGB24) ||
|
||||
else if ((colorFormat == IB_CF_RGB24) ||
|
||||
(colorFormat == IB_CF_RGB48))
|
||||
{
|
||||
double red, green, blue;
|
||||
@@ -561,7 +561,7 @@ QString ImageView::createStatusBarText()
|
||||
.arg((int)red).arg((int)green).arg((int)blue)
|
||||
.arg(tr("zoom")).arg(zoomFactor,0,'f',1);
|
||||
}
|
||||
else if ((colorFormat == IB_CF_BGR24) ||
|
||||
else if ((colorFormat == IB_CF_BGR24) ||
|
||||
(colorFormat == IB_CF_BGR48))
|
||||
{
|
||||
double red, green, blue;
|
||||
@@ -576,7 +576,7 @@ QString ImageView::createStatusBarText()
|
||||
.arg((int)red).arg((int)green).arg((int)blue)
|
||||
.arg(tr("zoom")).arg(zoomFactor,0,'f',1);
|
||||
}
|
||||
else if ((colorFormat == IB_CF_RGBA32) ||
|
||||
else if ((colorFormat == IB_CF_RGBA32) ||
|
||||
(colorFormat == IB_CF_RGBA64))
|
||||
{
|
||||
double red, green, blue, alpha;
|
||||
@@ -592,7 +592,7 @@ QString ImageView::createStatusBarText()
|
||||
.arg((int)red).arg((int)green).arg((int)blue).arg((int)alpha)
|
||||
.arg(tr("zoom")).arg(zoomFactor,0,'f',1);
|
||||
}
|
||||
else if ((colorFormat == IB_CF_BGRA32) ||
|
||||
else if ((colorFormat == IB_CF_BGRA32) ||
|
||||
(colorFormat == IB_CF_BGRA64))
|
||||
{
|
||||
double red, green, blue, alpha;
|
||||
@@ -662,7 +662,7 @@ void ImageView::addSelect(int currX, int currY)
|
||||
}
|
||||
|
||||
// Draw any 2D graphics necessary
|
||||
// Use GLImageBox::ICToWC_X and ICToWC_Y methods to transform image coordinates into widget coordinates (which
|
||||
// Use GLImageBox::ICToWC_X and ICToWC_Y methods to transform image coordinates into widget coordinates (which
|
||||
// must be used by the OpenGL vertex commands).
|
||||
void ImageView::drawGraphics()
|
||||
{
|
||||
|
||||
@@ -195,7 +195,7 @@ void GLImageBox::paintGL()
|
||||
glPopAttrib();
|
||||
|
||||
// Double buffering is used so we need to swap the buffers
|
||||
// There is no need to explicitly call this function because it is
|
||||
// There is no need to explicitly call this function because it is
|
||||
// done automatically after each widget repaint, i.e. each time after paintGL() has been executed
|
||||
// swapBuffers();
|
||||
}
|
||||
@@ -206,7 +206,7 @@ void GLImageBox::drawImage()
|
||||
if (!_image.hasValidData())
|
||||
return;
|
||||
|
||||
// Gets the size of the displayed image area using the current display settings
|
||||
// Gets the size of the displayed image area using the current display settings
|
||||
// (in units of image pixels)
|
||||
int dx, dy;
|
||||
getDisplayedImageAreaSize(dx, dy);
|
||||
@@ -271,7 +271,7 @@ void GLImageBox::drawImage()
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the size of the displayed image area using the current display settings
|
||||
// Gets the size of the displayed image area using the current display settings
|
||||
// (in units of image pixels)
|
||||
void GLImageBox::getDisplayedImageAreaSize(int &dx, int &dy)
|
||||
{
|
||||
@@ -296,9 +296,9 @@ void GLImageBox::getDisplayedImageAreaSize(int &dx, int &dy)
|
||||
int itly = std::max<int>(_y0, 0);
|
||||
int ibrx = std::min<int>(brx, (int)(_image.getWidth()) - 1);
|
||||
int ibry = std::min<int>(bry, (int)(_image.getHeight()) - 1);
|
||||
if ((itlx >= (int)(_image.getWidth())) ||
|
||||
(itly >= (int)(_image.getHeight())) ||
|
||||
(ibrx < 0) ||
|
||||
if ((itlx >= (int)(_image.getWidth())) ||
|
||||
(itly >= (int)(_image.getHeight())) ||
|
||||
(ibrx < 0) ||
|
||||
(ibry < 0))
|
||||
{
|
||||
dx = 0;
|
||||
@@ -312,7 +312,7 @@ void GLImageBox::getDisplayedImageAreaSize(int &dx, int &dy)
|
||||
}
|
||||
|
||||
// Gets the value of an image sample at the given image pixel position
|
||||
// Returns 0 for valid value or -1 if coordinates or sample index are out of range or
|
||||
// Returns 0 for valid value or -1 if coordinates or sample index are out of range or
|
||||
// if there is no image data
|
||||
int GLImageBox::getImageSample(int x, int y, unsigned short sampleIndex, double &value)
|
||||
{
|
||||
@@ -473,7 +473,7 @@ void GLImageBox::setZoomFactor(double zoomFactor, bool useCentrePt, int ICx, int
|
||||
}
|
||||
}
|
||||
|
||||
// Stretch or shrink the image to fit the view (although the zoom factor is limited so a
|
||||
// Stretch or shrink the image to fit the view (although the zoom factor is limited so a
|
||||
// very small or very big image may not fit completely (depending on the size of the view)
|
||||
// This function redraws
|
||||
void GLImageBox::stretchToFit()
|
||||
@@ -485,7 +485,7 @@ void GLImageBox::stretchToFit()
|
||||
update();
|
||||
}
|
||||
|
||||
// Sets the settings needed to fit the image into the view (although the zoom factor is limited so a
|
||||
// Sets the settings needed to fit the image into the view (although the zoom factor is limited so a
|
||||
// very small or very big image may not fit completely (depending on the size of the view)
|
||||
// This function does not redraw (call redraw afterwards)
|
||||
void GLImageBox::setToFit()
|
||||
@@ -507,7 +507,7 @@ void GLImageBox::setToFit()
|
||||
}
|
||||
|
||||
// Sets the normal viewing position and zoom = 1
|
||||
// If the image is smaller than the widget then the image is centred
|
||||
// If the image is smaller than the widget then the image is centred
|
||||
// otherwise we view the top left part of the image
|
||||
// This function does not redraw (call redraw afterwards)
|
||||
void GLImageBox::setNormal()
|
||||
@@ -526,7 +526,7 @@ void GLImageBox::setNormal()
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the image coordinates of the centre point of the widget
|
||||
// Gets the image coordinates of the centre point of the widget
|
||||
void GLImageBox::getCentrePoint(int &ICx, int &ICy)
|
||||
{
|
||||
ICx = (int)floor(WCToIC_X((double)(width() - 1) / 2.0) + 0.5);
|
||||
@@ -545,7 +545,7 @@ void GLImageBox::relMoveWC(int WCdx, int WCdy)
|
||||
|
||||
// Computes an image x-coordinate from the widget x-coordinate
|
||||
// Note: (_x0,_y0) is the centre of the image pixel displayed at the top left of the widget
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// theoretically coincide with widget coordinate (-0.5,-0.5)
|
||||
// Zoom = 4: Widget(0,0) = Image(_x0 - 0.375,_y0 - 0.375)
|
||||
// Zoom = 2: Widget(0,0) = Image(_x0 - 0.250,_y0 - 0.250)
|
||||
@@ -559,7 +559,7 @@ double GLImageBox::WCToIC_X(double WidgetX)
|
||||
|
||||
// Computes an image y-coordinate from the widget y-coordinate
|
||||
// Note: (_x0,_y0) is the centre of the image pixel displayed at the top left of the widget
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// theoretically coincide with widget coordinate (-0.5,-0.5)
|
||||
// Zoom = 4: Widget(0,0) = Image(_x0 - 0.375,_y0 - 0.375)
|
||||
// Zoom = 2: Widget(0,0) = Image(_x0 - 0.250,_y0 - 0.250)
|
||||
@@ -573,7 +573,7 @@ double GLImageBox::WCToIC_Y(double WidgetY)
|
||||
|
||||
// Computes a widget x-coordinate from an image x-coordinate
|
||||
// Note: (_x0,_y0) is the centre of the image pixel displayed at the top left of the widget
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// theoretically coincide with widget coordinate (-0.5,-0.5)
|
||||
// Zoom = 4: Widget(0,0) = Image(_x0 - 0.375,_y0 - 0.375)
|
||||
// Zoom = 2: Widget(0,0) = Image(_x0 - 0.250,_y0 - 0.250)
|
||||
@@ -587,7 +587,7 @@ double GLImageBox::ICToWC_X(double ImageX)
|
||||
|
||||
// Computes a widget y-coordinate from an image y-coordinate
|
||||
// Note: (_x0,_y0) is the centre of the image pixel displayed at the top left of the widget
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// therefore (_x0 - 0.5, _y0 - 0.5) is the top left coordinate of this pixel which will
|
||||
// theoretically coincide with widget coordinate (-0.5,-0.5)
|
||||
// Zoom = 4: Widget(0,0) = Image(_x0 - 0.375,_y0 - 0.375)
|
||||
// Zoom = 2: Widget(0,0) = Image(_x0 - 0.250,_y0 - 0.250)
|
||||
@@ -782,10 +782,10 @@ int GLImageBox::createColorMap(int numEntriesReq, bool Initialise)
|
||||
// alpha ... value for this alpha entry (range 0 to 1)
|
||||
int GLImageBox::setColorMapRGBAValue(int index, float red, float green, float blue, float alpha)
|
||||
{
|
||||
if ((index < 0) || (index >= _numMapEntries) ||
|
||||
(red < 0.0) || (red > 1.0) ||
|
||||
(green < 0.0) || (green > 1.0) ||
|
||||
(blue < 0.0) || (blue > 1.0) ||
|
||||
if ((index < 0) || (index >= _numMapEntries) ||
|
||||
(red < 0.0) || (red > 1.0) ||
|
||||
(green < 0.0) || (green > 1.0) ||
|
||||
(blue < 0.0) || (blue > 1.0) ||
|
||||
(alpha < 0.0) || (alpha > 1.0))
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
class SoCoordinate3;
|
||||
class SoDrawStyle;
|
||||
class SoTexture2;
|
||||
class SoTexture2;
|
||||
class QImage;
|
||||
|
||||
namespace ImageGui
|
||||
|
||||
@@ -60,7 +60,7 @@ class _CommandImageScaling:
|
||||
def Activated(self):
|
||||
import draftguitools.gui_trackers as trackers
|
||||
cmdCreateImageScaling(name="ImageScaling", trackers=trackers)
|
||||
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument:
|
||||
return True
|
||||
@@ -79,7 +79,7 @@ def cmdCreateImageScaling(name, trackers):
|
||||
dy=p2[1]-p1[1]
|
||||
dz=p2[2]-p1[2]
|
||||
return math.sqrt(dx*dx+dy*dy+dz*dz)
|
||||
|
||||
|
||||
def centerOnScreen (widg):
|
||||
'''centerOnScreen()
|
||||
Centers the window on the screen.'''
|
||||
@@ -87,7 +87,7 @@ def cmdCreateImageScaling(name, trackers):
|
||||
xp=(resolution.width() / 2) - widg.frameGeometry().width()/2
|
||||
yp=(resolution.height() / 2) - widg.frameGeometry().height()/2
|
||||
widg.move(xp, yp)
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
self.view = FreeCADGui.ActiveDocument.ActiveView
|
||||
@@ -135,12 +135,12 @@ def cmdCreateImageScaling(name, trackers):
|
||||
self.tracker.raiseTracker()
|
||||
self.tracker.on()
|
||||
self.dialog.show()
|
||||
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
Dialog.setWindowTitle(translate("Dialog", "Scale image plane", None))
|
||||
self.label.setText(translate("Dialog", "Distance", None))
|
||||
self.label1.setText(translate("Dialog", "Select first point", None))
|
||||
|
||||
|
||||
def accept(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
try:
|
||||
@@ -159,7 +159,7 @@ def cmdCreateImageScaling(name, trackers):
|
||||
except (IndexError, AttributeError):
|
||||
self.label1.setText("<font color='red'>" + translate("Dialog", "Select ImagePlane", None) + "</font>")
|
||||
return
|
||||
|
||||
|
||||
def reject(self):
|
||||
if len(self.stack) != 2:
|
||||
self.view.removeEventCallbackPivy(pvy.SoMouseButtonEvent.getClassTypeId(),self.callback)
|
||||
@@ -168,16 +168,16 @@ def cmdCreateImageScaling(name, trackers):
|
||||
self.tracker.off()
|
||||
self.tracker.finalize()
|
||||
self.dialog.hide()
|
||||
|
||||
|
||||
def getmousepoint(self, event_cb):
|
||||
event = event_cb.getEvent()
|
||||
if len(self.stack)==1:
|
||||
pos = event.getPosition()
|
||||
point = self.view.getPoint(pos[0],pos[1])
|
||||
self.tracker.p2(point)
|
||||
|
||||
|
||||
def getpoint(self,event_cb):
|
||||
event = event_cb.getEvent()
|
||||
event = event_cb.getEvent()
|
||||
if event.getState() == pvy.SoMouseButtonEvent.DOWN:
|
||||
pos = event.getPosition()
|
||||
point = self.view.getPoint(pos[0],pos[1])
|
||||
@@ -192,8 +192,8 @@ def cmdCreateImageScaling(name, trackers):
|
||||
self.view.removeEventCallbackPivy(pvy.SoLocation2Event.getClassTypeId(),self.callmouse)
|
||||
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
|
||||
self.label1.setText(translate("Dialog", "Select Image Plane and type distance", None))
|
||||
|
||||
#Init
|
||||
|
||||
#Init
|
||||
if FreeCADGui.ActiveDocument is not None:
|
||||
d = QtGui.QWidget()
|
||||
ui = Ui_Dialog()
|
||||
|
||||
@@ -24,10 +24,10 @@ __title__ = "ImageTools package" # from "Macro Image Scaling"
|
||||
__author__ = "JAndersM"
|
||||
__url__ = "https://www.freecadweb.org/wiki/Macro_Image_Scaling"
|
||||
__version__ = "00.01"
|
||||
__date__ = "19/01/2016"
|
||||
|
||||
|
||||
__tutorial__ = "https://youtu.be/2iFE40uHrA8"
|
||||
__date__ = "19/01/2016"
|
||||
|
||||
|
||||
__tutorial__ = "https://youtu.be/2iFE40uHrA8"
|
||||
__forum__ = "https://forum.freecadweb.org/viewtopic.php?f=3&t=14265"
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,3 @@ ParGrp = App.ParamGet("System parameter:Modules").GetGroup("Image")
|
||||
ParGrp.SetString("HelpIndex", "Image/Help/index.html")
|
||||
ParGrp.SetString("WorkBenchName", "Image")
|
||||
ParGrp.SetString("WorkBenchModule", "ImageWorkbench.py")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@ class ImageWorkbench ( Workbench ):
|
||||
def Initialize(self):
|
||||
# load the module
|
||||
import ImageGui
|
||||
|
||||
|
||||
try:
|
||||
import ImageTools._CommandImageScaling
|
||||
except ImportError as err:
|
||||
FreeCAD.Console.PrintError("Features from ImageTools package cannot be loaded. {err}\n".format(err= str(err)))
|
||||
|
||||
FreeCAD.Console.PrintError("Features from ImageTools package cannot be loaded. {err}\n".format(err= str(err)))
|
||||
|
||||
def GetClassName(self):
|
||||
return "ImageGui::Workbench"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user