标签: drawellipse

cv :: Scalar不显示预期的颜色

在图像框架上,我使用

void ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar& color, int thickness=1, int lineType=8, int shift=0)

绘制一个椭圆,我想将椭圆颜色设置为绿色 在此输入图像描述[RGB值:(165,206,94)].所以我将参数设置const Scalar& color

cv::Scalar(94.0, 206.0, 165.0, 0.0); // as BGR order, suppose the value is 0.0 - 255.0
cv::Scalar(94.0/255.0, 206.0/255.0, 165.0/255.0, 0.0); // suppose the value is 0.0 - 1.0
Run Code Online (Sandbox Code Playgroud)

我也试过RGB替代品.

CV_RGB(165.0, 206.0, 94.0); // as RGB order, suppose the value is 0.0 - 255.0
CV_RGB(165.0/255.0, 206.0/255.0, 94.0/255.0); // suppose the value is 0.0 …
Run Code Online (Sandbox Code Playgroud)

c++ opencv colors ios drawellipse

7
推荐指数
2
解决办法
2万
查看次数

如何使用QPainter绘制单色椭圆(无黑色边框)

开头的代码:

QColor yellow("#f0d048");
Qt::BrushStyle style = Qt::SolidPattern;
QBrush brush(yellow, style);
painter.setBrush(brush);
painter.drawEllipse(10,10,10,10);
Run Code Online (Sandbox Code Playgroud)

每次我这样做,我得到一个黄色圆圈,周围是黑色的1像素大小的边框.总的来说,圆圈将具有相同的尺寸,就像我用黑色绘制一样,那么我该怎样才能得到一个没有黑色边框的单色黄色圆圈?

最好的祝福

c++ qt qpainter drawellipse

4
推荐指数
1
解决办法
4696
查看次数

让眼球注视/跟随光标移动 (C#)

我被困在这里了。我想在“看着”光标(的角度)时绘制眼睛。此外,它应该包含在更大的圆圈/象限内(就像眼球一样)。可悲的是,它只是不会在正确的位置/角度和每次鼠标移动时吸引我的注意力。它唯一要做的就是最初在 (0,0) 处绘制一个椭圆,但这不是我想要的。

我的想法是用毕达哥拉斯定理计算三角形的比率。然后在方法中应用正确的坐标(具有正确的比例)drawEllipse();。每次移动光标时都应重复此操作。

您可以检查我的图像以进行数学推理。 在此输入图像描述

这是我的代码,请注意,面板是在设计器模式下制作的,该模式不包含在此代码中,但应该不是什么大问题:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace oogjes2
{
    public partial class Form1 : Form
    {
        public int mousex;
        public int mousey;

        public Form1()
        {
            InitializeComponent();
            panel1.Paint += paintpanel;
            panel1.MouseMove += panel1_MouseMove;     
        }

        //panel1 cover the screen from (0.0) and onwards,
        void panel1_MouseMove(object sender, MouseEventArgs mea)
        {
            int mousex = mea.X;
            int mousey = mea.Y;
        } 

        void paintpanel(object obj, PaintEventArgs …
Run Code Online (Sandbox Code Playgroud)

c# mouseevent mouse-position drawellipse

4
推荐指数
1
解决办法
3831
查看次数

透明椭圆

你如何用GDI绘制透明椭圆?我试过SetBkMode()但我仍然得到一个白色的椭圆形bk.

case WM_PAINT:
{
    hdc = BeginPaint(hwnd, &ps);
    SetBkMode(hdc, TRANSPARENT); // doesnt work
    Ellipse(hdc, 0,0,500,500);
    EndPaint(hwnd, &ps);
    break;
}
Run Code Online (Sandbox Code Playgroud)

c++ geometry gdi drawellipse

3
推荐指数
1
解决办法
5501
查看次数

对于新的Rectangle()c#,浮点参数而不是int?

对于c#中的Rectangle类,是否可以使用float作为参数float而不是int?或者我可以通过创建一个类似于Rectangle的新类来实现这一点,并将其作为参数浮点数?

我试图在内部使用它e.Graphics.DrawEllipse.

示例:

e.Graphics.DrawEllipse(new Pen(Brushes.Black, stroke), new Rectangle(10,20,30,40);
Run Code Online (Sandbox Code Playgroud)

而不是10,20,30,40我想使用花车.

任何帮助赞赏.谢谢.

c# geometry drawellipse

3
推荐指数
1
解决办法
3875
查看次数

尝试在WPF窗口中绘制椭圆,但它不可见

我正在尝试创建自己的图形用户控件,我已经有一个已经在win表单上工作,我正在尝试将其移动到WPF世界中.

我开始学习如何绘图,所以我首先尝试绘制一个填充整个窗口的黑色椭圆,只是为了了解坐标在WPF中是如何工作的.

所以这里是代码,当我运行应用程序时,没有显示任何内容,任何想法我错过了什么?

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    protected override void OnRender(DrawingContext drawingContext)
    {
        base.OnRender(drawingContext);

        drawingContext.DrawEllipse(Brushes.Black, new Pen(Brushes.Black, 1), new Point(Width / 2, Height / 2), Width / 2, Height / 2);
    }
}
Run Code Online (Sandbox Code Playgroud)

wpf draw drawellipse drawingcontext onrender

2
推荐指数
1
解决办法
1926
查看次数

无法在C#中的表单加载上绘制椭圆

我正在尝试在包含C#中的formload上的PNG的图片框中绘制一些椭圆。当我在下面执行代码时,我会看到椭圆半秒钟,然后再也看不到它们了。

当我单击图片框时,我可以绘制一个椭圆,但是当我最小化表单时,它们不再显示。

我读到您不应该将绘图代码放在formload中,而应该放在OnPaint方法中,这就是我所做的。我不知道该怎么办了。谢谢。(请注意,我已经留下一些代码注释以显示我尝试过的内容)。

public partial class FormParterre : Form
{
    Graphics g;
    float circleSize = 15;
    //Brushes rouge = new Brushes (Brushes.Red);

    ReservationBilletSiegeDAO reservationBilletSiegeDAO = new ReservationBilletSiegeDAO();
    SiegeDAO siegeDAO = new SiegeDAO();

    List <Siege> sieges;
    List<ReservationBilletSiege> rbs;
    ReservationBillet reservationBillet = new ReservationBillet();
    ReservationBilletSiege reservationBilletSiege;

    SolidBrush semiTransBrush;


    public FormParterre()
    {
        InitializeComponent();
        pictureBox1.Image = new Bitmap("./parterre.png");
        g = pictureBox1.CreateGraphics();


    }

    public FormParterre(ReservationBillet rb)
    {
        reservationBillet = rb;
        pictureBox1.Image = new Bitmap("./parterre.png");
        g = pictureBox1.CreateGraphics();



        InitializeComponent();
    }

    protected override void OnPaintBackground(PaintEventArgs e)
    { …
Run Code Online (Sandbox Code Playgroud)

c# paint form-load drawellipse

1
推荐指数
1
解决办法
3943
查看次数