Drawing Text(一)绘制文本

[Qt学习笔记]QT下获取Halcon图形窗口鼠标事件并执行相应操作 在视觉项目开发过程中碰到了需要使用Halcon进行图像算法开发的需求,估计很多视觉工程师都用到过Halcon软件开发库,但是完成Halcon算法开发后就会遇到一个问题,就是图像的显示、读写、UI交互等问题,由于Halcon具有特殊的图像文件格式HObject和数据格式HTuple,所以说需要格式转换后才能实现相对应的操作,不过Halcon本身也有比较实用的显示、界面交互的功能,所以如何在C++或QT下使用这些功能成为了接下来需要去研究和实践的工作 阅读详情

1.Enumerating and Loading Fonts(枚举出系统字体,并正确加载)

    Font families -> Font faces 

-(void) enumerateFonts {

    for (NSString *familyName in[UIFont familyNames]) {

        NSLog(@"Font Family = %@ --",familyName); 

        for (NSString *fontName in[UIFont fontNamesForFamilyName:familyName]) {

            NSLog(@"\t%@",fontName);

         // 通过列举出的系统预定义字体,可对其进行正确加载,不会出现nil

         // UIFont *font = [UIFont fontWithName:fontName size:12.0f];

        }       

    }

}

//默认系统字休:Helvetica 

+(UIFont *)systemFontOfSize:(CGFloat)fontSize;

+(UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;

+(UIFont *)fontWithName:(NSString *)fontNamesize:(CGFloat)fontSize

2.绘制文本 

- (void)drawAtPoint:(CGPoint)point withAttributes:(NSDictionary *)attrs


#import "View.h"

@implementation CustomerView 

-(id)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];

    if(self) {

        //initialization code

    }

    return self;

}

-(void)drawRect:(CGRect)rect {

    UIFont *helveticaBold = [UIFont fontWithName:@"HelveticaNeue-Bold" size: 40.0f];

    NSString *specialString = @"Special String";

    [specialString  drawAtPoint:CGPointMake(40,180) 

               withAttributes:@{ NSFontAttributeName:helveticaBold } ];

}

@end



Part3:Drawing Text /用OpenGL 绘制文本 来自:http://www.codeproject.com/Articles/30775/TetroGL-An-OpenGL-Game-Tutorial-in-C-for-Win32-pla 1、Drawing Text  CGameFont 类 2、CGameFont 类的辅助CTextControl类 3、如何输出汉字 1、Drawing Text  CGameFont 类 阅读详情

相关推荐

【控件功能】我来做练习-第27课-Drawing and text in opengl, use mouse to draw lines

Drawing and text in opengl, use mouse to draw lines

大龙软件工作室 1251

Drawing Text(二)绘制文本,颜色的使用

//颜色构造 -- alpha:[0,1] 0-完全透明 1-不透明 [UIColor redColor], ..... + (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha  //设置绘制的起始位置及样式属性 - (void)drawAtP

berained的专栏 2716

Unity动态图像生成利器:System.Drawing与Texture2D高效转换实践

在游戏开发与交互应用领域,动态图像生成是常见的需求,其核心原理在于将CPU端的绘图指令高效转换为GPU可用的纹理数据。传统上,开发者可能直接操作Texture2D进行像素级处理,但在涉及复杂矢量图形、精确文字排版或批量绘制时,这种方式往往面临性能瓶颈和代码复杂度高的挑战。通过引入成熟的2D图形库(如System.Drawing),可以在内存中完成复杂的绘图计算,再通过一次性的纹理上传实现渲染分离,从而显著提升处理效率并优化代码结构。这一技术方案特别适用于Unity中需要动态生成图标、图表、地图预览或用户创作

weixin_34345753的博客 355

C# System.Drawing.Text 使用自定义字体或本地字体

使用自定义字体:        PrivateFontCollection prc = new PrivateFontCollection();        prc.AddFontFile("自定义字体路径");        Font f = new Font(prc.Families[0], 12);使用本地字体:        InstalledFontCollection fc = ne...

Ray 7865

C# Log4Net不输出日志的解决方法

log4net是一个流行的 .NET 日志框架,用于记录应用程序的日志信息。如果你在使用log4net。

精通搬砖,资深技术砖家,在软件开发,人工智能,设备开发等领域都有研究。商业合作&交流学习可私信联系。 1263

中文顶刊《会计研究》文本分析技术最新进展总结盘点

会计研究》是由中华人民共和国财政部主管、中国会计学会主办的国家一级学术期刊,为会计领域中文顶级期刊。随着大数据技术的日益成熟, 社交网络类文本 、上市公司披露类文本、媒体报道类文本、 其他类文本 、网络搜索数据、P2P 网络借贷文 本与分析师报告等文本数据逐渐成为财务会计的研究素材。

qq_52891550的博客 2891

ImageDraw.textsize()和ImageDraw.text()的使用举例

