转移填充区域的填充样式

By admin in 4858.com on 2019年3月30日

话不多说,间接上代码

//#pragma comment( linker, “/subsystem:\”windows\”
/entry:\”mainCRTStartup\”” )
#include<gl\glut.h>
#include<gl\GL.h>
#include<gl\glaux.h>
#include<iostream>

4858.com 1

您不爱好小编

var target = pattern.Target;
var name = pattern.Name;
var fpElem = FillPatternElement.GetFillPatternElementByName(doc, target, name);

using (var tran = new Transaction(doc, "FillPattern"))
{
       tran.Start();
       var selectionIds = app.ActiveUIDocument.Selection.GetElementIds();
       if (selectionIds != null && selectionIds.Any())
       {
            foreach (var id in selectionIds)
            {
                    FilledRegion elem = doc.GetElement(id) as FilledRegion;
                    if (elem != null && !elem.IsMasking)
                    {                                
                          OverrideGraphicSettings overrideGraphicSettings = new OverrideGraphicSettings();
                          overrideGraphicSettings = doc.ActiveView.GetElementOverrides(elem.Id);
                          overrideGraphicSettings.SetProjectionFillPatternId(fpElem.Id);
                          doc.ActiveView.SetElementOverrides(elem.Id, overrideGraphicSettings);
                    }
             }                        
        }
        tran.Commit();
}

#include<gl\glut.h>
#include<math.h>
using namespace std;
#define PI 3.1415926
#define R 100
#define r 50
int a1[5];
int b1[5];
int a2[5];
int b2[5];

4858.com 2

您只喜爱他

 

float *old_color = new float[3];
float *转移填充区域的填充样式。new_color = new float[3];
float *new_color2 = new float[3];
float *old_color2 = new float[3];

那么

 

只要自个儿变成了他

void Init() {
old_color[0] = 1;
old_color[1] = 1;
old_color[2] = 0;
new_color[0] = 1;
new_color[1] = 1;
new_color[2] = 1;

您是否就会欣赏了?

new_color2[0] = 0;
new_color2[1] = 0;
new_color2[2] = 1;

old_color2[0] = 1;
old_color2[1] = 0;
old_color2[2] = 1;
glClearColor(0, 1.0, 1, 1.0);
gluOrtho2D(-200, 200, 200, -200);
}

自小编变成了他

float *GetColor(int x, int y) {
float *color = new float[3];
glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, color);
//cout << color[0] << ” ” << color[1] << ” ”
<< color[2] << endl;
return color;
}

您会不会欣赏小编啊?

 

不爱好作者的您

void SetColor(int x, int y, float rc, float gc, float bc) {
4858.com,glColor3f(rc, gc, bc);
glBegin(GL_POINTS);
/*if (x > 0&&y>0) {
glVertex2d(x – 200, y – 200);
}
else if(x<0&&y<0){
glVertex2d(x +200, y + 200);
}
else if (x<0 && y>0) {
glVertex2d(x + 200, y – 200);
}
else if (x>0 && y<0) {
glVertex2d(x – 200, y + 200);
}*/
glVertex2d(x , y );
cout << “hehhe” <<endl;
glEnd();
glFlush();
}

还真是不听话啊

void FloodFill4(int x, int y, float old_color1[3] ,float
new_color1[3])
{
float* color;
color =GetColor(x, y);
//cout << color[0] << ” ” << color[1] << ” ”
<< color[2] << endl;
//cout << old_color1[0] << ” ” << old_color1[1]
<< ” ” << old_color1[2] << endl;
if (color[0]==old_color1[0]&& color[1] == old_color1[1] &&
color[2] == old_color1[2])
{
cout << color[0] << ” ” << color[1] << ” ”
<< color[2] << endl;
cout << old_color1[0] << ” ” << old_color1[1]
<< ” ” << old_color1[2] << endl;

小婴孩待在自笔者爱的牢房里糟糕呢?

SetColor(x, y, new_color1[0], new_color1[1], new_color1[2]);
//glFlush();
FloodFill4(x, y + 1, old_color1, new_color1);
FloodFill4(x, y – 1, old_color1, new_color1);
FloodFill4(x – 1, y, old_color1, new_color1);
FloodFill4(x + 1, y, old_color1, new_color1);
}
if (color[0] == old_color2[0] && color[1] == old_color2[1] &&
color[2] == old_color2[2])
{
cout << color[0] << ” ” << color[1] << ” ”
<< color[2] << endl;
cout << old_color1[0] << ” ” << old_color1[1]
<< ” ” << old_color1[2] << endl;

家弦户诵笔者曾经成为她了啊

SetColor(x, y, new_color2[0], new_color2[1], new_color2[2]);
//glFlush();
FloodFill4(x, y + 1, old_color1, new_color1);
FloodFill4(x, y – 1, old_color1, new_color1);
FloodFill4(x – 1, y, old_color1, new_color1);
FloodFill4(x + 1, y, old_color1, new_color1);
}

明日的菜你一定会喜欢的啊

}

正是她哟

void Calculate() {
int angle = 40;
for (int i = 0; i < 5; i++) {

您喜不喜欢呢?

a1[i] = 200+R*cos(angle*PI / 180);
b1[i] = 200+R*sin(angle*PI / 180);
a2[i] = 200+r*cos(PI / 5 + angle*PI / 180);
b2[i] = 200+r*sin(PI / 5 + angle*PI / 180);
cout << a1[i] << b1[i] << endl;
angle += 72;
}
}

void CALLBACK draw() {
Calculate();
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
for (int i = 0;i < 5;i++) {
glColor3f(1, 1, 0);
glVertex2f(a1[i], b1[i]);
glVertex2f(a2[i], b2[i]);
glVertex2f(200, 200);
glColor3f(1, 0, 1);
glVertex2f(a2[i], b2[i]);
if (i < 4) {
glVertex2f(a1[i + 1], b1[i + 1]);
}
else {
glVertex2f(a1[0], b1[0]);
}
glVertex2f(200, 200);
}
glEnd();
glFlush();
FloodFill4(200,200, old_color, new_color);
}

不希罕呢?

 

那就吃笔者的肉吧

void main()
{
//{
// glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
// glutInitWindowPosition(100, 100);
// glutInitWindowSize(400, 400);
// glutCreateWindow(“第一个 OpenGL 程序”);
// Init();
// glutDisplayFunc(draw);
//
// //
// glutMainLoop();
auxInitDisplayMode(AUX_SINGLE | AUX_RGBA);
auxInitPosition(100, 100, 500, 500);
auxInitWindow(L”填充”);

您总算喜欢笔者了

Init();
auxMainLoop(draw);

那小编就到底全体被您吃掉

}

也没有关系的哦

不可以!

不得以逃走!

你分明是我的!

快回来!

啊,为啥要不听话呢

那样的话

您就不再会被填充上你协调了

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图
Copyright @ 2010-2019 美高梅手机版4858 版权所有