Some files 'astylized' + slight cleanup
This commit is contained in:
@@ -27,7 +27,7 @@ Alpha::Alpha () {}
|
||||
Alpha::Alpha (int width, int height)
|
||||
{
|
||||
if (width > 0 && height > 0) {
|
||||
surface = Cairo::ImageSurface::create(Cairo::FORMAT_A8, width, height);
|
||||
surface = Cairo::ImageSurface::create (Cairo::FORMAT_A8, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ Alpha::~Alpha () {
|
||||
}
|
||||
*/
|
||||
|
||||
void Alpha::setSize(int width, int height)
|
||||
void Alpha::setSize (int width, int height)
|
||||
{
|
||||
if (width > 0 && height > 0) {
|
||||
if (surface) {
|
||||
@@ -48,7 +48,7 @@ void Alpha::setSize(int width, int height)
|
||||
}
|
||||
}
|
||||
|
||||
surface = Cairo::ImageSurface::create(Cairo::FORMAT_A8, width, height);
|
||||
surface = Cairo::ImageSurface::create (Cairo::FORMAT_A8, width, height);
|
||||
} else if (surface) {
|
||||
surface.clear();
|
||||
}
|
||||
@@ -72,4 +72,25 @@ int Alpha::getHeight()
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Cairo::RefPtr<Cairo::ImageSurface> Alpha::getSurface ()
|
||||
{
|
||||
return surface; // to be used in bitmap edition
|
||||
}
|
||||
|
||||
unsigned char Alpha::operator () (unsigned row, unsigned col) const
|
||||
{
|
||||
return * (surface->get_data () + row * surface->get_width () + col);
|
||||
}
|
||||
|
||||
unsigned char& Alpha::operator () (unsigned row, unsigned col)
|
||||
{
|
||||
return * (surface->get_data () + row * surface->get_width () + col);
|
||||
}
|
||||
|
||||
unsigned char* Alpha::operator () (unsigned row) const
|
||||
{
|
||||
return surface->get_data () + row * surface->get_width ();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -38,11 +38,11 @@ public:
|
||||
Alpha (int width, int height);
|
||||
//~Alpha ();
|
||||
|
||||
void setSize(int width, int height);
|
||||
void setSize (int width, int height);
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
|
||||
const Cairo::RefPtr<Cairo::ImageSurface> getSurface ();
|
||||
Cairo::RefPtr<Cairo::ImageSurface> getSurface ();
|
||||
|
||||
// TODO: to make the editing faster, we should add an iterator class
|
||||
|
||||
@@ -50,28 +50,9 @@ public:
|
||||
unsigned char* operator () (unsigned row) const;
|
||||
// Will send back a value at a given row, col position
|
||||
unsigned char& operator () (unsigned row, unsigned col);
|
||||
const unsigned char operator () (unsigned row, unsigned col) const;
|
||||
unsigned char operator () (unsigned row, unsigned col) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline const Cairo::RefPtr<Cairo::ImageSurface> Alpha::getSurface () {
|
||||
return surface; // to be used in bitmap edition
|
||||
}
|
||||
|
||||
inline const unsigned char Alpha::operator () (unsigned row,
|
||||
unsigned col) const {
|
||||
return *(surface->get_data () + row * surface->get_width () + col);
|
||||
}
|
||||
|
||||
inline unsigned char& Alpha::operator () (unsigned row, unsigned col) {
|
||||
return *(surface->get_data () + row * surface->get_width () + col);
|
||||
}
|
||||
|
||||
inline unsigned char* Alpha::operator () (unsigned row) const {
|
||||
return surface->get_data () + row * surface->get_width ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -79,9 +79,11 @@ void ImProcFunctions::removeSpots (Imagefloat* img, const std::vector<SpotEntry>
|
||||
// scaled spot is too small, we do not preview it
|
||||
if (scaledFeatherRadius < 2 && pp.getSkip() != 1) {
|
||||
#ifndef NDEBUG
|
||||
|
||||
if (options.rtSettings.verbose) {
|
||||
printf ("Skipping spot located at %d x %d, too small for the preview zoom rate\n", entry.sourcePos.x, entry.sourcePos.y);
|
||||
}
|
||||
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
@@ -89,9 +91,11 @@ void ImProcFunctions::removeSpots (Imagefloat* img, const std::vector<SpotEntry>
|
||||
// skipping entries totally transparent
|
||||
if (entry.opacity == 0.) {
|
||||
#ifndef NDEBUG
|
||||
|
||||
if (options.rtSettings.verbose) {
|
||||
printf ("Skipping spot located at %d x %d: opacity=%.3f\n", entry.sourcePos.x, entry.sourcePos.y, entry.opacity);
|
||||
}
|
||||
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
@@ -99,11 +103,13 @@ void ImProcFunctions::removeSpots (Imagefloat* img, const std::vector<SpotEntry>
|
||||
// skipping entries where the source circle isn't completely inside the image bounds
|
||||
if (src_XMin < 0 || src_XMax >= img->getWidth() || src_YMin < 0 || src_YMax >= img->getHeight()) {
|
||||
#ifndef NDEBUG
|
||||
|
||||
if (options.rtSettings.verbose) {
|
||||
printf ("Skipping spot located at %d x %d, from the data at %d x %d, radius=%d, feather=%.3f, opacity=%.3f: source out of bounds\n", entry.sourcePos.x, entry.sourcePos.y, entry.targetPos.x, entry.targetPos.y, entry.radius, entry.feather, entry.opacity);
|
||||
printf ("%d < 0 || %d >= %d || %d < 0 || %d >= %d\n",
|
||||
src_XMin, src_XMax, img->getWidth(), src_YMin, src_YMax, img->getHeight());
|
||||
}
|
||||
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
@@ -111,11 +117,13 @@ void ImProcFunctions::removeSpots (Imagefloat* img, const std::vector<SpotEntry>
|
||||
// skipping entries where the dest circle is completely outside the image bounds
|
||||
if (dst_XMin >= img->getWidth() || dst_XMax <= 0 || dst_YMin >= img->getHeight() || dst_YMax <= 0) {
|
||||
#ifndef NDEBUG
|
||||
|
||||
if (options.rtSettings.verbose) {
|
||||
printf ("Skipping spot located at %d x %d, from the data at %d x %d, radius=%d, feather=%.3f, opacity=%.3f: source out of bounds\n", entry.sourcePos.x, entry.sourcePos.y, entry.targetPos.x, entry.targetPos.y, entry.radius, entry.feather, entry.opacity);
|
||||
printf ("%d >= %d || %d <= 0 || %d >= %d || %d <= 0\n",
|
||||
dst_XMin, img->getWidth(), dst_XMax, dst_YMin, img->getHeight(), dst_YMax);
|
||||
}
|
||||
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
@@ -343,10 +351,12 @@ void ImProcFunctions::removeSpots (Imagefloat* img, const std::vector<SpotEntry>
|
||||
if (i2 < 0 || i2 >= img->getHeight()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int j = 0, j2 = dst_XMin; j2 < dst_XMax - 1; ++j, ++j2) {
|
||||
if (j2 < 0 || j2 >= img->getWidth()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//float c2 = float (mask (i, j)) / 255.f;
|
||||
//float c1 = 1.f - c2;
|
||||
//resultPR->r(i,j) = (unsigned char) CLAMP0255 ( ROUND( double(first->r(i,j)) + double(secondPR->r(i,j)) ) );
|
||||
|
@@ -14,7 +14,7 @@ using namespace rtengine::procparams;
|
||||
#define STATIC_MO_OBJ_NBR 6
|
||||
|
||||
Spot::Spot() : FoldableToolPanel (this, "spot", M ("TP_SPOT_LABEL"), true, true), EditSubscriber (ET_OBJECTS), lastObject (-1), activeSpot (-1),
|
||||
sourceIcon ("spot-normal.png", "spot-active.png", "spot-active.png", "spot-prelight.png", "", Geometry::DP_CENTERCENTER), editedCheckBox(NULL)
|
||||
sourceIcon ("spot-normal.png", "spot-active.png", "spot-active.png", "spot-prelight.png", "", Geometry::DP_CENTERCENTER), editedCheckBox (NULL)
|
||||
{
|
||||
countLabel = Gtk::manage (new Gtk::Label (Glib::ustring::compose (M ("TP_SPOT_COUNTLABEL"), 0)));
|
||||
|
||||
@@ -74,6 +74,7 @@ Spot::~Spot()
|
||||
delete EditSubscriber::visibleGeometry.at (i);
|
||||
}
|
||||
}
|
||||
|
||||
// We do not delete the mouseOverGeometry, because the referenced objects are either
|
||||
// shared with visibleGeometry or instantiated by the class's ctor
|
||||
}
|
||||
@@ -170,11 +171,11 @@ void Spot::enabledChanged ()
|
||||
{
|
||||
if (listener) {
|
||||
if (get_inconsistent()) {
|
||||
listener->panelChanged (EvSpotEnabled, M("GENERAL_UNCHANGED"));
|
||||
listener->panelChanged (EvSpotEnabled, M ("GENERAL_UNCHANGED"));
|
||||
} else if (getEnabled()) {
|
||||
listener->panelChanged (EvSpotEnabled, M("GENERAL_ENABLED"));
|
||||
listener->panelChanged (EvSpotEnabled, M ("GENERAL_ENABLED"));
|
||||
} else {
|
||||
listener->panelChanged (EvSpotEnabled, M("GENERAL_DISABLED"));
|
||||
listener->panelChanged (EvSpotEnabled, M ("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,7 +216,7 @@ void Spot::createGeometry ()
|
||||
int nbrEntry = spots.size();
|
||||
|
||||
if (!batchMode) {
|
||||
countLabel->set_text(Glib::ustring::compose (M ("TP_SPOT_COUNTLABEL"), nbrEntry));
|
||||
countLabel->set_text (Glib::ustring::compose (M ("TP_SPOT_COUNTLABEL"), nbrEntry));
|
||||
}
|
||||
|
||||
//printf("CreateGeometry(%d)\n", nbrEntry);
|
||||
@@ -242,7 +243,7 @@ void Spot::createGeometry ()
|
||||
Cairo::RefPtr<Cairo::ImageSurface> activeImg = sourceIcon.getActiveImg();
|
||||
|
||||
for (; j < EditSubscriber::visibleGeometry.size() - STATIC_VISIBLE_OBJ_NBR; ++i, ++j) {
|
||||
EditSubscriber::mouseOverGeometry.at (i) = EditSubscriber::visibleGeometry.at (j) = new OPIcon (normalImg, activeImg, prelightImg, Cairo::RefPtr<Cairo::ImageSurface>(NULL), Cairo::RefPtr<Cairo::ImageSurface>(NULL), Geometry::DP_CENTERCENTER);
|
||||
EditSubscriber::mouseOverGeometry.at (i) = EditSubscriber::visibleGeometry.at (j) = new OPIcon (normalImg, activeImg, prelightImg, Cairo::RefPtr<Cairo::ImageSurface> (NULL), Cairo::RefPtr<Cairo::ImageSurface> (NULL), Geometry::DP_CENTERCENTER);
|
||||
EditSubscriber::visibleGeometry.at (j)->setActive (true);
|
||||
EditSubscriber::visibleGeometry.at (j)->datum = Geometry::IMAGE;
|
||||
EditSubscriber::visibleGeometry.at (j)->state = Geometry::NORMAL;
|
||||
@@ -379,9 +380,11 @@ void Spot::deleteSelectedEntry()
|
||||
// delete the activeSpot
|
||||
if (activeSpot > -1) {
|
||||
std::vector<rtengine::SpotEntry>::iterator i = spots.begin();
|
||||
|
||||
for (int j = 0; j < activeSpot; ++j) {
|
||||
++i;
|
||||
}
|
||||
|
||||
spots.erase (i);
|
||||
}
|
||||
|
||||
@@ -492,11 +495,11 @@ bool Spot::button2Pressed (const int modifierKey)
|
||||
{
|
||||
EditDataProvider* editProvider = getEditProvider();
|
||||
|
||||
if (!editProvider || lastObject == -1 || activeSpot==-1) {
|
||||
if (!editProvider || lastObject == -1 || activeSpot == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(modifierKey & (GDK_SHIFT_MASK|GDK_SHIFT_MASK))) {
|
||||
if (! (modifierKey & (GDK_SHIFT_MASK | GDK_SHIFT_MASK))) {
|
||||
EditSubscriber::action = ES_ACTION_PICKING;
|
||||
}
|
||||
|
||||
@@ -508,7 +511,7 @@ bool Spot::button3Pressed (const int modifierKey)
|
||||
{
|
||||
EditDataProvider* editProvider = getEditProvider();
|
||||
|
||||
if (!editProvider || lastObject == -1 || activeSpot==-1) {
|
||||
if (!editProvider || lastObject == -1 || activeSpot == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -517,7 +520,7 @@ bool Spot::button3Pressed (const int modifierKey)
|
||||
sourceIcon.state = Geometry::DRAGGED;
|
||||
EditSubscriber::action = ES_ACTION_DRAGGING;
|
||||
return true;
|
||||
} else if (!(modifierKey & (GDK_SHIFT_MASK|GDK_SHIFT_MASK))) {
|
||||
} else if (! (modifierKey & (GDK_SHIFT_MASK | GDK_SHIFT_MASK))) {
|
||||
EditSubscriber::action = ES_ACTION_PICKING;
|
||||
}
|
||||
|
||||
@@ -597,7 +600,7 @@ bool Spot::drag1 (const int modifierKey)
|
||||
//printf("sourceFeatherCircle / deltaPrevImage = %d / %d\n", editProvider->deltaImage.x, editProvider->deltaImage.y);
|
||||
float currFeather = spots.at (activeSpot).feather;
|
||||
rtengine::Coord currPos = editProvider->posImage + editProvider->deltaImage;
|
||||
rtengine::PolarCoord currPolar (currPos -spots.at (activeSpot).sourcePos);
|
||||
rtengine::PolarCoord currPolar (currPos - spots.at (activeSpot).sourcePos);
|
||||
spots.at (activeSpot).feather = LIM01<float> ((currPolar.radius - double (spots.at (activeSpot).radius)) / double (spots.at (activeSpot).radius));
|
||||
|
||||
if (spots.at (activeSpot).feather != currFeather) {
|
||||
@@ -650,9 +653,9 @@ bool Spot::drag3 (const int modifierKey)
|
||||
return modified;
|
||||
}
|
||||
|
||||
bool Spot::pick2(const bool picked)
|
||||
bool Spot::pick2 (const bool picked)
|
||||
{
|
||||
return pick3(picked);
|
||||
return pick3 (picked);
|
||||
}
|
||||
|
||||
bool Spot::pick3 (const bool picked)
|
||||
|
Reference in New Issue
Block a user