void IconDes::RightDown(Point p, dword flags) { p = GetPos(p); if(!InImage(p)) return; if(tool == &IconDes::HotSpotTool) { if(p != Current().image.Get2ndSpot()) { ImageBuffer ib(Current().image); ib.Set2ndSpot(p); Current().image = ib; Refresh(); } return; } RGBA ic = CurrentImage()[p.y][p.x]; RGBA c = CurrentColor(); if(flags & K_ALT) { c.a = ic.a; ic = c; } if(flags & K_CTRL) ic.a = c.a; rgbactrl.Set(ic); ColorChanged(); }
void IconDes::LineTool(Point p, dword flags) { Size isz = GetImageSize(); IconDraw iw(isz); iw.DrawRect(isz, GrayColor(0)); iw.DrawLine(startpoint, p, pen, GrayColor(255)); ApplyDraw(iw, flags); Set(p, CurrentColor(), flags); RefreshPixel(p); }
void Color3ubv(void *data) { vertex_t *vtx = vertexStack + stackPos; int i; vtx->flags &= ~VTXF_COLOR_MASK; vtx->flags |= VTXF_COLOR_3; for(i = 0; i < 3; i++) vtx->color[i] = ((DGLubyte *) data)[i] / (float) 0xff; CurrentColor(3); }
void Color3ub(DGLubyte r, DGLubyte g, DGLubyte b) { vertex_t *vtx = vertexStack + stackPos; vtx->flags &= ~VTXF_COLOR_MASK; vtx->flags |= VTXF_COLOR_3; vtx->color[0] = r / (float) 0xff; vtx->color[1] = g / (float) 0xff; vtx->color[2] = b / (float) 0xff; CurrentColor(3); }
void Color3fv(float *data) { vertex_t *vtx = vertexStack + stackPos; int i; vtx->flags &= ~VTXF_COLOR_MASK; vtx->flags |= VTXF_COLOR_3; for(i = 0; i < 3; i++) vtx->color[i] = data[i]; CurrentColor(3); }
NAMESPACE_UPP void IconDes::LeftDown(Point p, dword flags) { SetFocus(); if(!IsCurrent()) return; SaveUndo(); startpoint = GetPos(p); if(IsPasting()) { if(Rect(Current().pastepos, Current().paste_image.GetSize()).Contains(startpoint)) { startpoint -= Current().pastepos; SetCapture(); } else FinishPaste(); return; } SetCapture(); Current().base_image = CurrentImage(); if(flags & K_SHIFT) { ImageBuffer ib(CurrentImage()); if(!doselection) { RGBA c = CurrentColor(); c.r += 127; MaskFill(ib, c, 0); } FloodFill(ib, CurrentColor(), startpoint, ib.GetSize()); SetCurrentImage(ib); if(!doselection) MaskSelection(); return; } if(selectrect) EmptyRectTool(startpoint, flags); else if(tool) (this->*tool)(startpoint, flags); }
void IconDes::ApplyImage(Image m, dword flags, bool alpha) { if(!IsCurrent()) return; Slot& c = Current(); Size isz = GetImageSize(); RGBA cc = CurrentColor(); int empty = doselection ? cc.r : 0; ImageBuffer ib(CurrentImage()); for(int y = 0; y < isz.cy; y++) { const RGBA *s = c.base_image[y]; RGBA *t = ib[y]; const RGBA *d = m[y]; const RGBA *k = doselection ? d : c.selection[y]; for(int x = 0; x < isz.cx; x++) { RGBA c = *s; if(alpha) { cc.a = d->r; AlphaBlendStraight(&c, &cc, 1); } else { if(d->r == 255) { if(flags & K_ALT) c.a = cc.a; else if(flags & K_CTRL) { RGBA h = cc; h.a = c.a; c = h; } else c = cc; } if(d->r == 128) c.a = c.r = c.g = c.b = empty; } if(c != *t && (doselection || k->r)) { *t = c; RefreshPixel(x, y); } t++; s++; d++; k++; } } CurrentImage() = ib; }
Image IconDes::MakeIconDesCursor(const Image& arrow, const Image& cmask) { RGBA c = CurrentColor(); c.a = 255; Image ucmask = Unmultiply(cmask); ImageBuffer ib(ucmask.GetSize()); const RGBA *m = ~ucmask; RGBA *t = ~ib; RGBA *e = ib.End(); while(t < e) { *t = c; t->a = m->a; m++; t++; } Image cm(ib); Image r = arrow; Over(r, Point(0, 0), Premultiply(cm), r.GetSize()); return r; }
void Color3f(float r, float g, float b) { /* DGLubyte col[3]; CLAMP01(r); CLAMP01(g); CLAMP01(b); col[0] = (DGLubyte) (0xff * r); col[1] = (DGLubyte) (0xff * g); col[2] = (DGLubyte) (0xff * b); currentVertex.rgba = MAKE_RGBA(col[0], col[1], col[2], 0xff); */ vertex_t *vtx = vertexStack + stackPos; vtx->flags &= ~VTXF_COLOR_MASK; vtx->flags |= VTXF_COLOR_3; vtx->color[0] = r; vtx->color[1] = g; vtx->color[2] = b; CurrentColor(3); }
void Color4fv(float *data) { /* float clamped[4] = { data[0], data[1], data[2], data[3] }; DGLubyte col[4]; int i; for(i=0; i<4; i++) { CLAMP01(clamped[i]); col[i] = (DGLubyte) (0xff * clamped[i]); } currentVertex.rgba = MAKE_RGBA(col[0], col[1], col[2], col[3]); */ vertex_t *vtx = vertexStack + stackPos; int i; vtx->flags &= ~VTXF_COLOR_MASK; vtx->flags |= VTXF_COLOR_4; for(i = 0; i < 4; i++) vtx->color[i] = data[i]; CurrentColor(4); }
void UCheatManager::TickCollisionDebug() { // If we are debugging capsule tracing if(bDebugCapsuleSweep) { APlayerController* PC = GetOuterAPlayerController(); if(PC) { // Get view location to act as start point FVector ViewLoc; FRotator ViewRot; PC->GetPlayerViewPoint(ViewLoc, ViewRot); FVector ViewDir = ViewRot.Vector(); FVector End = ViewLoc + (DebugTraceDistance * ViewDir); // Fill in params and do trace static const FName TickCollisionDebugName(TEXT("TickCollisionDebug")); FCollisionQueryParams CapsuleParams(TickCollisionDebugName, false, PC->GetPawn()); CapsuleParams.bTraceComplex = bDebugCapsuleTraceComplex; if (bDebugCapsuleSweep) { // If we get a hit, draw the capsule FHitResult Result; bool bHit = GetWorld()->SweepSingle(Result, ViewLoc, End, FQuat::Identity, DebugTraceChannel, FCollisionShape::MakeCapsule(DebugCapsuleRadius, DebugCapsuleHalfHeight), CapsuleParams); if(bHit) { AddCapsuleSweepDebugInfo(ViewLoc, End, Result.ImpactPoint, Result.Normal, Result.ImpactNormal, Result.Location, DebugCapsuleHalfHeight, DebugCapsuleRadius, false, (Result.bStartPenetrating && Result.bBlockingHit)? true: false); UE_LOG(LogCollision, Log, TEXT("Collision component (%s) : Actor (%s)"), *GetNameSafe(Result.Component.Get()), *GetNameSafe(Result.GetActor())); } } } } // draw for (int32 TraceIdx=0; TraceIdx < DebugTraceInfoList.Num(); ++TraceIdx) { FDebugTraceInfo & TraceInfo = DebugTraceInfoList[TraceIdx]; DrawDebugDirectionalArrow(GetWorld(), TraceInfo.LineTraceStart, TraceInfo.LineTraceEnd, 10.f, FColor::White, SDPG_World); // if it's current trace index, use highlight color if (CurrentTraceIndex == TraceIdx) { if (TraceInfo.bInsideOfObject) { DrawDebugCapsule(GetWorld(), TraceInfo.HitLocation, TraceInfo.CapsuleHalfHeight, TraceInfo.CapsuleRadius, FQuat::Identity, FColor(255,100,64)); } else { DrawDebugCapsule(GetWorld(), TraceInfo.HitLocation, TraceInfo.CapsuleHalfHeight, TraceInfo.CapsuleRadius, FQuat::Identity, FColor(255,200,128)); } } else { if (TraceInfo.bInsideOfObject) { DrawDebugCapsule(GetWorld(), TraceInfo.HitLocation, TraceInfo.CapsuleHalfHeight, TraceInfo.CapsuleRadius, FQuat::Identity, FColor(64,100,255)); } else { DrawDebugCapsule(GetWorld(), TraceInfo.HitLocation, TraceInfo.CapsuleHalfHeight, TraceInfo.CapsuleRadius, FQuat::Identity, FColor(128,200,255)); } } DrawDebugDirectionalArrow(GetWorld(), TraceInfo.HitNormalStart, TraceInfo.HitNormalEnd, 5, FColor(255,64,64), SDPG_World); DrawDebugDirectionalArrow(GetWorld(), TraceInfo.HitNormalStart, TraceInfo.HitImpactNormalEnd, 5, FColor(64,64,255), SDPG_World); } FLinearColor CurrentColor(255.f/255.f,96.f/255.f,96/255.f); FLinearColor DeltaColor = (FLinearColor(1.0f, 1.0f, 1.0f, 1.0f) - CurrentColor)*0.1f; int32 TotalCount=0; if ( DebugTracePawnInfoList.Num() > 0 ) { // the latest will draw very red-ish to whiter color as it gets older. for (int32 TraceIdx=CurrentTracePawnIndex; TotalCount<10; TraceIdx=SAFE_TRACEINDEX_DECREASE(TraceIdx), CurrentColor+=DeltaColor, ++TotalCount) { FDebugTraceInfo & TraceInfo = DebugTracePawnInfoList[TraceIdx]; DrawDebugDirectionalArrow(GetWorld(), TraceInfo.LineTraceStart, TraceInfo.LineTraceEnd, 10.f, FColor(200,200,100), SDPG_World); if (TraceInfo.bInsideOfObject) { DrawDebugCapsule(GetWorld(), TraceInfo.HitLocation, TraceInfo.CapsuleHalfHeight, TraceInfo.CapsuleRadius, FQuat::Identity, FColor(64, 64, 255)); } else { DrawDebugCapsule(GetWorld(), TraceInfo.HitLocation, TraceInfo.CapsuleHalfHeight, TraceInfo.CapsuleRadius, FQuat::Identity, CurrentColor.Quantize()); } DrawDebugDirectionalArrow(GetWorld(), TraceInfo.HitNormalStart, TraceInfo.HitNormalEnd, 5.f, FColor(255,64,64), SDPG_World); } } }
void IconDes::SetColor() { SetColor0(CurrentColor()); }