cairo

Loading a font from a file to pango?

流过昼夜 提交于 2021-02-20 11:23:28
问题 I have a code uses Cairo and Pango to create an image : #include<stdio.h> #include<cairo.h> #include<pango/pangocairo.h> #define IMAGE_WIDTH 650 #define IMAGE_HEIGHT 150 #define TEXT "HELLO WORLD" #define FONT "MizuFontAlphabet Normal 40" /* * $ gcc $(pkg-config pangocairo cairo --cflags --libs) file.c */ int main(int argc , char** argv) { cairo_surface_t *surface; cairo_t *cr; PangoLayout *layout; PangoFontDescription *desc; PangoRectangle extents; surface = cairo_image_surface_create(CAIRO

Loading a font from a file to pango?

纵饮孤独 提交于 2021-02-20 11:22:40
问题 I have a code uses Cairo and Pango to create an image : #include<stdio.h> #include<cairo.h> #include<pango/pangocairo.h> #define IMAGE_WIDTH 650 #define IMAGE_HEIGHT 150 #define TEXT "HELLO WORLD" #define FONT "MizuFontAlphabet Normal 40" /* * $ gcc $(pkg-config pangocairo cairo --cflags --libs) file.c */ int main(int argc , char** argv) { cairo_surface_t *surface; cairo_t *cr; PangoLayout *layout; PangoFontDescription *desc; PangoRectangle extents; surface = cairo_image_surface_create(CAIRO

Loading a font from a file to pango?

不羁岁月 提交于 2021-02-20 11:22:33
问题 I have a code uses Cairo and Pango to create an image : #include<stdio.h> #include<cairo.h> #include<pango/pangocairo.h> #define IMAGE_WIDTH 650 #define IMAGE_HEIGHT 150 #define TEXT "HELLO WORLD" #define FONT "MizuFontAlphabet Normal 40" /* * $ gcc $(pkg-config pangocairo cairo --cflags --libs) file.c */ int main(int argc , char** argv) { cairo_surface_t *surface; cairo_t *cr; PangoLayout *layout; PangoFontDescription *desc; PangoRectangle extents; surface = cairo_image_surface_create(CAIRO

Convert SVG to PNG with Python on Windows

亡梦爱人 提交于 2021-02-18 16:58:08
问题 Question: Which reproducible process can enable Windows Python users to render a SVG image into PNG? Many questions/answers (such as Convert SVG to PNG in Python and Server-side SVG to PNG (or some other image format) in python, which are not duplicates for the reasons explained below) explain how to convert a SVG to PNG with Python. Unfortunately, none of them are ready-to-use for Python + Windows . After more than 20 minutes, and many different attempts, I'm still unable to do it. More

Signal ::expose-event is invalid for GdkWindow and GdkX11Window

微笑、不失礼 提交于 2021-02-10 18:00:41
问题 I had this following code pull from one of the tutorials on line. When I use gtk+-2.0, the following code works fine. But when I try compile with gtk+-3.0, the code gives this error: signal 'expose-event' is invalid for instance of type 'GtkWindow' So I try to do the following, but still doesn't help. And it gives another error: signal 'expose-event' is invalid for instance of type 'GdkX11Window' gtk_widget_realize(window); GdkWindow *gdkwin = gtk_widget_get_window(Gwindow); int main(int argc

[JupyterLab集成 R 语言-Centos]-解决 x11 服务连接失败问题

我们两清 提交于 2021-02-09 19:02:10
JupyterLab 集成 R 语言 JupyterLab作为一个交互式的Python开发环境,同时具备强大的可扩展能力,支持包括 Java、R 等其他语言进行交互式开发的能力,确实称的上是一代神器。 最近因为公司业务需要,所以花了几天时间调研了一下关于 JupyterLab 中集成 R 内核的方案,中间碰到了一个比较恶心的问题,就是在 centos 服务器上无图形化界面时 X11 服务连接不上的问题。 查询了许多的相关资料,只能说网上相关的文档写的都挺乱的,所以才写了这篇文章,希望能给各位有需要的朋友一些帮助。 我用的服务器是 Centos7,直接安装的 Anaconda 环境,安装 R 环境之前需要做的前缀操作就是要配置对应的 Anaconda 环境变量,然后按照如下步骤走安装即可。 安装 R 语言环境 安装对应 Linux 依赖 yum install -y gcc yum install -y gcc-gfortran yum install -y gcc-c++ yum install -y glibc-headers yum install -y libreadline6-dev gfortran yum install -y readline-devel yum install -y wget libXt-devel yum install -y fonts

Installing Cairo and PyCairo Mac OsX

狂风中的少年 提交于 2021-01-28 01:52:06
问题 I am playing around with using python iGraph for network visualization. I got his error message when I tried to plot a graph: >>> layout = g.layout("kk") >>> plot(g, layout = layout) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build/bdist.macosx-10.5-x86_64/egg/igraph/drawing/__init__.py", line 446, in plot File "build/bdist.macosx-10.5-x86_64/egg/igraph/drawing/__init__.py", line 117, in __init__ File "build/bdist.macosx-10.5-x86_64/egg/igraph/drawing/utils

PyCairo指南--目录

Deadly 提交于 2020-12-24 01:06:30
PyCairo tutorial的翻译,其原文地址为: http://zetcode.com/gfx/pycairo/ 。 PyCairo指南 这是 PyCairo指南 。在这份指南中,我们将基于Python和Cairo库来学习2D图形编程。 内容目录 简介 后端 基本绘图 形状和填充 渐变 裁剪和蒙版 透明度 变换 文本 图片 根窗口 PyCairo PyCairo是一个用来与Cairo库一起工作的Python模块。他是到Cairo C库的Python绑定的集合。除了一些需要更加Pythonic的方式的情况,它与C API是紧密对应的。 相关的指南 Cairo graphics tutorial 基于C编程语言来说明Cairo库。 来源: oschina 链接: https://my.oschina.net/u/919237/blog/133430

Putting .SVG images into tkinter Frame

China☆狼群 提交于 2020-12-23 02:10:57
问题 I have been trying to put the image from https://betacssjs.chesscomfiles.com/bundles/web/favicons/safari-pinned-tab.f387b3f2.svg into a Tkinter frame. I found from the post here that it is possible with the help from rsvg and cairo. I was using python 3.6 on Windows 10. I got rsvg from here and cairo from here and then extracted the folders to the 'C:\Users...\site_packages' folder. They import fine but I cannot figure out how to use them. I tried using the code: import tkinter as tk main=tk

Putting .SVG images into tkinter Frame

最后都变了- 提交于 2020-12-23 01:45:51
问题 I have been trying to put the image from https://betacssjs.chesscomfiles.com/bundles/web/favicons/safari-pinned-tab.f387b3f2.svg into a Tkinter frame. I found from the post here that it is possible with the help from rsvg and cairo. I was using python 3.6 on Windows 10. I got rsvg from here and cairo from here and then extracted the folders to the 'C:\Users...\site_packages' folder. They import fine but I cannot figure out how to use them. I tried using the code: import tkinter as tk main=tk