参考链接: ImageDraw.text(xy, text, fill=None, font=None, anchor=None, spacing=4, align=‘left’, direction=None, features=None, language=None, stroke_width=0, stroke_fill=None, embedded_color=False) 参考链接: ImageDraw.textsize(text, font=None, spacing=4, direction=

敲代码的小风 1万+

基于AIS动态数据与AI结合得经纬度标示算法

港口船舶智能标注系统 本系统通过结合摄像头视频流和AIS船舶动态数据,利用AI技术实现船舶实时标注功能。系统架构包括视频流处理、AIS数据解析、船舶检测匹配和坐标映射转换等模块。关键技术步骤: AIS数据获取:通过本地接收机或网络API获取船舶位置、航速等信息 AI目标检测:采用YOLOv8等模型识别视频中的船舶 船舶匹配算法:通过位置投影或运动轨迹匹配视频目标与AIS数据 坐标映射:使用相机标定技术将经纬度转换为图像坐标 实时标注:在视频画面上叠加船名、位置等关键信息 应用场景包括港口监控、智能海事管理和

qianbo042311的博客 1808

HenCoder Android 开发进阶:自定义 View 1-3 文字的绘制

这期是 HenCoder 自定义绘制的第三期:文字的绘制。 之前的内容在这里:HenCoder Android 开发进阶 自定义 View 1-1 绘制基础HenCoder Android 开发进阶 自定义 View 1-2 Paint 详解 如果你没听说过 HenCoder,可以先看看这个:HenCoder:给高级 Android 工程师的进阶手册 简介 上期的 Paint 详解里已经说过,文...

weixin_33796205的博客 617

Dify学习笔记-知识库(六)

Dify学习笔记-知识库

大数据知识梳理 2万+

【AGC】【serverless】【云函数】云函数常见问题

1、云函数添加了AUTH触发器后,在用户执行注册、销户、登录、登出动作时,云函数的event对象会自动触发返回相应信息。比如我在“层”的压缩包里放了config/config.txt,那么我在云函数里怎么调用这个文件?层的目录是:/dcache/layer,函数的目录是/dcache/layer/func。在云函数里往云数据库里插入数据返回的是180000,这是正常吗?已经按照文档在后台对应的云函数里配置了,所需的AUTH触发器。层的用法和放在函数里的用法是相同的。云函数里的层如何调用?

华为开发者联盟 839

OpenCV 3 drawing text string - 绘制文本字符串

OpenCV 3 drawing text string - 绘制文本字符串 OpenCV documentation index - OpenCV 文档索引 https://www.docs.opencv.org/ master (4.x) https://www.docs.opencv.org/master/ 3.4 (3.4.x) https://www.docs.opencv.org/3.4/ 2.4 (2.4.x) https://www.docs.opencv.org/2.4/ 1. 3.4 (

程永强 1859

windows 下AD9361的 no-os master 工程搭建

参考网站: https://wiki.analog.com/resources/fpga/docs/build#windows_environment_setup https://wiki.analog.com/resources/eval/user-guides/ad-fmcomms2-ebz/software/no-os-setup 参考博客: https://blog.csdn.net...

Bronceyang的博客 7292

python中用于绘制各种图形、标注文本_python ImageDraw类实现几何图形的绘制与文字的绘制...

python PIL图像处理模块中的ImageDraw类支持各种几何图形的绘制和文本的绘制,如直线、椭圆、弧、弦、多边形以及文字等。下面直接通过示例来进行说明:#-*- coding: UTF-8 -*-import numpy as npfrom PIL import Imagefrom PIL import ImageDrawfrom PIL import ImageFontdef draw_...

weixin_39621975的博客 440

企业微信第三方应用014_企业微信5种第三方应用的安装方式_上架到应用市场_服务商后台点击安装测试_生成应用推广二维码安装---企业微信开发016

成员授权的意思就是,只要是这个成员扫码安装了这个应用,那么这个应用就只有这个成员可以用。安装的时候可以设置可见范围,这个地方可以设置整个公司或者是某个部门或者是某些人可以让这个应用来进行操作。创建了以后,这个二维码就可以发出来进行推广别人用户扫描了以后就可以把自己的企业微信给安装上对应的应用了。然后在对应的这个微信的企业后台就可以看到在第三方中有这个应用了。可以看到这个就是服务商的后台对应的一个应用,我们点击打开应用。可以看到这里有两个授权,一个是成员授权,一个是管理员授权。就可以去创建推广二维码了。

添柴程序猿的专栏 589

Python爬虫实战:如何爬取12306列车信息

本文介绍了如何使用Python编写爬虫,抓取12306列车信息。我们讲解了如何分析12306的列车数据接口,如何发送HTTP请求,解析返回的JSON数据,并将数据保存到本地文件中。我们还讨论了如何绕过反爬虫机制,如使用随机User-Agent和设置请求延时。通过这个实战项目,你应该掌握了如何爬取并解析来自公共API的数据,同时提高了你的爬虫技能。这些技能不仅适用于12306列车信息抓取,也可以广泛应用于其他需要抓取JSON数据的网站。

2201_76125261的博客 1922

Text-to-Drawing:用CLIP+可微渲染实现可控手绘生成

文本到手绘合成(Text-to-Drawing Synthesis)是一种突破传统文生图范式的AI绘画技术,其核心在于将绘画过程建模为可微分优化问题,而非像素级图像生成。它依托CLIP模型实现跨模态语义对齐,结合可微分绘图器(如贝塞尔曲线渲染器)显式控制线条、笔触与构图逻辑,从而支持艺术风格解耦、过程可干预、结果可解释等关键能力。相比Stable Diffusion等扩散模型,该技术在UI原型设计、插画草图生成、品牌视觉延展等需强风格一致性与作者意图保留的场景中展现出独特优势。CLIPDraw与StyleC

weixin_30326741的博客 400

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

dotnet OpenXML 文本 Text Line Break 的作用

本文主要和小伙伴聊 a:br 这个标记的作用 在 OpenXML 的 <a:br/> 的定义是 Text Line Break 是放在文本的 <a:p> 的标记,用于表示换行 如 ECMA 376 文档的 21.1.2.2.1 所说,这个标记的作用是在一段内,将两个 TextRun 使用一个垂直的换行分割。这个元素可以具备当前的 rPr (RunProperties)...

lindexi 891

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

AI_NovelGenerator 实测:用 AI 小说生成写长篇,第 50 章后的一致性从哪来

写到第三十章,你才发现主角的眼睛从蓝写成了绿。这个坑,长篇 AI 小说生成跑到几十章才踩得出来。AI_NovelGenerator 干的正是这件事:把设定、大纲、章节写作、审校串成一条流水线,故事不会越写越跑题。 ## 从世界观到成稿的四段流水线 打开界面填好主题和类型后,它先不急着写章节,而是产出全书架构——分几章、每章往哪走。下一关蓝图把它拆细:每章的核心事件、哪条人物线该推进,一条条钉死

gitblog_01056的博客 603

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【鸿蒙之路】利用OH_Drawing_Bitmap将文本渲染成OpenGL纹理

【代码】【鸿蒙之路】利用OH_Drawing_Bitmap将文本渲染成OpenGL纹理。

咕咕岵沽的博客 356

python draw.text颜色_python wand:用draw.text()改变文本样式

使用wand.drawing.Drawing,您需要构建绘图对象的“上下文”.可以通过直接在绘图对象实例上设置属性来定义字体样式,族,系列,颜色等等.from wand.image import Imagefrom wand.color import Colorfrom wand.drawing import Drawingfrom wand.display import displaywith ...

weixin_42397141的博客 2969

kRPC服务生态:SpaceCenter、Drawing与UI模块功能全解析

kRPC是Kerbal Space Program (KSP)的远程过程调用服务,它允许开发者通过多种编程语言与游戏进行交互,实现自动化控制、数据获取和自定义界面等功能。本文将深入解析kRPC生态中的三大核心模块——SpaceCenter、Drawing和UI,帮助新手快速掌握它们的功能与应用方法。 [![kRPC服务运行界面](https://raw.gitcode.com/gh_mirror

gitblog_00618的博客 249

System.Drawing.Text.TextRenderingHint 的几种效果

    for (int i = 0; i &lt; 6; i++) { g5.TextRenderingHint = (System.Drawing.Text.TextRenderingHint)i; string txt; int ...

weixin_33743703的博客 540

Drawing 2D stuff

正如您在之前的教程中所了解的那样,SFML的窗口模块提供了一种打开OpenGL窗口的简单方法,但在绘制某些东西时,SFML没有帮助,于是只能选择功能强大但复杂的底层OpenGL API。幸运的是,SFML提供了一个图形模块,可以比OpenGL更简单的方式绘制2D实体。要绘制图形模块提供的实体,必须使用专门的窗口类:sf::RenderWindow。该类派生自sf::Window,并继承其所有函数。关于sf::Window的所有知识(创建、事件处理、控制帧速率、与OpenGL混合等)也适用于sf::Rende

Phantom_matter的博客 849

Drawing Simple Text:画简单的文本

// Set the desired font if different from default font.Font font = new Font("Serif", Font.PLAIN, 12);g2d.setFont(font);// Draw the string such that its base line is at x, y.g2d.drawString("a

Javahaoshuang3394的专栏 642

Drawing text

We begin with drawing some Unicode text on the client area of a window. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we draw text in Russian azbuka. ...

weixin_34417814的博客 138
上一篇: jQuery Mobile 页面事件
下一篇: Drawing Text(二)绘制文本,颜色的使用
berained
博客等级 码龄20年 14粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值