-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question on pixbufloader #150
Comments
LablGTK is mostly in maintenance mode, so additions are only on request. |
I’m just learning ocaml and translating some c++ code. Here is the use case in c++.
///////////////////////////////////////////////////////////////////////////////////
Gtk::Image * createImagefromPixbufWithText(Glib::RefPtr<Gdk::Pixbuf> pix, int count) {
auto height = pix->get_height();
auto width = pix->get_width();
//Glib::RefPtr<Gdk::Pixbuf>
auto rotpix = pix->rotate_simple (Gdk::PIXBUF_ROTATE_UPSIDEDOWN);
auto surf = Gdk::Cairo::create_surface_from_pixbuf (rotpix, 0);
auto ctx = Cairo::Context::create (surf)
Gdk::Cairo::set_source_pixbuf (ctx, rotpix);
ctx->paint();
ctx->move_to (40.0, height - 40.0);
ctx->set_source_rgb (1.0, 0.0, 1.0);
ctx->select_font_face ("courier", Cairo::FontSlant::FONT_SLANT_NORMAL, Cairo::FontWeight::FONT_WEIGHT_BOLD);
ctx->set_font_size (32.0);
auto s = fmt::format ("{:08d}", count);
ctx->show_text (s);
//surf->write_to_png ("foo.png");
return new Gtk::Image (surf);
}
boost::optional < Glib::RefPtr<Gdk::Pixbuf> > convertPayloadToPixbuf(const unsigned char *payload, int size) {
try {
Glib::RefPtr<Gdk::Pixbuf> pix;
Glib::RefPtr<Gdk::PixbufLoader> loader = Gdk::PixbufLoader::create ("jpeg");
loader->write (payload, (gsize) size);
loader->close();
pix = loader->get_pixbuf();
loader->close();
return pix;
} catch (...) {
BOOST_LOG_SEV (lg, error) << "Error converting payload to pixbuf";
return boost::none;
}
}
//////////////////////////////////////////////////////////////////////////////////
As I look at it there might be some Cairo functions missing too. I haven’t looked. Is there an existing module/class that I could use as an example to start writing the interface to pixbufloader? This is code is using gtkmm and caromm.
Thanks
Dave
… On Feb 5, 2022, at 9:54 PM, Jacques Garrigue ***@***.***> wrote:
LablGTK is mostly in maintenance mode, so additions are only on request.
If you have a use case, with the functions you would need, or even better a pull request with an actual implementation, then it could be added.
—
Reply to this email directly, view it on GitHub <#150 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABMWVQZZATELJUYU2ZB35SLUZXWGDANCNFSM5NUALDRQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.
|
The code for pixbufs is in |
pixbufloader only shows in stubs_GdkPixbuf.ml are there plans to fully support it?
The text was updated successfully, but these errors were encountered: