Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6770623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:20:04+00:00 2026-05-26T15:20:04+00:00

Refering to the example on the Documentation for Gtkmms GdkRGB : #include <gtk/gtk.h> #define

  • 0

Refering to the example on the Documentation for Gtkmms GdkRGB:

#include <gtk/gtk.h>
#define IMAGE_WIDTH 256
#define IMAGE_HEIGHT    256
guchar rgbbuf[IMAGE_WIDTH * IMAGE_HEIGHT * 3];
gboolean on_darea_expose (GtkWidget *widget,
          GdkEventExpose *event,
          gpointer user_data);
int
main (int argc, char *argv[])
{
  GtkWidget *window, *darea;
  gint x, y;
  guchar *pos;
  gtk_init (&argc, &argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  darea = gtk_drawing_area_new ();
  gtk_widget_set_size_request (darea, IMAGE_WIDTH, IMAGE_HEIGHT);
  gtk_container_add (GTK_CONTAINER (window), darea);
  gtk_signal_connect (GTK_OBJECT (darea), "expose-event",
                  GTK_SIGNAL_FUNC (on_darea_expose), NULL);
  gtk_widget_show_all (window);
  /* Set up the RGB buffer. */
  pos = rgbbuf;
  for (y = 0; y < IMAGE_HEIGHT; y++)
    {
      for (x = 0; x < IMAGE_WIDTH; x++)
    {
      *pos++ = x - x % 32;          /* Red. */
      *pos++ = (x / 32) * 4 + y - y % 32;   /* Green. */
      *pos++ = y - y % 32;          /* Blue. */
    }
    }
  gtk_main ();
  return 0;
}
gboolean
on_darea_expose (GtkWidget *widget,
     GdkEventExpose *event,
     gpointer user_data)
{
  gdk_draw_rgb_image (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
          0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
          GDK_RGB_DITHER_MAX, rgbbuf, IMAGE_WIDTH * 3);
  return TRUE;
}

But they say that “gdk_draw_rgb_image is deprecated and should not be used in newly-written code.”

I would like to have an image in an array of pixels, where I can directly manipulate the pixels.

Basically, I just would like to “draw” an array of pixels I would like to modify before. Cairo is a nice tool, but not suitable for my purpose. Therefore, rectangle is not an option.

Isn’t this possible anymore?

Well, the example I mentioned before works, but I prefer not to use deprecated libraries for new code.

How else can I draw my pixels then?
And this is a gtk example. We’re using GtkMM and I would like to know whether there’s an equivalent to this.

Many Thanks and best regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:20:04+00:00Added an answer on May 26, 2026 at 3:20 pm

    You have to use cairo.

    All GDK drawing functions are deprecated and removed in GDK 3.

    You can use a GdkPixbuf http://developer.gnome.org/gdk-pixbuf/unstable//gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf with Cairo interaction functions gdk_cairo_set_source_pixbuf and gdk_cairo_rectangle http://developer.gnome.org/gdk3/stable/gdk3-Cairo-Interaction.html.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is canonical example of a program extending embedded Python 3.x in C/C++: #include
I'm refering to the 'A Request-Reply Broker' in the Zeromq documentation: http://zguide.zeromq.org/chapter:all I'm getting
With Mirah, I am refering to the JVM language: http://www.mirah.org/ The only useful documentation
In Apple's documentation for their example of a Singleton, and I do understand there's
Going to http://www.example.com/node/NID/edit , where NID is any valid nid referring to a node
I have tried to do this refering to following link. http://skypher.com/index.php/2008/07/28/function-list-for-php/ But no success.
I am using Server version: Apache/1.3.34 (Debian) mod_perl - 1.29 By refering to STDIN,
I was watching MIX session. Presenter there was refering Panoramic experience in windows phone.
I have 2 questions to ask here. I am refering http://www.broculos.net/en/article/android-101-how-create-stackview-widget to create a
I get this, clicking 'no' means the page displays flawlessly. it's refering to this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.