void main( void ) { XVirtualScreen * pScreen = new XVirtualScreen( 320, 200 ); XBlitter * pBlitter = new XBlitter(); pBlitter->AssociateVirtualScreen( pScreen ); XRect xrect( 100, 100, 320, 230 ); // initialize window FlameWindow * pWindow = new FlameWindow( 100, "Flame demo", pBlitter, 0, XFrameWindow::defaultStyle, xrect ); FlameThread * pThread = new FlameThread( pBlitter ); pThread->Run(); XApplication::GetApplication()->Start(); /**** pThread->Terminate(); delete pThread; pBlitter->DisassociateVirtualScreen(); delete pBlitter; delete pScreen; ****/ // delete pWindow; wird automatisch gel”scht }
/* delete this line from the data structure */ void scTextline::Delete( scXRect& lineDamage ) { // patch the line pointers if ( GetPrev() ) GetPrev()->SetNext( GetNext() ); else GetColumn()->SetFirstline( GetNext() ); if ( GetNext() ) GetNext()->SetPrev( GetPrev() ); // patch the paragraph pointer if ( fPara && this == fPara->GetFirstline() ) { scTextline* nexttxl = GetNext(); if ( !nexttxl ) nexttxl = GetNextLogical(); if ( nexttxl && nexttxl->GetPara() == fPara ) fPara->SetFirstline( nexttxl ); else fPara->SetFirstline( 0 ); } // compute the damage area scXRect xrect( fInkExtents ); if ( xrect.Valid() ) { QueryExtents( xrect, 1 ); lineDamage.Union( xrect ); } delete this; }
void MWcanvas16::fill(const Color* c) { if (c->rep()->stipple) { // ---- stipple some color into the area ---- stencilFill(c->rep()->stipple, c); } else { PathRenderInfo* p = &MWcanvas16::path_; int n = (int) (p->cur_point_ - p->point_); if (n <= 2) { return; } flush(); color(c); HPEN hpen = (HPEN)SelectObject(drawable_, CreatePen(PS_SOLID, 0, lg_color_->rep()->msColor())); POINT* pt = p->point_; if (xrect(pt, n)) { // ---- draw a rectangle ---- int x = Math::min(pt[0].x, pt[2].x); int y = Math::min(pt[0].y, pt[2].y); int x1 = Math::max(pt[0].x, pt[2].x); int y1 = Math::max(pt[0].y, pt[2].y); Rectangle(drawable_, x, y, x1, y1); } else { Polygon(drawable_, pt, n); } DeleteObject(SelectObject(drawable_, hpen)); } #ifdef DEBUG // ---- canvas debug ---- MWassert( LPtoDP(drawable_, pt, n) ); printf("fill "); for (int i = 0; i < n; i++) { BOOL vis = PtVisible(drawable_, pt[i].x, pt[i].y); if (vis) printf("[%d,%d] ", pt[i].x, pt[i].y); else printf("(%d,%d> ", pt[i].x, pt[i].y); } printf("\n"); #endif }
Bool scTextline::DropCapHilite( APPDrwCtx mat, HiliteFuncPtr func ) const { DropCapInfo dcInfo; TypeSpec ps = fPara->GetDefaultSpec(); TypeSpec ts = SpecAtStart(); scCachedStyle::SetParaStyle( fPara, ps ); if ( ::DCCompute( dcInfo, ps, ts, 0L, 0L, CharAtStart() ) ) { scXRect xrect( dcInfo.dcMinX, dcInfo.dcMinY, dcInfo.dcMaxX, dcInfo.dcPosition.dcVOffset ); //scXRect xrect( dcInfo.dcMinX, dcInfo.dcMinY, dcInfo.dcMaxX, dcInfo.dcMaxY ); xrect.Translate( fOrigin.x - dcInfo.dcLineOrgChange, fOrigin.y + fVJOffset ); (*func)( xrect, mat, false ); return true; } return false; }
void MWcanvas16::clip() { flush(); // ---- make sure there are multiple points ---- PathRenderInfo* p = &path_; POINT* pt = p->point_; int n = (int) (p->cur_point_ - p->point_); if (n <= 2) { return; } // // The path must be in terms of device units for specification of // clipping... so we transform the path specifications from logical // units (TWIPS) to device units before setting the clipping. // if(drawable_ == nil) // sometimes its null because of event input -- just ignore return; MWassert( LPtoDP(drawable_, pt, n) ); // ---- create a region to represent clipping ---- HRGN clip; if (xrect(pt, n)) { // ---- rectangular clipping area ---- RECT xr; xr.left = Math::min(pt[0].x, pt[2].x); xr.top = Math::min(pt[0].y, pt[2].y); xr.right = Math::max(pt[0].x, pt[2].x); xr.bottom = Math::max(pt[0].y, pt[2].y); clip = CreateRectRgn(xr.left, xr.top, xr.right, xr.bottom ); } else { clip = CreatePolygonRgn(pt, n, WINDING); } #if 1 // ---- merge with existing clipping area ---- HRGN intersect = CreateRectRgn(0,0,0,0); CombineRgn(intersect, clipping_, clip, RGN_AND); DeleteObject(clip); clip = intersect; #endif //DebugMessage // ---- set new clipping area ---- SelectClipRgn(drawable_, clip); DeleteObject(clipping_); clipping_ = clip; #ifdef DEBUG // ---- canvas debug ---- printf("clip "); for (int i = 0; i < n; i++) { printf("[%d,%d] ", pt[i].x, pt[i].y); } printf("\n"); #endif }
// draw japanese rubi void scDrawLine::DrawRubi( const scRubiData& rd ) { int i, count = CharacterBufLen( rd.fCh ); MicroPoint hEscapement; MicroPoint vEscapement; scXRect xrect( rd.fExtents ); scMuPoint org = rd.fOrg; scMuPoint trans; TSJust rubiJust = TSRubiJust( rd.fRubiSpec ); MicroPoint letterspace; scCachedStyle::GetCachedStyle( rd.fRubiSpec ); SetRubiCharData( rd, fFlowDir, rubiJust, count, letterspace ); trans = fOrigin; if ( fFlowDir.IsHorizontal() ) { switch ( scCachedStyle::GetCachedStyle().GetHorzBaseline() ) { case kTopBaseline: trans.y = fBaselinePositions.fTop; break; case kMiddleBaseline: trans.y = fBaselinePositions.fMiddle; break; case kBottomBaseline: trans.y = fBaselinePositions.fBottom; break; default: case kRomanBaseline: trans.y = fBaselinePositions.fRoman; break; } } else { switch ( scCachedStyle::GetCachedStyle().GetVertBaseline() ) { case kLeftBaseline: trans.x = fBaselinePositions.fLeft; break; default: case kCenterBaseline: trans.x = fBaselinePositions.fMiddle; break; case kRightBaseline: trans.x = fBaselinePositions.fRight; break; } } org.Translate( trans ); fCurPos = org; if ( fFlowDir.IsVertical() ) { hEscapement = 0; vEscapement = fGlyphInfo.pointsize + letterspace; } else { hEscapement = fGlyphInfo.setsize + letterspace; vEscapement = 0; } fChA = fChArray; for ( i = 0; i < count; i++ ) { fChA[i].ch = rd.fCh[i]; fChA[i].flags.ClearFlags(); fChA[i].hEscapement = hEscapement; fChA[i].vEscapement = vEscapement; } APPDrawStartLine( fDawContext, org.x, org.y, hrect ); APPDrawString( fDrawContext, fChArray, count, org.x, org.y, fGlyphInfo ); APPDrawEndLine( fDrawContext ); }