Image.hpp 1.04 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
//  Image.hpp
//  c_gtk_image
//
//  Created by Arnaud Blanchard on 23/11/2020.
//

#ifndef Image_hpp
#define Image_hpp

#include "blc_array.h"
#include <gtk/gtk.h>
#include <cairo.h>
#include <string>


class Image:public blc_array{
    bool fit_size=true;
public:
    
    Image(blc_array const &array);
    virtual ~Image();
    void resize(int allocated_width, int allocated_height);
    void zoom_original();
    void zoom(double factor);
    void active_fit_size();
    
    /** set pointer position (i, j) in the window. return false if the pointer is not in the window. */
    bool get_pointer_position(int &i, int &j);
  
    /** Display the new image with the content array.*/
    virtual void update()=0;
    
    static void resize_cb(GtkWidget *widget,  GdkRectangle *allocation, Image *image);


    std::string pointer_info;
    double x_scale, y_scale;
    std::string pixel_info();
    cairo_surface_t *surface;
    GdkDevice* pointer_device;
    GdkWindow *window;
    GtkWidget *widget, *image;
    size_t width, height;
};


#endif /* Image_h */