x11 color-drawing

2024-08-22 12:08
文章标签 color x11 drawing

本文主要是介绍x11 color-drawing,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

彩色绘画

  1. 获取屏幕颜色空间
      screen_colormap = DefaultColormap(display, DefaultScreen(display));
    
  2. 通过颜色名分配颜色结构体
      rc = XAllocNamedColor(display, screen_colormap, "red", &red, &red);if (rc == 0) {fprintf(stderr, "XAllocNamedColor - failed to allocated 'red' color.\n");exit(1);}
    
  3. 四个角落各画了一个小红点
      XSetForeground(display, gc, red.pixel);XDrawPoint(display, win, gc, 5, 5);XDrawPoint(display, win, gc, 5, height-5);XDrawPoint(display, win, gc, width-5, 5);XDrawPoint(display, win, gc, width-5, height-5);
    
  4. 两条棕色的线条
      XSetForeground(display, gc, brown.pixel);XDrawLine(display, win, gc, 50, 0, 50, 200);XDrawLine(display, win, gc, 0, 100, 200, 100);
    
  5. 花了一个蓝色的圆
      XSetForeground(display, gc, blue.pixel);XDrawArc(display, win, gc, 50-(30/2), 100-(30/2), 30, 30, 0, 360*64);
    
  6. 通过相邻点画黄色的线条组
        XSetForeground(display, gc, yellow.pixel);XDrawLines(display, win, gc, points, npoints, CoordModeOrigin);
    
  7. 画一个矩形
      XSetForeground(display, gc, BlackPixel(display, screen_num));XDrawRectangle(display, win, gc, 120, 150, 50, 60);
    
  8. 画一个填充的矩形
      XSetForeground(display, gc, green.pixel);XFillRectangle(display, win, gc, 60, 150, 50, 60);
    

这篇关于x11 color-drawing的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1096229

相关文章

三色标记(Tri-color marking)

维基百科部分 原文 https://en.wikipedia.org/wiki/Tracing_garbage_collection#TRI-COLOR Because of these performance problems, most modern tracing garbage collectors implement some variant of the tri-color ma

linux下查看您当前是 Xorg(X11) 还是 Wayland方法

linux下查看您当前是 Xorg(X11) 还是 Wayland方法 方法如下(都是终端执行): echo $XDG_SESSION_TYPE 如果输出为wayland,则当前在 Wayland 环境中。 如果输出为x11,则当前在 X11 环境中。 或者 systemctl status display-manager 或者 loginctl show-session $(lo

HDU 1556 Color the ball (树状数组-- 区间更新,单点求值)

OJ题目 :点这里~~ 与 单点更新,区间求值 稍有不同,需要理解注意。 AC_CODE int n;int num[100002];int lowbit(int x){return x&(-x);}int sum(int x){int ret = 0;while(x > 0){ret += num[x];x -= lowbit(x);}return ret;}void ad

x11转发远程图形界面

1、 开一个有vnc的节点 2、 开放所有用户的Xserver权限 xhost + 3、X11转发 ssh hlzhang@192.168.3.156 -X 4、打开远程窗口 paraview 在227的界面打开156的图形窗口

[C++] 将LONG类型的color值转换为RGB值

转换原理: The calculation is: (65536 * Blue) + (256 * Green) + (Red) 'Convert RGB to LONG: LONG = B * 65536 + G * 256 + R       'Convert LONG to RGB:  B = LONG \ 65536  G = (LONG - B * 65536) \ 256  R =

记一次解析Pantone Color TCX 色彩码

第一次尝试解析TCX 第二次尝试解析TPG 第三次一次到位TCX&TPG ①打开潘通·中国官网 ②在找寻潘通色彩一栏输入TCX,提交 ③浏览器F12,找到搜索结果所在的div,右键copy element ④文本文档修改文件类型为js,并粘贴上一部的结果,将其赋值给str str='<div class="colorInfo" id="fashionColorDiv"><a class

ABAP OOALV 颜色COLOR设置

文章目录 行颜色、列颜色、单元格颜色设置COLOR行颜色设定实现过程运行结果 列颜色的设置实现过程运行结果 设置单元格颜色完成过程运行结果1运行结果2 行颜色、列颜色、单元格颜色设置COLOR 行颜色设定 参考文章:https://blog.csdn.net/Leo520liang/article/details/138697189 实现过程 TYPES: BEG

改进的《Combining Sketch and Tone for Pencil Drawing Production》铅笔画算法

随着深度学习越来越热,在图像领域,通过卷积神经网络训练的模型可以得到很酷炫的图像风格化效果,比如app store上的prisma应用,可以获得很好的效果,但是速度要稍微慢一些。不过传统的数学方法也可以做的很好,需要的只是你的想象力以及算法设计能力。        本文实现的铅笔画算法,基于论文《Combining Sketch and Tone for Pencil Dr

poj 2154 Color(polya计数 + 欧拉函数优化)

http://poj.org/problem?id=2154 大致题意:由n个珠子,n种颜色,组成一个项链。要求不同的项链数目,旋转后一样的属于同一种,结果模p。 n个珠子应该有n种旋转置换,每种置换的循环个数为gcd(i,n)。如果直接枚举i,显然不行。但是我们可以缩小枚举的数目。改为枚举每个循环节的长度L,那么相应的循环节数是n/L。所以我们只需求出每个L有多少个i满足gcd(

A. Find Color

A. Find Color time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Not so long ago as a result of combat operations the main Berl