/************************************************************************* Create initialise and return a ListHeaderSegment object, with all events subscribed and ready to use. *************************************************************************/ ListHeaderSegment* ListHeader::createInitialisedSegment(const String& text, uint id, const UDim& width) { // Build unique name std::stringstream name; name << SegmentNameSuffix << d_uniqueIDNumber; // create segment. ListHeaderSegment* newseg = createNewSegment(name.str().c_str()); d_uniqueIDNumber++; // setup segment; newseg->setSize(USize(width, cegui_reldim(1.0f))); newseg->setMinSize(USize(cegui_absdim(MinimumSegmentPixelWidth), cegui_absdim(0))); newseg->setText(text); newseg->setID(id); newseg->setSizingEnabled(d_sizingEnabled); newseg->setDragMovingEnabled(d_movingEnabled); newseg->setClickable(d_sortingEnabled); // subscribe events we listen to newseg->subscribeEvent(ListHeaderSegment::EventSegmentSized, Event::Subscriber(&CEGUI::ListHeader::segmentSizedHandler, this)); newseg->subscribeEvent(ListHeaderSegment::EventSegmentDragStop, Event::Subscriber(&CEGUI::ListHeader::segmentMovedHandler, this)); newseg->subscribeEvent(ListHeaderSegment::EventSegmentClicked, Event::Subscriber(&CEGUI::ListHeader::segmentClickedHandler, this)); newseg->subscribeEvent(ListHeaderSegment::EventSplitterDoubleClicked, Event::Subscriber(&CEGUI::ListHeader::segmentDoubleClickHandler, this)); newseg->subscribeEvent(ListHeaderSegment::EventSegmentDragPositionChanged, Event::Subscriber(&CEGUI::ListHeader::segmentDragHandler, this)); return newseg; }
//------------------------------------------------------------------------------// bool InventoryReceiver::addItemAtLocation(InventoryItem& item, int x, int y) { if (itemWillFitAtLocation(item, x, y)) { InventoryReceiver* old_receiver = dynamic_cast<InventoryReceiver*>(item.getParent()); if (old_receiver) old_receiver->removeItem(item); item.setLocationOnReceiver(x, y); writeItemToContentMap(item); addChild(&item); // set position and size. This ensures the items visually match the // logical content map. item.setPosition(UVector2(UDim(static_cast<float>(x) / contentWidth(), 0), UDim(static_cast<float>(y) / contentHeight(), 0))); item.setSize(USize( UDim(static_cast<float>(item.contentWidth()) / contentWidth(), 0), UDim(static_cast<float>(item.contentHeight()) / contentHeight(), 0))); return true; } return false; }
//--------------------------------------------------------------------------------------- void TopLevelCaretPositioner::layout_caret(Caret* pCaret, DocCursor* pCursor) { m_pCursor = pCursor; m_state = m_pCursor->get_state(); ImoId id = m_state.get_parent_level_id(); GmoBox* pBox = m_pGModel->get_box_for_imo(id); URect pos; if (pBox) pos = pBox->get_bounds(); else { //at end of document pBox = get_box_for_last_element(); if (pBox) { pos.set_top_left( UPoint(pBox->get_left(), pBox->get_bottom()) ); pos.set_height(1000.0f); pos.set_width(1000.0f); } else { //empty document pos = URect(0.0f, 0.0f, 1000.0f, 1000.0f); } } pCaret->set_type(Caret::k_top_level); pCaret->set_top_level_box(pos); pCaret->set_position( pos.get_top_left() ); pCaret->set_size( USize(pos.get_width(), pos.get_height()) ); }
//--------------------------------------------------------------------------------------- void CheckboxCtrl::on_draw(Drawer* pDrawer, RenderOptions& UNUSED(opt)) { select_font(); Color color = (m_fEnabled ? m_currentColor : Color(192, 192, 192)); pDrawer->set_text_color(color); URect pos = determine_text_position_and_size(); pDrawer->begin_path(); pDrawer->fill( Color(0,0,0,0) ); pDrawer->stroke(color); pDrawer->stroke_width( pos.height * 0.075f ); pDrawer->rect(UPoint(m_pos.x, m_pos.y +100.0f), USize(400.0f, 400.0f), 50.0f); pDrawer->end_path(); pDrawer->draw_text(pos.x + 600.0f, pos.y, m_label); if (m_status) { // pDrawer->draw_text(pos.x + 50.0f, pos.y, "X"); pDrawer->begin_path(); pDrawer->fill(color); pDrawer->add_path(*this); pDrawer->end_path(); } }
//----------------------------------------------------------------------------// void HorizontalLayoutContainer::layout() { // used to compare UDims const float absHeight = getChildContentArea().get().getHeight(); // this is where we store the left offset // we continually increase this number as we go through the windows UDim leftOffset(0, 0); UDim layoutHeight(0, 0); for (ChildList::iterator it = d_children.begin(); it != d_children.end(); ++it) { Window* window = static_cast<Window*>(*it); const UVector2 offset = getOffsetForWindow(window); const UVector2 boundingSize = getBoundingSizeForWindow(window); // full child window width, including margins const UDim& childHeight = boundingSize.d_y; if (CoordConverter::asAbsolute(layoutHeight, absHeight) < CoordConverter::asAbsolute(childHeight, absHeight)) { layoutHeight = childHeight; } window->setPosition(offset + UVector2(leftOffset, UDim(0, 0))); leftOffset += boundingSize.d_x; } setSize(USize(leftOffset, layoutHeight)); }
//--------------------------------------------------------------------------------------- void ScoreCaretPositioner::caret_on_pointed_object(Caret* pCaret) { URect bounds = get_bounds_for_imo( m_spState->id(), m_spState->staff() ); bounds.x -= tenths_to_logical(1); set_caret_y_pos_and_height(&bounds, m_spState->id(), m_spState->staff()); pCaret->set_type(Caret::k_line); pCaret->set_position( bounds.get_top_left() ); pCaret->set_size( USize(bounds.get_width(), bounds.get_height()) ); set_caret_timecode(pCaret); }
//--------------------------------------------------------------------------------------- USize HyperlinkCtrl::measure() { if (m_width < 0.0f || m_height < 0.0f) { select_font(); TextMeter meter(m_libraryScope); if (m_width < 0.0f) m_width = meter.measure_width(m_label); if (m_height < 0.0f) m_height = meter.get_font_height(); } return USize(m_width, m_height); }
//----------------------------------------------------------------------------// LayoutContainer::LayoutContainer(const String& type, const String& name): Window(type, name), d_needsLayouting(false), d_clientChildContentArea(this, static_cast<Element::CachedRectf::DataGenerator>(&LayoutContainer::getClientChildContentArea_impl)) { // layout should take the whole window by default I think setSize(USize(cegui_reldim(1), cegui_reldim(1))); subscribeEvent(Window::EventChildAdded, Event::Subscriber(&LayoutContainer::handleChildAdded, this)); subscribeEvent(Window::EventChildRemoved, Event::Subscriber(&LayoutContainer::handleChildRemoved, this)); }
//--------------------------------------------------------------------------------------- void ScoreCaretPositioner::caret_on_empty_timepos(Caret* pCaret) { //cursor is between two staffobjs, on a free time position. //Place caret between both staffobjs. Interpolate position based on cursor time //get info for current ref. object ImoId refId = m_pScoreCursor->staffobj_id_internal(); int refStaff = m_pScoreCursor->ref_obj_staff(); //get info for prev object SpElementCursorState spState = m_pScoreCursor->get_state(); m_pScoreCursor->move_prev(); ImoId prevId = m_pScoreCursor->id(); int prevStaff = m_pScoreCursor->staff(); TimeUnits prevTime = m_pScoreCursor->time(); m_pScoreCursor->restore_state(spState); URect boundsPrev = get_bounds_for_imo(prevId, prevStaff); URect bounds = get_bounds_for_imo(refId, refStaff); #if 1 //interpolate position //TODO: linear interpolation is wrong. This has to be changed to use time-grid TimeUnits time1 = prevTime; TimeUnits time2 = m_spState->time(); TimeUnits time3 = m_spState->ref_obj_time(); LUnits xIncr = bounds.x - boundsPrev.x; // Ax = x3-x1 bounds.x = boundsPrev.x + (xIncr * float((time2 - time1) / (time3 - time1)) ); #else //determine x position based on TimeGridTable TimeUnits time = m_pScoreCursor->time(); int iSystem = m_pGModel->get_system_for(m_pScore->get_id(), m_pScoreCursor->instrument(), m_pScoreCursor->measure(), time); m_pBoxSystem = m_pGModel->get_system_box(iSystem); TimeGridTable* pTimeGrid = m_pBoxSystem->get_time_grid_table(); bounds.x = pTimeGrid->get_x_for_time(time); #endif //set caret set_caret_y_pos_and_height(&bounds, prevId, prevStaff); pCaret->set_type(Caret::k_line); pCaret->set_position( bounds.get_top_left() ); pCaret->set_size( USize(bounds.get_width(), bounds.get_height()) ); set_caret_timecode(pCaret); }
//----------------------------------------------------------------------------// Window* GridLayoutContainer::createDummy() { char i_buff[32]; sprintf(i_buff, "%lu", d_nextDummyIdx); ++d_nextDummyIdx; Window* dummy = WindowManager::getSingleton().createWindow("DefaultWindow", DummyName + String(i_buff)); dummy->setAutoWindow(true); dummy->setVisible(false); dummy->setSize(USize(UDim(0, 0), UDim(0, 0))); dummy->setDestroyedByParent(true); return dummy; }
/************************************************************************* Set the width of the specified column. *************************************************************************/ void ListHeader::setColumnWidth(uint column, const UDim& width) { if (column >= getColumnCount()) { CEGUI_THROW(InvalidRequestException( "specified column index is out of range for this ListHeader.")); } else { d_segments[column]->setSize(USize(width, d_segments[column]->getSize().d_height)); layoutSegments(); // Fire segment sized event. WindowEventArgs args(d_segments[column]); onSegmentSized(args); } }
//--------------------------------------------------------------------------------------- Image::Image() : m_error("") { //Build default img: grey square 24x24 px m_bmpSize = VSize(24, 24); //TODO: get display reolution from lomse initialization. Here it is assumed 96 ppi m_imgSize = USize(24.0 * 2540.0f / 96.0f, 24.0 * 2540.0f / 96.0f); m_format = k_pix_format_rgba32; //allocate a buffer for the bitmap int bmpsize = 24 * 24 * 4; //24px width, 24px height, 4bytes per pixel (RGBA) if ((m_bmap = (unsigned char*)malloc(bmpsize)) == NULL) { LOMSE_LOG_ERROR("[Image constructor]: not enough memory for image buffer"); throw runtime_error("[Image constructor]: not enough memory for image buffer"); } unsigned char no_image = 0x77; memset(m_bmap, no_image, bmpsize); }
//----------------------------------------------------------------------------// void ScrollablePane::initialiseComponents(void) { // get horizontal scrollbar Scrollbar* horzScrollbar = getHorzScrollbar(); // get vertical scrollbar Scrollbar* vertScrollbar = getVertScrollbar(); // get scrolled container widget ScrolledContainer* container = getScrolledContainer(); // do a bit of initialisation horzScrollbar->setAlwaysOnTop(true); vertScrollbar->setAlwaysOnTop(true); // container pane is always same size as this parent pane, // scrolling is actually implemented via positioning and clipping tricks. container->setSize(USize(cegui_reldim(1.0f), cegui_reldim(1.0f))); // subscribe to events we need to hear about vertScrollbar->subscribeEvent( Scrollbar::EventScrollPositionChanged, Event::Subscriber(&ScrollablePane::handleScrollChange, this)); horzScrollbar->subscribeEvent( Scrollbar::EventScrollPositionChanged, Event::Subscriber(&ScrollablePane::handleScrollChange, this)); d_contentChangedConn = container->subscribeEvent( ScrolledContainer::EventContentChanged, Event::Subscriber(&ScrollablePane::handleContentAreaChange, this)); d_autoSizeChangedConn = container->subscribeEvent( ScrolledContainer::EventAutoSizeSettingChanged, Event::Subscriber(&ScrollablePane::handleAutoSizePaneChanged, this)); // finalise setup configureScrollbars(); }
//--------------------------------------------------------------------------------------- void ScoreCaretPositioner::caret_at_end_of_staff(Caret* pCaret) { //cursor is at end of a staff or end of score. Score is not empty. //No current staffobj but a previous one must exist. //Place cursor 0.8 lines (8 tenths) at the right of last staffobj //get info for prev object SpElementCursorState spState = m_pScoreCursor->get_state(); m_pScoreCursor->move_prev(); ImoId id = m_pScoreCursor->id(); int staff = m_pScoreCursor->staff(); m_pScoreCursor->restore_state(spState); URect bounds = get_bounds_for_imo(id, staff); bounds.x += tenths_to_logical(8); set_caret_y_pos_and_height(&bounds, id, staff); pCaret->set_type(Caret::k_line); pCaret->set_position( UPoint(bounds.right(), bounds.top()) ); pCaret->set_size( USize(bounds.get_width(), bounds.get_height()) ); set_caret_timecode(pCaret); }
//--------------------------------------------------------------------------------------- void ScoreCaretPositioner::caret_at_start_of_score(Caret* pCaret) { //Cursor is at end of score but score is empty. //Place cursor at start of first system //get shape for first system DocCursorState state = m_pDocCursor->get_state(); ImoId scoreId = state.get_parent_level_id(); //GmoShapeStaff* pShape = m_pGModel->get_shape_for_first_staff_in_first_system(scoreId); GmoBoxScorePage* pBSP = static_cast<GmoBoxScorePage*>( m_pGModel->get_box_for_imo(scoreId) ); m_pBoxSystem = dynamic_cast<GmoBoxSystem*>(pBSP->get_child_box(0)); GmoShapeStaff* pShape = (m_pBoxSystem ? m_pBoxSystem->get_staff_shape(0) : NULL); URect bounds; if (pShape) { bounds = pShape->get_bounds(); bounds.x += m_pMeter->tenths_to_logical(20, 0, 0); } else { //score totally empty. No staff displayed! Position cursors at start of page //TODO bounds = URect(0.0f, 0.0f, 20.0f, 700.0f); // uPos.y = pBPage->GetYTop(); // uPos.x = pBPage->GetXLeft() + pScore->tenths_to_logical(20); } set_caret_y_pos_and_height(&bounds, k_no_imoid, 0); pCaret->set_type(Caret::k_line); pCaret->set_position( bounds.get_top_left() ); pCaret->set_size( USize(bounds.get_width(), bounds.get_height()) ); set_caret_timecode(pCaret); }
//----------------------------------------------------------------------------// void Element::addElementProperties() { const String propertyOrigin("Element"); CEGUI_DEFINE_PROPERTY(Element, URect, "Area", "Property to get/set the unified area rectangle. Value is a \"URect\".", &Element::setArea, &Element::getArea, URect(UDim(0, 0), UDim(0, 0), UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY_NO_XML(Element, UVector2, "Position", "Property to get/set the unified position. Value is a \"UVector2\".", &Element::setPosition, &Element::getPosition, UVector2(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, VerticalAlignment, "VerticalAlignment", "Property to get/set the vertical alignment. Value is one of \"Top\", \"Centre\" or \"Bottom\".", &Element::setVerticalAlignment, &Element::getVerticalAlignment, VA_TOP ); CEGUI_DEFINE_PROPERTY(Element, HorizontalAlignment, "HorizontalAlignment", "Property to get/set the horizontal alignment. Value is one of \"Left\", \"Centre\" or \"Right\".", &Element::setHorizontalAlignment, &Element::getHorizontalAlignment, HA_LEFT ); CEGUI_DEFINE_PROPERTY_NO_XML(Element, USize, "Size", "Property to get/set the unified size. Value is a \"USize\".", &Element::setSize, &Element::getSize, USize(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, USize, "MinSize", "Property to get/set the unified minimum size. Value is a \"USize\".", &Element::setMinSize, &Element::getMinSize, USize(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, USize, "MaxSize", "Property to get/set the unified maximum size. Value is a \"USize\". " "Note that zero means no maximum size.", &Element::setMaxSize, &Element::getMaxSize, USize(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, AspectMode, "AspectMode", "Property to get/set the 'aspect mode' setting. Value is either \"Ignore\", \"Shrink\" or \"Expand\".", &Element::setAspectMode, &Element::getAspectMode, AM_IGNORE ); CEGUI_DEFINE_PROPERTY(Element, float, "AspectRatio", "Property to get/set the aspect ratio. Only applies when aspect mode is not \"Ignore\".", &Element::setAspectRatio, &Element::getAspectRatio, 1.0 / 1.0 ); CEGUI_DEFINE_PROPERTY(Element, bool, "PixelAligned", "Property to get/set whether the Element's size and position should be pixel aligned. " "Value is either \"True\" or \"False\".", &Element::setPixelAligned, &Element::isPixelAligned, true ); CEGUI_DEFINE_PROPERTY(Element, Quaternion, "Rotation", "Property to get/set the Element's rotation. Value is a quaternion: " "\"w:[w_float] x:[x_float] y:[y_float] z:[z_float]\"" "or \"x:[x_float] y:[y_float] z:[z_float]\" to convert from Euler angles (in degrees).", &Element::setRotation, &Element::getRotation, Quaternion(1.0,0.0,0.0,0.0) ); CEGUI_DEFINE_PROPERTY(Element, bool, "NonClient", "Property to get/set whether the Element is 'non-client'. " "Value is either \"True\" or \"False\".", &Element::setNonClient, &Element::isNonClient, false ); }
//--------------------------------------------------------------------------------------- void LyricEngraver::create_shape(int iNote, GmoShapeNote* pNoteShape, ImoLyric* pLyric, GmoShapeNote* pNextNoteShape) { LUnits xNote = pNoteShape->get_left(); LUnits xCur = xNote; //TODO: base position should be the maximum notes bottom y + 5.0f instead // of a fixed amount (70.0f) //TODO: line increment should be text shape height + 0.5f instead o a fixed // amount (23.0f) int lineNum = pLyric->get_number(); LUnits y = m_staffTops[iNote] + pNoteShape->get_top(); if (pLyric->get_placement() == k_placement_above) y -= tenths_to_logical(25.0f + 23.0f * float(lineNum)); else y += tenths_to_logical(70.0f + 23.0f * float(lineNum)); //create container shape ShapeId idx = 0; m_pLyricsShape = LOMSE_NEW GmoShapeLyrics(pLyric, idx, Color(0,0,0) /*unused*/, m_libraryScope); //create shapes for syllables and elision symbols and compute its total width ImoStyle* pStyle = NULL; Color color; GmoShape* pSyllableShape; LUnits syllablesWidth = 0; int numSyllables = pLyric->get_num_text_items(); for (int i=0; i < numSyllables; ++i) { //get text for syllable ImoLyricsTextInfo* pText = pLyric->get_text_item(i); const string& text = pText->get_syllable_text(); const string& language = pText->get_syllable_language(); pStyle = pText->get_syllable_style(); if (pStyle == NULL) pStyle = m_pMeter->get_lyrics_style_info(); color = pStyle->color(); //create shape for this syllable pSyllableShape = LOMSE_NEW GmoShapeText(pLyric, idx, text, pStyle, language, xCur, y, m_libraryScope); m_pLyricsShape->add(pSyllableShape); xCur = pSyllableShape->get_right(); //cumulative width syllablesWidth += pSyllableShape->get_width(); //add elision symbol if (pText->has_elision()) { const string& elision = pText->get_elision_text(); GmoShape* pShape = LOMSE_NEW GmoShapeText(pLyric, idx, elision, pStyle, "en", xCur, y, m_libraryScope); m_pLyricsShape->add(pShape); xCur = pShape->get_right() + tenths_to_logical(2.0); syllablesWidth += pShape->get_width() + tenths_to_logical(2.0); } } //compute shift for centering syllables on note head LUnits shift = (pNoteShape->get_width() - syllablesWidth) / 2.0f; xCur += shift; //shift syllables for centering on note head m_pLyricsShape->shift_origin(USize(shift, 0.0f)); LUnits syllablesRight = m_pLyricsShape->get_right(); //add shape for hyphenation, if needed if (pLyric->has_hyphenation() && !pLyric->has_melisma()) { GmoShape* pShape = LOMSE_NEW GmoShapeText(pLyric, idx, "-", pStyle, "en", xCur, y, m_libraryScope); m_pLyricsShape->add(pShape); //shift shape to center between this and next syllable if (pNextNoteShape) { LUnits space = pNextNoteShape->get_left() - syllablesRight; LUnits shift = (space - pShape->get_width()) / 2.0f; pShape->shift_origin(shift, 0.0f); } xCur = pShape->get_right(); } //add shape for melisma line, if needed if (pLyric->has_melisma()) { LUnits xStart = xCur + tenths_to_logical(3.0f);; LUnits xEnd; if (pNextNoteShape) { xEnd = pNextNoteShape->get_left(); if (xEnd < xStart) { //note is in next system. Melisma line to end of current system xEnd = m_pInstrEngrv->get_staves_right(); } else { xEnd -= tenths_to_logical(20.0f); if (xEnd < xStart) xEnd = pNextNoteShape->get_left(); } } else //TODO: Melisma line must extend until last note in this voice xEnd = xStart + tenths_to_logical(60.0f); //TODO LUnits width = tenths_to_logical(1.0f); //TODO engraving option LUnits boundsExtraWidth = tenths_to_logical(0.5f); GmoShape* pShape = LOMSE_NEW GmoShapeLine(pLyric, idx, xStart, y, xEnd, y, width, boundsExtraWidth, k_line_solid, color, k_edge_normal, k_cap_none, k_cap_none); m_pLyricsShape->add(pShape); } m_pShape = m_pLyricsShape; ShapeBoxInfo* pInfo = m_shapesInfo[iNote]; pInfo->pShape = m_pLyricsShape; }
//--------------------------------------------------------------------------------------- USize ScorePlayerCtrl::measure() { return USize(m_width, m_height+500.0f); //500 = bottom margin }
//--------------------------------------------------------------------------------------- URect HandlerCircle::get_bounds() { LUnits diameter = m_radius + m_radius; return URect(m_origin, USize(diameter, diameter)); }
//--------------------------------------------------------------------------------------- void ScorePlayerCtrl::on_draw(Drawer* pDrawer, RenderOptions& UNUSED(opt)) { Color color = (m_fEnabled ? m_currentColor : Color(192, 192, 192)); Color white(255, 255, 255); Color black(0, 0, 0); Color dark(83, 80, 72); Color clear = white; LUnits x = m_pos.x; LUnits y = m_pos.y; LUnits width = m_width; //m_fFullView ? 4000.0f : m_width; //draw box gradient and border //dark.a = 45; Color light(dark); light = light.gradient(white, 0.2); pDrawer->begin_path(); pDrawer->fill(dark); pDrawer->stroke(black); pDrawer->stroke_width(15.0); pDrawer->gradient_color(white, 0.0, 0.1); pDrawer->gradient_color(white, dark, 0.1, 0.7); pDrawer->gradient_color(dark, light, 0.7, 1.0); pDrawer->fill_linear_gradient(m_pos.x, m_pos.y, m_pos.x, m_pos.y + m_height); pDrawer->rect(UPoint(x, y), USize(width, m_height), 100.0f); pDrawer->end_path(); switch (m_playButtonState) { case k_play: // //triangle (play) // pDrawer->begin_path(); // pDrawer->fill(clear); // pDrawer->stroke(color); // pDrawer->move_to(x + 360.0f, y + 130.0f); // pDrawer->line_to(x + 640.0f, y + 300.0f); // pDrawer->line_to(x + 360.0f, y + 470.0f); // pDrawer->close_subpath(); // pDrawer->end_path(); // break; //triangle (play) if (!m_fFullView) { //mouse out pDrawer->begin_path(); pDrawer->fill(clear); pDrawer->stroke(color); pDrawer->move_to(x + 360.0f, y + 130.0f); pDrawer->line_to(x + 640.0f, y + 300.0f); pDrawer->line_to(x + 360.0f, y + 470.0f); pDrawer->close_subpath(); pDrawer->end_path(); } else { //mouse in pDrawer->begin_path(); Color blurred(255, 255, 220); // = color; Color none(255, 255, 255, 0); blurred.a = 150; pDrawer->fill(blurred); pDrawer->stroke(none); pDrawer->move_to(x + 360.0f - 50.0f, y + 130.0f - 80.0f); pDrawer->line_to(x + 640.0f + 100.0f, y + 300.0f); pDrawer->line_to(x + 360.0f - 50.0f, y + 470.0f + 80.0f); pDrawer->close_subpath(); pDrawer->end_path(); pDrawer->begin_path(); blurred.a = 220; pDrawer->fill(blurred); pDrawer->stroke(none); pDrawer->move_to(x + 360.0f - 25.0f, y + 130.0f - 40.0f); pDrawer->line_to(x + 640.0f + 50.0f, y + 300.0f); pDrawer->line_to(x + 360.0f - 25.0f, y + 470.0f + 40.0f); pDrawer->close_subpath(); pDrawer->end_path(); // pDrawer->begin_path(); // pDrawer->fill(color); // pDrawer->stroke(color); // pDrawer->move_to(x + 360.0f, y + 130.0f); // pDrawer->line_to(x + 640.0f, y + 300.0f); // pDrawer->line_to(x + 360.0f, y + 470.0f); // pDrawer->close_subpath(); // pDrawer->end_path(); // see www.crossgl.com/aggpas/documentation Color red(255,0,0); Color yellow(255,255,0); red = red.gradient(red, 0.2); pDrawer->begin_path(); pDrawer->fill(red); pDrawer->stroke(red); pDrawer->stroke_width(10.0); pDrawer->gradient_color(red, 0.0, 0.1); pDrawer->gradient_color(red, yellow, 0.1, 0.90); pDrawer->gradient_color(yellow, white, 0.90, 1.0); pDrawer->fill_linear_gradient(x, y+130.0f, x, y+470.0f); pDrawer->move_to(x + 360.0f, y + 130.0f); pDrawer->line_to(x + 640.0f, y + 300.0f); pDrawer->line_to(x + 360.0f, y + 470.0f); pDrawer->close_subpath(); pDrawer->end_path(); } break; // //draw glowing line // glow effect is just drawing a blured layer in light color, under main layer. // in this test, instaed of blurring the original shape, just do a secon drawing more // light // set_alpha(0.2) // set_line_width(5) // draw_line // set_alpha(0.07) // set_line_width(15) // draw_line case k_stop: //square (stop) pDrawer->begin_path(); pDrawer->fill(clear); pDrawer->stroke(color); pDrawer->rect(UPoint(x+370.0f, y+170.0f), USize(260.0f, 260.0f), 0.0f); pDrawer->end_path(); break; case k_pause: //two bars (pause) pDrawer->begin_path(); pDrawer->fill(clear); pDrawer->stroke(color); pDrawer->rect(UPoint(x+150.0f, y+150.0f), USize(120.0f, 300.0f), 0.0f); pDrawer->rect(UPoint(x+330.0f, y+150.0f), USize(120.0f, 300.0f), 0.0f); pDrawer->end_path(); break; default: ; } }