Show image in gtkmm from integer array

I have an integer array with a gray scale image, and I need to show it in my application. I am programming in C ++ with gtkmm and I cannot find any widget like a canvas that allows you to show and access every pixel of the image.

+3
source share
2 answers

As far as I understand, you need to use the following class with a constructor:

Gdk::Bitmap::Bitmap(const char *data, int width, int height)

to create a bitmap and upload your data to it.

Later you can use Gdk :: Pixmap or Gdk :: Window to draw. There is also a Pixbuf class for storing pixels.

0
source

. , ( gtkmm-3.0), - RGB, .

, . . 1280 * 1024 ( ), :

Gdk::Pixbuf::create_from_data(copy, Gdk::COLORSPACE_RGB, false, 8, 1280, 1024, 1280*3);

, , Gdk::Pixbuf::get_pixels().

0

Source: https://habr.com/ru/post/1723764/


All Articles