URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-09 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Bad plugin for debugging a segfault.
* sandbox/nivault/plugin-gimp/src/build-image.hh,
* sandbox/nivault/plugin-gimp/src/build-image.hxx,
* sandbox/nivault/plugin-gimp/src/gimp-image.hh,
* sandbox/nivault/plugin-gimp/src/interface.hxx: Some code commented.
---
build-image.hh | 4 -
build-image.hxx | 30 ++------
gimp-image.hh | 191 +++++++++++++++++++++++++++++++-------------------------
interface.hxx | 9 --
4 files changed, 116 insertions(+), 118 deletions(-)
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1461)
@@ -40,23 +40,7 @@
{
I tmp(region);
ima = tmp;
- mln_piter_(I) p(ima.domain());
-
-// gimp_pixel_rgn_init(®ion,
-// drawable,
-// 0,
-// 0,
-// drawable->width,
-// drawable->height,
-// FALSE,
-// FALSE);
-
-// gimp_pixel_rgn_get_rect(®ion,
-// (guchar *) ima.buffer(),
-// 0,
-// 0,
-// drawable->width,
-// drawable->height);
+ mln::level::fill(ima, mln::literal::blue);
}
gboolean draw_milena_image(GtkWidget* area,
@@ -76,10 +60,10 @@
FALSE,
FALSE);
- gimp_pixel_rgn_set_rect(®ion,
- (const guchar *) ima.buffer(),
- 0,
- 0,
- drawable->width,
- drawable->height);
+// gimp_pixel_rgn_set_rect(®ion,
+// (const guchar *) ima.buffer(),
+// 0,
+// 0,
+// drawable->width,
+// drawable->height);
}
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/interface.hxx
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/interface.hxx (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/interface.hxx (revision 1461)
@@ -54,8 +54,6 @@
GtkWidget *main_vbox;
GtkWidget *image_layout;
GtkWidget *frame;
-// GtkAdjustment *hadjust = NULL;
-// GtkAdjustment *vadjust = NULL;
GimpRGB color;
gimp_ui_init (PLUGIN_NAME, TRUE);
@@ -80,15 +78,10 @@
drawing_area = gimp_drawable_preview_new(drawable, NULL);
gtk_container_add (GTK_CONTAINER (frame), drawing_area);
-//** Not declared ?? **//
-// gimp_scrolled_preview_set_policy((GimpScrolledPreview *)drawing_area,
-// GTK_POLICY_ALWAYS,
-// GTK_POLICY_ALWAYS);
-
gtk_widget_set_size_request(drawing_area,
500,
500);
- draw_milena_image(drawing_area, NULL, 0);
+// draw_milena_image(drawing_area, NULL, 0);
gtk_widget_show (drawing_area);
gtk_widget_show (main_vbox);
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh (revision 1461)
@@ -54,7 +54,7 @@
/// {
data_(GimpPixelRgn* rgn_);
- data_(box2d* box);
+// data_(box2d* box);
/// }
/// Destructor.
@@ -113,7 +113,7 @@
typedef trait::image::size::regular size;
typedef trait::image::support::aligned support;
- typedef trait::image::border::stored border;
+ typedef trait::image::border::none border;
typedef trait::image::data::raw data;
typedef trait::image::io::read_write io;
typedef trait::image::speed::fast speed;
@@ -198,26 +198,26 @@
/// Read-write access to the image value located at point \p p.
T& operator()(const point& p);
- /// Read-only access to the image value located at offset \p o.
- const T& operator[](unsigned o) const;
+// /// Read-only access to the image value located at offset \p o.
+// const T& operator[](unsigned o) const;
- /// Read-write access to the image value located at offset \p o.
- T& operator[](unsigned o);
+// /// Read-write access to the image value located at offset \p o.
+// T& operator[](unsigned o);
- /// Read-only access to the image value located at (\p row, \p col).
- const T& at(int row, int col) const;
+// /// Read-only access to the image value located at (\p row, \p col).
+// const T& at(int row, int col) const;
- /// Read-write access to the image value located at (\p row, \p col).
- T& at(int row, int col);
+// /// Read-write access to the image value located at (\p row, \p col).
+// T& at(int row, int col);
/// Fast Image method
- /// Give the offset corresponding to the delta-point \p dp.
- int offset(const dpoint2d& dp) const;
+// /// Give the offset corresponding to the delta-point \p dp.
+// int offset(const dpoint2d& dp) const;
- /// Give the point corresponding to the offset \p o.
- point2d point_at_offset(unsigned o) const;
+// /// Give the point corresponding to the offset \p o.
+// point2d point_at_offset(unsigned o) const;
/// Give a hook to the value buffer.
const T* buffer() const;
@@ -225,10 +225,13 @@
/// Give a hook to the value buffer.
T* buffer();
- private:
+ /// Gimp Image method
- /// GimpPixelRgn object.
- GimpPixelRgn* region_;
+ /// Give a hook to the GimpPixelRgn.
+ GimpPixelRgn* gimp_region();
+
+ /// Give a hook to the GimpDrawable.
+ GimpDrawable* gimp_drawable();
};
@@ -236,23 +239,23 @@
namespace internal
{
- template <GimpImageType t>
- data_< gimp_image<t> >::data_(box2d* box)
- : selfcreated_(true),
- b_(box)
- {
- GimpDrawable *gdraw = new GimpDrawable;
- gimp_pixel_rgn_init(rgn_,
- gdraw,
- box->pmin()[1],
- box->pmin()[0],
- box->len(1),
- box->len(0),
- FALSE,
- FALSE);
- buffer_ = rgn_->data;
- allocate_();
- }
+// template <GimpImageType t>
+// data_< gimp_image<t> >::data_(box2d* box)
+// : selfcreated_(true),
+// b_(*box)
+// {
+// GimpDrawable *gdraw = new GimpDrawable;
+// gimp_pixel_rgn_init(rgn_,
+// gdraw,
+// box->pmin()[1],
+// box->pmin()[0],
+// box->len(1),
+// box->len(0),
+// FALSE,
+// FALSE);
+// buffer_ = rgn_->data;
+// allocate_();
+// }
template <GimpImageType t>
data_< gimp_image<t> >::data_(GimpPixelRgn* rgn)
@@ -403,53 +406,57 @@
const mln_value(gimp_image<t>)&
gimp_image<t>::operator()(const point& p) const
{
- mln_precondition(this->owns_(p));
- return this->data_->array_[p.row()][p.col()];
+ // mln_precondition(this->owns_(p));
+ // FIXME HERE value*) this->data_->rgn->data
+ static mln::value::rgb8 c(200,200,200);
+ return c; // this->data_->array_[p.row()][p.col()];
}
template <GimpImageType t>
mln_value(gimp_image<t>)&
gimp_image<t>::operator()(const point& p)
{
- mln_precondition(this->owns_(p));
- return this->data_->array_[p.row()][p.col()];
- }
-
-
- template <GimpImageType t>
- const mln_value(gimp_image<t>)&
- gimp_image<t>::operator[](unsigned o) const
- {
- mln_precondition(o < ncells());
- return *(this->data_->buffer_ + o);
+ // mln_precondition(this->owns_(p));
+ static mln::value::rgb8 c(0,0,0);
+ return c; // this->data_->array_[p.row()][p.col()];
+// return this->data_->array_[p.row()][p.col()];
}
- template <GimpImageType t>
- mln_value(gimp_image<t>)&
- gimp_image<t>::operator[](unsigned o)
- {
- mln_precondition(o < ncells());
- return *(this->data_->buffer_ + o);
- }
-
-
- template <GimpImageType t>
- const mln_value(gimp_image<t>)&
- gimp_image<t>::at(int row, int col) const
- {
- mln_precondition(this->owns_(make::point2d(row, col)));
- return this->data_->array_[row][col];
- }
-
-
- template <GimpImageType t>
- mln_value(gimp_image<t>)&
- gimp_image<t>::at(int row, int col)
- {
- mln_precondition(this->owns_(make::point2d(row, col)));
- return this->data_->array_[row][col];
- }
+// template <GimpImageType t>
+// const mln_value(gimp_image<t>)&
+// gimp_image<t>::operator[](unsigned o) const
+// {
+// mln_precondition(o < ncells());
+// return *(this->data_->buffer_ + o);
+// }
+
+
+// template <GimpImageType t>
+// mln_value(gimp_image<t>)&
+// gimp_image<t>::operator[](unsigned o)
+// {
+// mln_precondition(o < ncells());
+// return *(this->data_->buffer_ + o);
+// }
+
+
+// template <GimpImageType t>
+// const mln_value(gimp_image<t>)&
+// gimp_image<t>::at(int row, int col) const
+// {
+// mln_precondition(this->owns_(make::point2d(row, col)));
+// return this->data_->array_[row][col];
+// }
+
+
+// template <GimpImageType t>
+// mln_value(gimp_image<t>)&
+// gimp_image<t>::at(int row, int col)
+// {
+// mln_precondition(this->owns_(make::point2d(row, col)));
+// return this->data_->array_[row][col];
+// }
template <GimpImageType t>
@@ -470,25 +477,39 @@
}
+// template <GimpImageType t>
+// int
+// gimp_image<t>::offset(const dpoint2d& dp) const
+// {
+// mln_precondition(this->has_data());
+// int o = dp[0] * this->data_->b_.len(1) + dp[1];
+// return o;
+// }
+
+
+// template <GimpImageType t>
+// point2d
+// gimp_image<t>::point_at_offset(unsigned o) const
+// {
+// mln_precondition(o < ncells());
+// point2d p = make::point2d(o / this->data_->b_.len(1) +
this->data_->b_.min_row(),
+// o % this->data_->b_.len(1) + this->data_->b_.min_col());
+// mln_postcondition(& this->operator()(p) == this->data_->buffer_ +
o);
+// return p;
+// }
+
template <GimpImageType t>
- int
- gimp_image<t>::offset(const dpoint2d& dp) const
+ GimpPixelRgn*
+ gimp_image<t>::gimp_region()
{
- mln_precondition(this->has_data());
- int o = dp[0] * this->data_->b_.len(1) + dp[1];
- return o;
+ return this->data_->rgn_;
}
-
template <GimpImageType t>
- point2d
- gimp_image<t>::point_at_offset(unsigned o) const
+ GimpDrawable*
+ gimp_image<t>::gimp_drawable()
{
- mln_precondition(o < ncells());
- point2d p = make::point2d(o / this->data_->b_.len(1) +
this->data_->b_.min_row(),
- o % this->data_->b_.len(1) + this->data_->b_.min_col());
- mln_postcondition(& this->operator()(p) == this->data_->buffer_ + o);
- return p;
+ return this->data_->rgn_->drawable;
}
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1461)
@@ -32,10 +32,10 @@
# include <libgimp/gimpui.h>
# include <src/gimp-image.hh>
-
+# include <mln/level/fill.hh>
// # include <mln/core/image2d.hh>
// # include <mln/value/rgb8.hh>
-// # include <mln/literal/black.hh>
+# include <mln/literal/all.hh>
// # include <mln/display/show.hh>
// # include <mln/display/remove.hh>