void ComboBox::createTexture(void) { static Kernel *kernel = Kernel::getInstance(); if ((_cTexture = kernel->getWidgetTexture(COMBOBOX)) != NULL) return; // create texture object _cTexture = new ComponentTexture(15, 17); kernel->setWidgetTexture(COMBOBOX, _cTexture); _cTexture->setTextureEnvMode(GL_MODULATE); // middle _cTexture->addTexture(Point(0, 0), MatrixTemplate<ColorRGBA>(1, 1, ColorRGBA(255,255,255,255))); // lines _cTexture->addTexture(Point(1, 0), MatrixTemplate<ColorRGBA>(1, 1, ColorRGBA(100,100,100,255))); // button _cTexture->addTexture(Point(0, 1), 15, 16, data::ScrollPaneVerticalButton); // selects _cTexture->addTexture(Point(2, 0), ColorRGBA(220, 220, 220, 100)); _cTexture->addTexture(Point(3, 0), ColorRGBA(120, 120, 120, 100)); // generate texture _cTexture->createTexture(); }
bool PERect::initWithSize(float width, float height) { if (!PERealNode::init()) { return false; } m_width = width; m_height = height; m_data = (float *)malloc(sizeof(float)*(12+8+12)); //coord m_data[0] = -0.5*m_width; m_data[1] = -0.5*m_height; m_data[2] = 0.0; m_data[3] = -0.5*m_width; m_data[4] = 0.5*m_height; m_data[5] = 0.0; m_data[6] = 0.5*m_width; m_data[7] = 0.5*m_height; m_data[8] = 0.0; m_data[9] = 0.5*m_width; m_data[10] = -0.5*m_height; m_data[11] = 0.0; //texCoord m_data[12] = 0.0; m_data[13] = 0.0; m_data[14] = 0.0; m_data[15] = 1.0; m_data[16] = 1.0; m_data[17] = 1.0; m_data[18] = 1.0; m_data[19] = 0.0; //normal m_data[20] = 0.0; m_data[21] = 0.0; m_data[22] = 1.0; m_data[23] = 0.0; m_data[24] = 0.0; m_data[25] = 1.0; m_data[26] = 0.0; m_data[27] = 0.0; m_data[28] = 1.0; m_data[29] = 0.0; m_data[30] = 0.0; m_data[31] = 1.0; //material m_material.ambient = ColorRGBA(0.2, 0.2, 0.2, 0.1); m_material.diffuse = ColorRGBA(0.7, 0.7, 0.7, 0.7); m_material.specular = ColorRGBA(0.95, 0.95, 1.0, 1.0); m_material.emission = ColorRGBA(0.0, 0.0, 0.0, 0.0); return true; }
int main() { // Build scene SceneList scene; scene.push_back(new Sphere(Point3(-320,0,50), 200.0f, ColorRGBA(255,0,0,255))); scene.push_back(new Sphere(Point3(320, 0, 50), 200.0f, ColorRGBA(0, 0, 255, 255))); scene.push_back(new Sphere(Point3(0, 0, -50), 200.0f, ColorRGBA(0, 255, 0, 255))); scene.push_back(new Plane(Vector3(0,1,0), Vector3(0, -150, 0), ColorRGBA(255,255,255,255))); // Render the scene RayTraceSettings settings; settings.resolutionWidth = 600; settings.resolutionHeight = 480; settings.depth = 255; settings.clearColor = ColorRGB(50,50,50); settings.eyePosition = Point3(0, 0, 600); RayTracer rayTracer(settings); rayTracer.renderScene(scene); rayTracer.saveToFile("rayTracerTest.tga"); // Clean up the scene std::for_each(scene.begin(), scene.end(), deleteDynamicObject()); return 0; }
void ColorPicker::processMouse(const scv::MouseEvent &evt) { static Kernel *kernel = Kernel::getInstance(); static Cursor * cursor = Cursor::getInstance(); if (!_receivingCallbacks) { Component::processMouse(evt); } else { Panel::processMouse(evt); } if (!_receivingCallbacks) return; if (_pickerWaitingColor) { kernel->lockMouseUse(this); cursor->forceCursor(kernel->glfwWindow, GLFW_CROSSHAIR_CURSOR); glReadPixels(evt.getPosition().x, evt.getInversePosition().y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &_currentColor); setSpinsColor(); onColorChange(); if (evt.getState() == MouseEvent::CLICK && evt.getButton() == MouseEvent::LEFT) { _btPicker->setState(false); _pickerWaitingColor = false; _currentColorPosition = foundHSL(); createTexture(); } } else { if (isInside(evt.getPosition()) && kernel->requestMouseUse(this)) { if (isFocused()) { Point relativeMouse = evt.getPosition()-getAbsolutePosition(); if (relativeMouse.x < MatrixTemplate<ColorRGBA>::getWidth() && relativeMouse.y < MatrixTemplate<ColorRGBA>::getHeight()) { cursor->forceCursor(kernel->glfwWindow, GLFW_CROSSHAIR_CURSOR); if (evt.getState() == MouseEvent::CLICK && evt.getButton() == MouseEvent::LEFT) { _isDragging = false; _currentColorPosition = relativeMouse; _currentColor = ColorRGBA(MatrixTemplate<ColorRGBA>::get(_currentColorPosition.y,_currentColorPosition.x)); setSpinsColor(); onColorChange(); onMouseClick(evt); } else if (evt.getState() == MouseEvent::HOLD && evt.getButton() == MouseEvent::LEFT) { kernel->lockMouseUse(this); _isDragging = false; _currentColorPosition = relativeMouse; _currentColor = ColorRGBA(MatrixTemplate<ColorRGBA>::get(_currentColorPosition.y,_currentColorPosition.x)); setSpinsColor(); onColorChange(); onMouseDrag(evt); } else if (evt.getState() == MouseEvent::UP) { kernel->unlockMouseUse(this); } } } } else if (evt.getState() == MouseEvent::UP) { kernel->unlockMouseUse(this); } } }
void CoordinateSystemProvider::update(ImageCoordinateSystem& imageCoordinateSystem) { Geometry::Line horizon = Geometry::calculateHorizon(theCameraMatrix, theCameraInfo); imageCoordinateSystem.origin = horizon.base; imageCoordinateSystem.rotation.c[0] = horizon.direction; imageCoordinateSystem.rotation.c[1] = Vector2<double>(-horizon.direction.y, horizon.direction.x); imageCoordinateSystem.invRotation = imageCoordinateSystem.rotation.transpose(); RotationMatrix r(theCameraMatrix.rotation.transpose() * prevCameraMatrix.rotation); imageCoordinateSystem.offset = Vector2<double>(r.getZAngle(), r.getYAngle()); calcScaleFactors(imageCoordinateSystem.a, imageCoordinateSystem.b); imageCoordinateSystem.offsetInt = Vector2<int>(int(imageCoordinateSystem.offset.x * 1024 + 0.5), int(imageCoordinateSystem.offset.y * 1024 + 0.5)); imageCoordinateSystem.aInt = int(imageCoordinateSystem.a * 1024 + 0.5); imageCoordinateSystem.bInt = int(imageCoordinateSystem.b * 1024 + 0.5); imageCoordinateSystem.cameraInfo = theCameraInfo; prevCameraMatrix = theCameraMatrix; prevTime = theFilteredJointData.timeStamp; DECLARE_DEBUG_DRAWING("horizon", "drawingOnImage"); // displays the horizon ARROW("horizon", imageCoordinateSystem.origin.x, imageCoordinateSystem.origin.y, imageCoordinateSystem.origin.x + imageCoordinateSystem.rotation.c[0].x * 50, imageCoordinateSystem.origin.y + imageCoordinateSystem.rotation.c[0].y * 50, 1, Drawings::ps_solid, ColorRGBA(255,0,0)); ARROW("horizon", imageCoordinateSystem.origin.x, imageCoordinateSystem.origin.y, imageCoordinateSystem.origin.x + imageCoordinateSystem.rotation.c[1].x * 50, imageCoordinateSystem.origin.y + imageCoordinateSystem.rotation.c[1].y * 50, 1, Drawings::ps_solid, ColorRGBA(255,0,0)); GENERATE_DEBUG_IMAGE(corrected, INIT_DEBUG_IMAGE_BLACK(corrected); int yDest = -imageCoordinateSystem.toCorrectedCenteredNeg(0, 0).y; for(int ySrc = 0; ySrc < theImage.cameraInfo.resolutionHeight; ++ySrc) for(int yDest2 = -imageCoordinateSystem.toCorrectedCenteredNeg(0, ySrc).y; yDest <= yDest2; ++yDest) { int xDest = -imageCoordinateSystem.toCorrectedCenteredNeg(0, ySrc).x; for(int xSrc = 0; xSrc < theImage.cameraInfo.resolutionWidth; ++xSrc) { for(int xDest2 = -imageCoordinateSystem.toCorrectedCenteredNeg(xSrc, ySrc).x; xDest <= xDest2; ++xDest) { DEBUG_IMAGE_SET_PIXEL_YUV(corrected, xDest + int(theCameraInfo.opticalCenter.x + 0.5), yDest + int(theCameraInfo.opticalCenter.y + 0.5), theImage.image[ySrc][xSrc].y, theImage.image[ySrc][xSrc].cb, theImage.image[ySrc][xSrc].cr); } } } SEND_DEBUG_IMAGE(corrected); );
void Block::updateLevel() { switch(_blockLevel) { case 0: _shape.setColor(ColorRGBA(200,0,0,150)); break; case 1: _shape.setColor(ColorRGBA(0,200,0,150)); break; case 2: _shape.setColor(ColorRGBA(0,0,200,150)); break; case 3: _shape.setColor(ColorRGBA(200,200,0,150)); break; } }
void ColorPicker::refreshColor(void) { _currentPickerColor = ColorRGBA((unsigned char)_rgbs[0]->getValue(), (unsigned char)_rgbs[1]->getValue(), (unsigned char)_rgbs[2]->getValue()); if (_saturation != _rgbs[3]->getValue()) { _saturation = _rgbs[3]->getValue(); createTexture(); _currentColor = ColorRGBA(MatrixTemplate<ColorRGBA>::get(_currentColorPosition.y, _currentColorPosition.x)); setSpinsColor(); onColorChange(); } else if (_currentPickerColor != _currentColor) { _currentColor = _currentPickerColor; onColorChange(); } }
void ColorPicker::createColors(void) { float S = (float)_rgbs[3]->getValue() / 100.f; for (int L = 100; L > 0 ; L--) { for (int H = 0; H < 360 ; H++) { set((100 - L) + 1, H, ColorRGBA::toRGB((float)H, L / 100.0f, S)); } } for (int H = 0; H < 360 ; H++) { set(0, H, ColorRGBA(255,255,255,255)); set(101, H, ColorRGBA(0,0,0,255)); } }
void draw() { engine->controller.updateMouse(); pos_x = engine->controller.getMousePos().x; pos_y = engine->controller.getMousePos().y; renderer->drawQuad(square,Point3f(pos_x+100,pos_y,0),pos_y*1.0,pos_y*1.0,rot); renderer->drawQuad(square2,Point3f(pos_x,pos_y,-.01),pos_y*1.0,pos_y*1.0,rot*.9); renderer->drawQuad(square3,Point3f(pos_x-100,pos_y,-.02),pos_y*1.0,pos_y*1.0,rot*.8); renderer->drawText("default font","Scale 1",Point3f(100,100,0),ColorRGBA(1,1,1,1),8,1.0); renderer->drawText("default font","Scale 2",Point3f(100,200,0),ColorRGBA(1,1,1,1),8*2,2.0); renderer->drawText("default font","Scale 3",Point3f(100,300,0),ColorRGBA(1,1,1,1),8*3,3.0); renderer->drawText("default font",std::to_string(engine->t).c_str(),Point3f(100,400,0),ColorRGBA(1,1,1,1),8*10,10.0); renderer->drawBuffer(); }; //executes as often as possible
void ImageCoordinateSystem::draw() const { DECLARE_DEBUG_DRAWING("horizon", "drawingOnImage"); // displays the horizon ARROW("horizon", origin.x, origin.y, origin.x + rotation.c[0].x * 50, origin.y + rotation.c[0].y * 50, 0, Drawings::ps_solid, ColorRGBA(255, 0, 0)); ARROW("horizon", origin.x, origin.y, origin.x + rotation.c[1].x * 50, origin.y + rotation.c[1].y * 50, 0, Drawings::ps_solid, ColorRGBA(255, 0, 0)); }
void CSkins::OnInit() { m_EventSkinPrefix[0] = '\0'; if(g_Config.m_Events) { time_t rawtime; struct tm* timeinfo; time(&rawtime); timeinfo = localtime(&rawtime); if(timeinfo->tm_mon == 11 && timeinfo->tm_mday >= 24 && timeinfo->tm_mday <= 26) { // Christmas str_copy(m_EventSkinPrefix, "santa", sizeof(m_EventSkinPrefix)); } } // load skins m_aSkins.clear(); Storage()->ListDirectory(IStorage::TYPE_ALL, "skins", SkinScan, this); if(!m_aSkins.size()) { Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load skins. folder='skins/'"); CSkin DummySkin; DummySkin.m_IsVanilla = true; DummySkin.m_OrgTexture = -1; DummySkin.m_ColorTexture = -1; str_copy(DummySkin.m_aName, "dummy", sizeof(DummySkin.m_aName)); DummySkin.m_BloodColor = ColorRGBA(1.0f, 1.0f, 1.0f); m_aSkins.add(DummySkin); } }
void ExtendedBallPercept::draw() const { DECLARE_DEBUG_DRAWING("representation:ExtendedBallPercepts:Image", "drawingOnImage"); // drawing of representation BallPercept DECLARE_DEBUG_DRAWING("representation:ExtendedballPercepts:Field", "drawingOnField"); // drawing of representation BallPercept if(isValidBallPercept) { CIRCLE("representation:ExtendedBallPercepts:Image", positionInImage.x, positionInImage.y, radiusInImage, 2, // pen width Drawings::ps_solid, ColorClasses::black, Drawings::bs_solid, ColorRGBA(255,128,64,100)); CIRCLE("representation:ExtendedBallPercepts:Field", relativePositionOnField.x, relativePositionOnField.y, 45, 1, // pen width Drawings::ps_solid, ColorClasses::orange, Drawings::bs_null, ColorClasses::orange); } }
void BallPercept::draw() const { DECLARE_DEBUG_DRAWING("representation:BallPercept:Image", "drawingOnImage"); DECLARE_DEBUG_DRAWING("representation:BallPercept:Field", "drawingOnField"); DECLARE_DEBUG_DRAWING3D("representation:BallPercept", "origin"); TRANSLATE3D("representation:BallPercept", 0, 0, -230); if(ballWasSeen) { CIRCLE("representation:BallPercept:Image", positionInImage.x, positionInImage.y, radiusInImage, 1, // pen width Drawings::ps_solid, ColorClasses::black, Drawings::bs_solid, ColorRGBA(255, 128, 64, 100)); CIRCLE("representation:BallPercept:Field", relativePositionOnField.x, relativePositionOnField.y, 35, 0, // pen width Drawings::ps_solid, ColorClasses::orange, Drawings::bs_null, ColorClasses::orange); // Sorry, no access to field dimensions here, so ball radius is hard coded SPHERE3D("representation:BallPercept", relativePositionOnField.x, relativePositionOnField.y, 35, 35, ColorClasses::orange); } }
void KmlGenerator::putStationStyle() { startStyle("StationStyle"); putLabelStyle(ColorRGBA(0x00,0x00,0x00,0x00), NORMAL, 0.0f); //invisible labels putIconStyle(stationIconHref, Offset(), 0.25f, 0.0f); //custom icon endStyle(); skipLine(); }
void ColoringSettingsDialog::readPreferenceEntries(INIFile& inifile) { PreferencesEntry::readPreferenceEntries(inifile); if ( inifile.hasEntry("COLORING_OPTIONS", "ResidueNames") && inifile.hasEntry("COLORING_OPTIONS", "ResidueNameColors")) { String residue_names = inifile.getValue("COLORING_OPTIONS", "ResidueNames"); String residue_name_colors = inifile.getValue("COLORING_OPTIONS", "ResidueNameColors"); std::vector<String> split_names; residue_names.split(split_names); std::vector<String> split_colors; residue_name_colors.split(split_colors); if (split_names.size() != split_colors.size()) { Log.warn() << "ColoringSettingsDialog::fetchPreferences: residue name coloring in inifile is invalid!" << std::endl; } std::vector<ColorRGBA> split_color_rgba(split_colors.size()); for (Position i=0; i<split_color_rgba.size(); ++i) { split_color_rgba[i] = ColorRGBA(split_colors[i]); } residue_table_->setContent(split_names, split_color_rgba); } }
//加入多边形 bool GameFootprint::AddPolygon(long vertexCount, const D3DXVECTOR3 *vertex, const D3DXVECTOR3 *normal) { long count = decalVertexCount; if (count + vertexCount >= maxDecalVertices) return (false); // Add polygon as a triangle fan Triangle *triangle = triangleArray + decalTriangleCount; decalTriangleCount += vertexCount - 2; for (long a = 2; a < vertexCount; a++) { triangle->index[0] = (unsigned short) count; triangle->index[1] = (unsigned short) (count + a - 1); triangle->index[2] = (unsigned short) (count + a); triangle++; } // Assign vertex colors float f = 1.0F / (1.0F - decalEpsilon); for (long b = 0; b < vertexCount; b++) { vertexArray[count] = vertex[b]; const D3DXVECTOR3& n = normal[b]; float alpha = (DotProduct(decalNormal, n) / D3DXVec3Length(&n) - decalEpsilon) * f; colorArray[count] = ColorRGBA(1.0F, 1.0F, 1.0F, (alpha > 0.0F) ? alpha : 0.0F); count++; } decalVertexCount = count; return (true); }
void ObstacleWheelBH::drawCone(const Cone& cone) const { float rightAngle = cone.angle; float leftAngle = cone.angle + coneWidth; Vector2BH<float> leftBorder(static_cast<float>(wheelRadius), 0.f); Vector2BH<float> rightBorder(leftBorder); leftBorder = leftBorder.rotate(leftAngle); rightBorder = rightBorder.rotate(rightAngle); LINE("representation:ObstacleWheelBH:wheel", 0, 0, leftBorder.x, leftBorder.y, 1, Drawings::ps_solid, ColorRGBA(0x00, 0x00, 0xFF, 0x0F)); if(cone.spot.seenCount > 0) { Vector2BH<float> left(cone.distance, 0); Vector2BH<float> right(cone.distance, 0); left.rotate(leftAngle); right.rotate(rightAngle); ColorClasses::Color col = ColorClasses::green; if(cone.hasObstacle) { col = ColorClasses::red; } LINE("representation:ObstacleWheelBH:wheel", left.x, left.y, right.x, right.y, 8, Drawings::ps_solid, col); } }
//---------------------------------------------------------------------------- ColorRGBA operator* (fixed fScalar, const ColorRGBA& rkC) { return ColorRGBA( fScalar*rkC[0], fScalar*rkC[1], fScalar*rkC[2], fScalar*rkC[3]); }
void RobotModelBH::draw() const { DECLARE_DEBUG_DRAWING3D("representation:RobotModelBH", "origin"); COMPLEX_DRAWING3D("representation:RobotModelBH", { for(int i = 0; i < MassCalibrationBH::numOfLimbs; ++i) { const Pose3DBH& p = limbs[i]; const Vector3BH<>& v = p.translation; const Vector3BH<> v1 = p * Vector3BH<>(50, 0, 0); const Vector3BH<> v2 = p * Vector3BH<>(0, 50, 0); const Vector3BH<> v3 = p * Vector3BH<>(0, 0, 50); LINE3D("representation:RobotModelBH", v.x, v.y, v.z, v1.x, v1.y, v1.z, 1, ColorRGBA(255, 0, 0)); LINE3D("representation:RobotModelBH", v.x, v.y, v.z, v2.x, v2.y, v2.z, 1, ColorRGBA(0, 255, 0)); LINE3D("representation:RobotModelBH", v.x, v.y, v.z, v3.x, v3.y, v3.z, 1, ColorRGBA(0, 0, 255)); } });
//---------------------------------------------------------------------------- ColorRGBA ColorRGBA::operator+ (const ColorRGBA& rkC) const { return ColorRGBA( m_afTuple[0] + rkC.m_afTuple[0], m_afTuple[1] + rkC.m_afTuple[1], m_afTuple[2] + rkC.m_afTuple[2], m_afTuple[3] + rkC.m_afTuple[3]); }
//---------------------------------------------------------------------------- ColorRGBA ColorRGBA::operator- (const ColorRGBA& rkC) const { return ColorRGBA( m_afTuple[0] - rkC.m_afTuple[0], m_afTuple[1] - rkC.m_afTuple[1], m_afTuple[2] - rkC.m_afTuple[2], m_afTuple[3] - rkC.m_afTuple[3]); }
//---------------------------------------------------------------------------- ColorRGBA ColorRGBA::operator* (const ColorRGBA& rkC) const { return ColorRGBA( m_afTuple[0]*rkC.m_afTuple[0], m_afTuple[1]*rkC.m_afTuple[1], m_afTuple[2]*rkC.m_afTuple[2], m_afTuple[3]*rkC.m_afTuple[3]); }
Block::Block() { _blockLevel = 0; _isBlockAlive = true; _shape.setSize(blockWidth, blockHeight); _shape.setOrigin(blockWidth / 2.f, blockHeight / 2.f); _shape.setColor(ColorRGBA(200,0,0,150)); }
//---------------------------------------------------------------------------- ColorRGBA ColorRGBA::operator* (fixed fScalar) const { return ColorRGBA( fScalar*m_afTuple[0], fScalar*m_afTuple[1], fScalar*m_afTuple[2], fScalar*m_afTuple[3]); }
//---------------------------------------------------------------------------- ColorRGBA ColorRGBA::operator* (float fScalar) const { return ColorRGBA( fScalar*mTuple[0], fScalar*mTuple[1], fScalar*mTuple[2], fScalar*mTuple[3]); }
void BodyContour::draw() const { DECLARE_DEBUG_DRAWING("representation:BodyContour", "drawingOnImage"); DECLARE_DEBUG_DRAWING("representation:BodyContour:maxY", "drawingOnImage"); COMPLEX_DRAWING("representation:BodyContour", { for(std::vector<Line>::const_iterator i = lines.begin(); i != lines.end(); ++i) LINE("representation:BodyContour", i->p1.x, i->p1.y, i->p2.x, i->p2.y, 1, Drawings::ps_solid, ColorRGBA(255, 0, 255)); for(int x = 0; x < cameraResolution.x; x += 10) { int y = cameraResolution.y; clipBottom(x, y); LINE("representation:BodyContour", x, y, x, cameraResolution.y, 1, Drawings::ps_solid, ColorRGBA(255, 0, 255)); } });
Point ColorPicker::foundHSL(void) { _currentPickerColor = ColorRGBA((unsigned char)_rgbs[0]->getValue(), (unsigned char)_rgbs[1]->getValue(), (unsigned char)_rgbs[2]->getValue()); float hls[3]; ColorRGBA colorHLS = _currentPickerColor; colorHLS.toHLS(hls); _saturation = hls[2] * 100.f; _rgbs[3]->setValue(_saturation); return Point((int)(hls[0]*360),(int)(100.f-hls[1]*99.f-1.f)); }
void ColorTest::ColorTypeConversionTests() { Color3f white(1.f, 1.f, 1.f); ColorBGRA result = white.toBGR(255); CPPUNIT_ASSERT_EQUAL(ColorBGRA(0xFFFFFFFF), result); CPPUNIT_ASSERT_EQUAL(Color::fromRGBA(ColorRGBA(0xFF000000)), Color(0, 0, 0, 255)); CPPUNIT_ASSERT_EQUAL(Color::fromRGBA(ColorRGBA(0x00FF0000)), Color(0, 0, 255, 0)); CPPUNIT_ASSERT_EQUAL(Color::fromRGBA(ColorRGBA(0x0000FF00)), Color(0, 255, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color::fromRGBA(ColorRGBA(0x000000FF)), Color(255, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color::fromBGRA(ColorBGRA(0xFF000000)), Color(0, 0, 0, 255)); CPPUNIT_ASSERT_EQUAL(Color::fromBGRA(ColorBGRA(0x00FF0000)), Color(255, 0, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color::fromBGRA(ColorBGRA(0x0000FF00)), Color(0, 255, 0, 0)); CPPUNIT_ASSERT_EQUAL(Color::fromBGRA(ColorBGRA(0x000000FF)), Color(0, 0, 255, 0)); CPPUNIT_ASSERT_EQUAL(Color::fromBGRA(ColorBGRA(0xFFa8d0df)), Color(168, 208, 223, 255)); }
void BallPercept::draw() const { DECLARE_DEBUG_DRAWING("representation:BallPercept:image", "drawingOnImage"); DECLARE_DEBUG_DRAWING("representation:BallPercept:field", "drawingOnField"); DECLARE_DEBUG_DRAWING3D("representation:BallPercept", "robot"); TRANSLATE3D("representation:BallPercept", 0, 0, -230); if(status == seen) { CIRCLE("representation:BallPercept:image", positionInImage.x(), positionInImage.y(), radiusInImage, 1, // pen width Drawings::solidPen, ColorRGBA::black, Drawings::solidBrush, ColorRGBA(255, 128, 64, 100)); CIRCLE("representation:BallPercept:field", positionOnField.x(), positionOnField.y(), radiusOnField, 0, // pen width Drawings::solidPen, ColorRGBA::orange, Drawings::noBrush, ColorRGBA::orange); SPHERE3D("representation:BallPercept", positionOnField.x(), positionOnField.y(), radiusOnField, radiusOnField, ColorRGBA::orange); } else if(status == guessed) CIRCLE("representation:BallPercept:image", positionInImage.x(), positionInImage.y(), radiusInImage, 1, // pen width Drawings::solidPen, ColorRGBA::black, Drawings::solidBrush, ColorRGBA(64, 128, 255, 90)); }
void GoalPercept::draw() const { const ColorRGBA goalPerceptColor = ColorRGBA::yellow; DECLARE_DEBUG_DRAWING("representation:GoalPercept:Image", "drawingOnImage"); DECLARE_DEBUG_DRAWING("representation:GoalPercept:Field", "drawingOnField"); DECLARE_DEBUG_DRAWING3D("representation:GoalPercept", "robot"); TRANSLATE3D("representation:GoalPercept", 0, 0, -230); ColorRGBA color = ColorRGBA(220, 220, 220); for(unsigned int i = 0; i < goalPosts.size(); ++i) { const GoalPost& p = goalPosts.at(i); if(p.position != GoalPost::IS_UNKNOWN) { CIRCLE("representation:GoalPercept:Field", p.positionOnField.x(), p.positionOnField.y(), 50, 0, Drawings::solidPen, goalPerceptColor, Drawings::solidBrush, color); LINE("representation:GoalPercept:Field", p.positionOnField.x(), p.positionOnField.y(), p.positionOnField.x(), p.positionOnField.y() + (p.position == GoalPost::IS_LEFT ? -700 : 700), 60, Drawings::solidPen, goalPerceptColor); MID_DOT("representation:GoalPercept:Image", p.positionInImage.x(), p.positionInImage.y(), goalPerceptColor, color); LINE("representation:GoalPercept:Image", p.positionInImage.x(), p.positionInImage.y(), p.positionInImage.x(), 0, 5, Drawings::solidPen, goalPerceptColor); if(p.position == GoalPost::IS_LEFT) DRAWTEXT("representation:GoalPercept:Image", p.positionInImage.x() + 10, 40, 36, goalPerceptColor, "L"); else if(p.position == GoalPost::IS_RIGHT) DRAWTEXT("representation:GoalPercept:Image", p.positionInImage.x() - 30, 40, 36, goalPerceptColor, "R"); } else { CIRCLE("representation:GoalPercept:Field", p.positionOnField.x(), p.positionOnField.y(), 50, 0, Drawings::solidPen, ColorRGBA(255, 0, 0), Drawings::solidBrush, goalPerceptColor); MID_DOT("representation:GoalPercept:Image", p.positionInImage.x(), p.positionInImage.y(), ColorRGBA(255, 0, 0), goalPerceptColor); LINE("representation:GoalPercept:Image", p.positionInImage.x(), p.positionInImage.y(), p.positionInImage.x(), 0, 5, Drawings::dottedPen, goalPerceptColor); } // Sorry, no access to field dimensions here, so the dimensions are hard coded CYLINDER3D("representation:GoalPercept", p.positionOnField.x(), p.positionOnField.y(), 400, 0, 0, 0, 50, 800, goalPerceptColor); LINE3D("representation:GoalPercept", 0, 0, 1.f, p.positionOnField.x(), p.positionOnField.y(), 1.f, 2.f, goalPerceptColor); } }