cairo

Cannot compile Cairo C code on Windows 10

自闭症网瘾萝莉.ら 提交于 2019-12-12 05:25:27
问题 I am trying to compile the zetcode lines on Windows 10 using msys64. I use the following compilation command: gcc example.c -o example `pkg-config --cflags --libs cairo gtk+-3.0` and get the following error: -bash: pkg-config: command not found example.c:1:19: fatal error: cairo.h: No such file or directory #include <cairo.h> However I did pacman -S mingw-w64-i686-cairo before and the installation was successful. When I type **pacman -Ss mingw-w64-i686-cairo ** I get the following: mingw32

Cairo: grabbing the whole drawing as a pattern

喜你入骨 提交于 2019-12-12 01:39:57
问题 I am probably missing something conceptual about cairo . I draw using the following helper class: struct GroupLock { GroupLock(Graphics &g) : g_(g) { cairo_push_group(g_.cr); } ~GroupLock() { cairo_pop_group_to_source(g_.cr); cairo_paint(g_.cr); cairo_surface_flush(g_.surface); XFlush(g_.display); } private: Graphics &g_; }; All my drawing functions are of the form: void drawSomething(Graphics &g) { GroupLock lock{g}; (void)lock; ... // some drawing } Each call to such a drawing function sets

Gdk / X11 Screen Capture

二次信任 提交于 2019-12-12 00:20:58
问题 I want to write a program that continuously captures the screen and does some modifications to the image. A complete test program can be found at: https://gist.github.com/blogsh/eb4dd4b96aca468c8bfa However, I ran into some problems. The first experiment I did was using the Gdk root window, create a Cairo context from it and then using it's target as the source for another window, where the contents are painted to: mScreenContext = Gdk::Screen::get_default()->get_root_window()->create_cairo

Faster bit-level data packing

ぐ巨炮叔叔 提交于 2019-12-11 17:07:10
问题 An 256*64 pixel OLED display connected to Raspberry Pi (Zero W) has 4 bit greyscale pixel data packed into a byte (i.e. two pixels per byte), so 8192 bytes in total. E.g. the bytes 0a 0b 0c 0d (only lower nibble has data) become ab cd Converting these bytes either obtained from a Pillow (PIL) Image or a cairo ImageSurface takes up to 0.9 s when naively iterating the pixel data, depending on color depth. Combining every two bytes from a Pillow "L" (monochrome 8 bit) Image: imd = im.tobytes()

Gtk.DrawingArea blank when attached to Gtk.Grid

Deadly 提交于 2019-12-11 09:11:30
问题 (This is my first post, sorry if I do something wrong...) I am writing a program in Vala with which one can design a classroom. I have decided to use GTK for the GUI (Vala integrates well with this), and Cairo to draw the classroom diagram (GTK comes with this by default). I have created a 'classroom' class (a subclass of Gtk.DrawingArea), which currently should just display a square: public class Classroom : DrawingArea { private delegate void DrawMethod(); public Classroom() { this.draw

Error manipulating a remote image using node-canvas: “Image given has not completed loading”

て烟熏妆下的殇ゞ 提交于 2019-12-11 08:55:16
问题 I'm trying to use node-canvas to manipulate an image stored on a remote server. I started with the image-src example and modified it, but I can't get it to work. Here's my code: var fs = require('fs'), http = require('http'), url = require('url'), canvas = require('./node-canvas/lib/canvas'); var outCanvas = new canvas(1000, 750); var ctx = outCanvas.getContext('2d'); http.get( { host: 'farm8.staticflickr.com', port: 80, path: '/7108/7038906747_69a526f070_z.jpg' }, function(res) { var data =

How to write contents of a Cairo Image surface into a Gdk Pixbuf?

泪湿孤枕 提交于 2019-12-11 07:29:03
问题 I have a canvas(Gdk Drawing Area), which I can draw into it using Cairo, but I need to save contents of my canvas into a buffer which in my case is a Gdk Pixbuf. I want to know if it's possible or not, if there is a better way I would like to know. thanks. 回答1: We do this in f-spot using a simple copy routine. Not the most elegant solution, but it works: http://git.gnome.org/browse/f-spot/tree/lib/libfspot/f-pixbuf-utils.c#n170 来源: https://stackoverflow.com/questions/4291994/how-to-write

Cairo load image from data

故事扮演 提交于 2019-12-11 07:00:42
问题 I have a doubt with cairo library. I downloaded an image and I put it into a buffer memory. Is there any solution in cairo to load an image from data that there is in memory? Thanks 回答1: Maybe you want something like gdk_pixbuf_new_from_data http://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-data 回答2: Give a look to cairo_image_surface_create_for_data. 回答3: You can load image data from memory, but you need to lay out that memory in the

Overlay Window in x11 keeps Flickering

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 06:19:26
问题 I adopted the code from this answer in order to draw an overlay window, which stays on top of all windows, always. But I find that this window keeps flickering whenever there is a keypress or a button click. I wanted to know if this can be stopped somehow. Increasing the time did not help me, as my terminal was frozen for few seconds when I increased time to 5000000000 The code was tested on Ubuntu 16.04 LTS . 回答1: I could not find a solution using the XComposite suite of functions. However,

how to make gtk.Layout transparent

北战南征 提交于 2019-12-11 06:19:21
问题 don be afraid of that big class - it was interesting for me to write so it could work in that universal way. it could be the parent-class for transparent elements, and not-parent. so, the trouble. it can make transparent the main gtk.Window, the gtk.EventBox as in example below, and other gtk.widgets, but it doesnot work with gtk.Layout, help me please. i think i wrote enough yet for send the question. sorry my English:) #!/usr/bin/env python # -*- coding: utf-8 -*- import gtk import cairo