summaryrefslogtreecommitdiff
path: root/src/DataImage.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-06-26 18:05:47 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-06-26 18:05:47 +0200
commit70a6e7c52eb8830e7e2c5884247201defdeb6a1c (patch)
tree17ae0ceb48ef1e5f3d2503539f69e382d7ff576e /src/DataImage.cxx
parent76daa38e38aff35613dcaf18330192833fd83deb (diff)
switch to double coordinates
Diffstat (limited to 'src/DataImage.cxx')
-rw-r--r--src/DataImage.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/DataImage.cxx b/src/DataImage.cxx
index 680d218..efc05e3 100644
--- a/src/DataImage.cxx
+++ b/src/DataImage.cxx
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <math.h>
#include <Fl/fl_draw.h>
@@ -63,6 +64,23 @@ DataImage::draw() {
}
int
+DataImage::get_pixel_bilinear(Fl_Image *img, double x, double y,
+ char *r, char *g, char *b) {
+
+
+}
+
+int
+DataImage::get_pixel_nearest(Fl_Image *img, double x, double y,
+ char *r, char *g, char *b) {
+ if (isnan(x) || isnan(y)) {
+ return 1;
+ } else {
+ return get_pixel(img, (int) rint(x), (int) rint(y), r, g, b);
+ }
+}
+
+int
DataImage::get_pixel(Fl_Image *img, int x, int y,
char *r, char *g, char *b) {
if ( img->d() == 0 ) {
@@ -72,7 +90,6 @@ DataImage::get_pixel(Fl_Image *img, int x, int y,
if (x < 0 || x >=img->w() || y < 0 || y >= img->h()) {
return 1;
}
-
long index = (y * img->w() * img->d()) + (x * img->d()); // X/Y -> buf index
switch ( img->count() ) {
case 1: { // bitmap