From 03b30b1007670f1b6bf25959309b90c7d9b49f37 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Wed, 18 Mar 2020 11:50:02 +0100 Subject: [PATCH] version 1.2020.3 --- pom.xml | 2 +- .../sourceforge/plantuml/AnnotatedWorker.java | 10 +- src/net/sourceforge/plantuml/BlockUml.java | 10 +- .../sourceforge/plantuml/BlockUmlBuilder.java | 6 +- src/net/sourceforge/plantuml/ColorParam.java | 242 +++++------ .../sourceforge/plantuml/EmbeddedDiagram.java | 2 +- .../plantuml/EmptyImageBuilder.java | 2 +- src/net/sourceforge/plantuml/ISkinParam.java | 12 +- src/net/sourceforge/plantuml/ISkinSimple.java | 6 +- .../plantuml/LineConfigurable.java | 4 +- src/net/sourceforge/plantuml/LineParam.java | 1 + .../sourceforge/plantuml/PSystemUtils.java | 4 +- src/net/sourceforge/plantuml/Run.java | 26 +- src/net/sourceforge/plantuml/SkinParam.java | 75 ++-- .../plantuml/SkinParamBackcolored.java | 26 +- .../SkinParamBackcoloredReference.java | 12 +- .../sourceforge/plantuml/SkinParamColors.java | 10 +- .../plantuml/SkinParamDelegator.java | 18 +- .../plantuml/SkinParamForceColor.java | 8 +- .../plantuml/SkinParamForecolored.java | 8 +- .../sourceforge/plantuml/SkinParamUtils.java | 6 +- .../plantuml/SourceStringReader.java | 2 +- src/net/sourceforge/plantuml/SplitParam.java | 14 +- .../plantuml/SpriteContainerEmpty.java | 13 +- src/net/sourceforge/plantuml/StringUtils.java | 16 +- src/net/sourceforge/plantuml/SvgString.java | 4 + src/net/sourceforge/plantuml/UmlDiagram.java | 12 +- .../activitydiagram3/ActivityDiagram3.java | 18 +- .../plantuml/activitydiagram3/Branch.java | 8 +- .../activitydiagram3/InstructionGroup.java | 12 +- .../activitydiagram3/InstructionIf.java | 6 +- .../activitydiagram3/InstructionRepeat.java | 4 +- .../activitydiagram3/InstructionSpot.java | 6 +- .../activitydiagram3/InstructionSwitch.java | 4 +- .../activitydiagram3/InstructionWhile.java | 6 +- .../command/CommandCircleSpot3.java | 4 +- .../command/CommandElseIf2.java | 4 +- .../activitydiagram3/command/CommandIf2.java | 4 +- .../activitydiagram3/command/CommandIf4.java | 4 +- .../command/CommandLink3.java | 4 +- .../command/CommandPartition3.java | 16 +- .../command/CommandRepeat3.java | 4 +- .../command/CommandSwimlane.java | 4 +- .../command/CommandSwimlane2.java | 4 +- .../command/CommandSwitch.java | 4 +- .../command/CommandWhile3.java | 4 +- .../activitydiagram3/ftile/AbstractFtile.java | 4 +- .../activitydiagram3/ftile/BoxStyle.java | 8 +- .../ftile/CollisionDetector.java | 8 +- .../ftile/EntityImageLegend.java | 6 +- .../ftile/FtileAssemblySimple.java | 2 +- .../activitydiagram3/ftile/FtileFactory.java | 10 +- .../ftile/FtileFactoryDelegator.java | 10 +- .../ftile/FtileHeightFixed.java | 2 +- .../activitydiagram3/ftile/FtileMarged.java | 2 +- .../ftile/FtileMargedVertically.java | 2 +- .../activitydiagram3/ftile/FtileMinWidth.java | 2 +- .../activitydiagram3/ftile/Snake.java | 4 +- .../activitydiagram3/ftile/Swimlane.java | 4 +- .../activitydiagram3/ftile/SwimlanesA.java | 17 +- .../activitydiagram3/ftile/SwimlanesB.java | 11 +- .../activitydiagram3/ftile/SwimlanesC.java | 10 +- .../ftile/UGraphicInterceptorUDrawable2.java | 10 +- .../plantuml/activitydiagram3/ftile/Worm.java | 8 +- .../activitydiagram3/ftile/WormMutation.java | 10 +- .../plantuml/activitydiagram3/ftile/Zad.java | 4 +- .../activitydiagram3/ftile/ZadBuilder.java | 2 +- .../ftile/vcompact/FloatingNote.java | 6 +- .../FtileFactoryDelegatorCreateGroup.java | 8 +- .../vcompact/FtileFactoryDelegatorIf.java | 8 +- .../vcompact/FtileFactoryDelegatorRepeat.java | 6 +- .../vcompact/FtileFactoryDelegatorSwitch.java | 12 +- .../vcompact/FtileFactoryDelegatorWhile.java | 8 +- .../ftile/vcompact/FtileForkInner.java | 4 +- .../vcompact/FtileForkInnerOverlapped.java | 4 +- .../ftile/vcompact/FtileGroup.java | 18 +- .../ftile/vcompact/FtileIfAndStop.java | 4 +- .../ftile/vcompact/FtileIfLongHorizontal.java | 6 +- .../ftile/vcompact/FtileIfLongVertical.java | 4 +- .../ftile/vcompact/FtileNoteAlone.java | 6 +- .../ftile/vcompact/FtileRepeat.java | 8 +- .../ftile/vcompact/FtileSplit1.java | 2 +- .../ftile/vcompact/FtileSwitch.java | 6 +- .../ftile/vcompact/FtileWhile.java | 6 +- .../ftile/vcompact/FtileWithNoteOpale.java | 8 +- .../ftile/vcompact/FtileWithNotes.java | 6 +- .../ftile/vcompact/ParallelBuilderFork.java | 14 +- .../ftile/vcompact/ParallelBuilderMerge.java | 12 +- .../ftile/vcompact/ParallelBuilderSplit.java | 14 +- .../UGraphicInterceptorOneSwimlane.java | 6 +- .../ftile/vcompact/VCompactFactory.java | 16 +- .../vcompact/cond/ConditionalBuilder.java | 10 +- .../vcompact/cond/FtileIfWithDiamonds.java | 4 +- .../ftile/vcompact/cond/FtileSwitchNude.java | 2 +- .../cond/FtileSwitchWithDiamonds.java | 6 +- .../ftile/vertical/FtileBlackBlock.java | 9 +- .../ftile/vertical/FtileBox.java | 6 +- .../ftile/vertical/FtileCircleEnd.java | 10 +- .../ftile/vertical/FtileCircleSpot.java | 10 +- .../ftile/vertical/FtileCircleStart.java | 6 +- .../ftile/vertical/FtileCircleStop.java | 14 +- .../ftile/vertical/FtileDiamond.java | 14 +- .../ftile/vertical/FtileDiamondFoo1.java | 10 +- .../ftile/vertical/FtileDiamondInside.java | 10 +- .../ftile/vertical/FtileDiamondInside2.java | 10 +- .../ftile/vertical/FtileDiamondInside3.java | 10 +- .../ftile/vertical/FtileThinSplit.java | 10 +- .../sourceforge/plantuml/bpm/BpmElement.java | 22 +- .../plantuml/bpm/ConnectorPuzzleEmpty.java | 12 +- .../sourceforge/plantuml/bpm/GridArray.java | 12 +- .../plantuml/braille/BrailleDrawer.java | 16 +- .../DriverCenteredCharacterBraille.java | 2 +- .../braille/DriverDotPathBraille.java | 2 +- .../plantuml/braille/DriverLineBraille.java | 2 +- .../plantuml/braille/DriverNoneBraille.java | 2 +- .../braille/DriverPolygonBraille.java | 2 +- .../braille/DriverRectangleBraille.java | 2 +- .../plantuml/braille/DriverTextBraille.java | 2 +- .../plantuml/braille/UGraphicBraille.java | 8 +- .../plantuml/classdiagram/FullLayout.java | 2 +- .../plantuml/classdiagram/RowLayout.java | 2 +- .../command/CommandCreateClass.java | 4 +- .../command/CommandCreateClassMultilines.java | 4 +- .../FactorySequenceNoteOnArrowCommand.java | 4 +- .../plantuml/creole/CreoleHorizontalLine.java | 6 +- .../plantuml/creole/CreoleParser.java | 5 +- .../sourceforge/plantuml/creole/Fission.java | 3 + .../plantuml/creole/PSystemCreole.java | 4 +- .../sourceforge/plantuml/creole/Position.java | 4 +- src/net/sourceforge/plantuml/creole/Sea.java | 1 + .../plantuml/creole/SheetBlock1.java | 1 + .../plantuml/creole/SheetBlock2.java | 1 + .../sourceforge/plantuml/creole/Stripe.java | 2 + .../plantuml/creole/StripeSimple.java | 30 +- .../plantuml/creole/StripeStyle.java | 3 + .../plantuml/creole/StripeTable.java | 39 +- .../plantuml/creole/StripeTree.java | 3 + .../creole/{ => atom}/AbstractAtom.java | 2 +- .../plantuml/creole/{ => atom}/Atom.java | 2 +- .../{ => atom}/AtomHorizontalTexts.java | 4 +- .../plantuml/creole/{ => atom}/AtomImg.java | 4 +- .../creole/{ => atom}/AtomImgSvg.java | 2 +- .../plantuml/creole/{ => atom}/AtomMath.java | 18 +- .../creole/{ => atom}/AtomOpenIcon.java | 8 +- .../plantuml/creole/{ => atom}/AtomSpace.java | 2 +- .../creole/{ => atom}/AtomSprite.java | 10 +- .../plantuml/creole/{ => atom}/AtomTable.java | 34 +- .../plantuml/creole/{ => atom}/AtomText.java | 17 +- .../plantuml/creole/{ => atom}/AtomTree.java | 13 +- .../creole/{ => atom}/AtomVerticalTexts.java | 4 +- .../creole/{ => atom}/AtomWithMargin.java | 7 +- .../plantuml/creole/{ => atom}/Bullet.java | 12 +- .../creole/{ => command}/Command.java | 4 +- .../CommandCreoleColorAndSizeChange.java | 9 +- .../CommandCreoleColorChange.java | 9 +- .../CommandCreoleExposantChange.java | 3 +- .../CommandCreoleFontFamilyChange.java | 3 +- .../{ => command}/CommandCreoleImg.java | 3 +- .../{ => command}/CommandCreoleLatex.java | 3 +- .../{ => command}/CommandCreoleMath.java | 3 +- .../CommandCreoleMonospaced.java | 3 +- .../{ => command}/CommandCreoleOpenIcon.java | 15 +- .../{ => command}/CommandCreoleQrcode.java | 3 +- .../CommandCreoleSizeChange.java | 3 +- .../{ => command}/CommandCreoleSpace.java | 3 +- .../{ => command}/CommandCreoleSprite.java | 15 +- .../{ => command}/CommandCreoleStyle.java | 7 +- .../CommandCreoleSvgAttributeChange.java | 3 +- .../{ => command}/CommandCreoleUrl.java | 3 +- .../plantuml/cucadiagram/CucaDiagram.java | 2 +- .../plantuml/cucadiagram/Display.java | 16 +- .../plantuml/cucadiagram/EntityPosition.java | 18 +- .../plantuml/cucadiagram/GroupRoot.java | 4 +- .../plantuml/cucadiagram/Ident.java | 11 +- .../plantuml/cucadiagram/Link.java | 4 +- .../plantuml/cucadiagram/LinkConstraint.java | 4 +- .../plantuml/cucadiagram/LinkDecor.java | 4 +- .../plantuml/cucadiagram/LinkMiddleDecor.java | 4 +- .../cucadiagram/MethodsOrFieldsArea.java | 10 +- .../plantuml/cucadiagram/Stereotype.java | 20 +- .../plantuml/cucadiagram/WithLinkType.java | 12 +- .../cucadiagram/dot/CucaDiagramTxtMaker.java | 2 +- .../plantuml/cucadiagram/dot/DotData.java | 2 +- .../cucadiagram/entity/EntityFactory.java | 4 +- .../cucadiagram/entity/EntityImpl.java | 6 +- .../sourceforge/plantuml/cute/CutePath.java | 4 +- .../plantuml/cute/PSystemCute.java | 2 +- .../plantuml/cute/PositionnedImpl.java | 12 +- .../sourceforge/plantuml/cute/VarArgs.java | 14 +- .../dedication/PSystemDedication.java | 6 +- .../definition/PSystemDefinition.java | 6 +- .../plantuml/descdiagram/BoxedCharacter.java | 10 +- .../EntityImageDesignedDomain.java | 10 +- .../descdiagram/EntityImageDomain.java | 6 +- .../descdiagram/EntityImageMachine.java | 12 +- .../descdiagram/EntityImageRequirement.java | 6 +- .../command/CommandCreateElementFull.java | 4 +- .../CommandCreateElementParenthesis.java | 4 +- .../plantuml/directdot/PSystemDot.java | 8 +- .../plantuml/donors/PSystemDonors.java | 10 +- .../donors/PSystemSkinparameterList.java | 8 +- .../plantuml/eggs/GraphicsPath.java | 6 +- .../plantuml/eggs/PSystemAppleTwo.java | 2 +- .../plantuml/eggs/PSystemCharlie.java | 6 +- .../plantuml/eggs/PSystemColors.java | 38 +- .../sourceforge/plantuml/eggs/PSystemEgg.java | 2 +- .../plantuml/eggs/PSystemLost.java | 2 +- .../plantuml/eggs/PSystemPath.java | 2 +- .../sourceforge/plantuml/eggs/PSystemRIP.java | 2 +- .../plantuml/eggs/PSystemWelcome.java | 2 +- .../sourceforge/plantuml/eps/EpsGraphics.java | 8 +- .../plantuml/error/PSystemError.java | 128 ++++-- .../plantuml/flowdiagram/ActivityBox.java | 8 +- .../plantuml/flowdiagram/FlowDiagram.java | 10 +- .../plantuml/font/PSystemListFonts.java | 2 +- src/net/sourceforge/plantuml/golem/Tile.java | 4 +- .../plantuml/golem/TilesField.java | 4 +- .../plantuml/graph/AbstractEntityImage.java | 34 +- .../graph/EntityImageActivityBar.java | 2 +- .../graph/EntityImageActivityBranch.java | 2 +- .../graph/EntityImageActivityCircle.java | 2 +- .../graph/EntityImageCircleInterface.java | 2 +- .../plantuml/graphic/AddStyle.java | 5 +- .../plantuml/graphic/CircledCharacter.java | 11 +- .../plantuml/graphic/ColorAndSizeChange.java | 8 +- .../plantuml/graphic/ColorChange.java | 8 +- .../plantuml/graphic/FontConfiguration.java | 38 +- .../plantuml/graphic/FontStyle.java | 8 +- .../plantuml/graphic/GraphicStrings.java | 36 +- .../plantuml/graphic/HtmlColorAndStyle.java | 16 +- .../graphic/HtmlColorTransparent.java | 39 -- .../plantuml/graphic/QuoteUtils.java | 3 +- .../sourceforge/plantuml/graphic/Rainbow.java | 10 +- .../graphic/SimpleTextBlockBordered.java | 5 +- .../plantuml/graphic/SymbolContext.java | 25 +- .../plantuml/graphic/TextBlockArrow.java | 3 +- .../plantuml/graphic/TextBlockBordered.java | 11 +- .../plantuml/graphic/TextBlockGeneric.java | 7 +- .../plantuml/graphic/TextBlockHorizontal.java | 2 +- .../plantuml/graphic/TextBlockLineBefore.java | 3 +- .../plantuml/graphic/TextBlockMinWidth.java | 2 +- .../plantuml/graphic/TextBlockRaw.java | 2 +- .../plantuml/graphic/TextBlockRecentred.java | 3 +- .../plantuml/graphic/TextBlockSprited.java | 2 +- .../plantuml/graphic/TextBlockTitle.java | 2 +- .../plantuml/graphic/TextBlockUtils.java | 20 +- .../plantuml/graphic/TextBlockVertical2.java | 9 +- .../plantuml/graphic/TileImage.java | 2 +- .../plantuml/graphic/UGraphicDelegator.java | 2 +- .../plantuml/graphic/USymbolArtifact.java | 6 +- .../plantuml/graphic/USymbolCard.java | 4 +- .../plantuml/graphic/USymbolCloud.java | 2 +- .../plantuml/graphic/USymbolCollections.java | 13 +- .../plantuml/graphic/USymbolComponent1.java | 2 +- .../plantuml/graphic/USymbolComponent2.java | 2 +- .../plantuml/graphic/USymbolDatabase.java | 4 +- .../plantuml/graphic/USymbolFolder.java | 2 +- .../plantuml/graphic/USymbolFrame.java | 3 +- .../plantuml/graphic/USymbolLabel.java | 3 - .../plantuml/graphic/USymbolNode.java | 10 +- .../plantuml/graphic/USymbolRect.java | 23 +- .../graphic/USymbolSimpleAbstract.java | 4 +- .../plantuml/graphic/USymbolStack.java | 4 +- .../plantuml/graphic/USymbolStorage.java | 5 +- .../plantuml/graphic/color/ColorParser.java | 4 +- .../plantuml/graphic/color/Colors.java | 20 +- .../hector/CucaDiagramFileMakerHectorB1.java | 8 +- .../plantuml/hector/HectorPath.java | 4 +- .../plantuml/hector/SmartConnection.java | 10 +- .../plantuml/hector2/graphic/Foo2.java | 2 +- .../plantuml/help/CommandHelpColor.java | 4 +- src/net/sourceforge/plantuml/help/Help.java | 2 +- .../jdot/CucaDiagramFileMakerJDot.java | 2 +- .../sourceforge/plantuml/jdot/JDotPath.java | 12 +- .../plantuml/jungle/GTileLeftRight.java | 8 +- .../plantuml/jungle/GTileNode.java | 8 +- .../plantuml/jungle/GTileStack.java | 2 +- .../sourceforge/plantuml/jungle/Needle.java | 4 +- .../plantuml/jungle/PSystemTree.java | 6 +- .../plantuml/logo/PSystemLogo.java | 2 +- .../plantuml/logo/TinyJavaLogo.java | 8 +- .../plantuml/logo/TurtleGraphicsPane.java | 23 +- .../plantuml/math/PSystemMath.java | 8 +- .../plantuml/math/ScientificEquationSafe.java | 4 +- .../mindmap/CommandMindMapOrgmode.java | 4 +- .../CommandMindMapOrgmodeMultiline.java | 4 +- .../plantuml/mindmap/FingerImpl.java | 8 +- .../sourceforge/plantuml/mindmap/Idea.java | 12 +- .../plantuml/mindmap/MindMapDiagram.java | 12 +- .../plantuml/nwdiag/DiagElement.java | 4 +- .../plantuml/nwdiag/DiagGroup.java | 8 +- .../nwdiag/GridTextBlockDecorated.java | 8 +- .../plantuml/nwdiag/LinkedElement.java | 6 +- .../sourceforge/plantuml/nwdiag/Network.java | 8 +- .../plantuml/nwdiag/NwDiagram.java | 10 +- .../plantuml/openiconic/OpenIcon.java | 4 +- .../openiconic/PSystemListOpenIconic.java | 6 +- .../openiconic/PSystemOpenIconic.java | 6 +- .../plantuml/oregon/PSystemOregon.java | 2 +- .../sourceforge/plantuml/png/PngTitler.java | 14 +- .../plantuml/posimo/AbstractEntityImage2.java | 6 +- .../sourceforge/plantuml/posimo/Frame.java | 6 +- .../sourceforge/plantuml/postit/PostIt.java | 12 +- .../plantuml/postit/PostItDiagram.java | 2 +- .../plantuml/preproc/ReadLineNumbered.java | 4 +- .../plantuml/preproc2/Preprocessor.java | 10 +- .../plantuml/project/ConstantPlan.java | 2 +- .../plantuml/project/DaysAsDates.java | 25 +- .../plantuml/project/GanttArrow.java | 9 +- .../plantuml/project/GanttConstraint.java | 21 + .../plantuml/project/GanttDiagram.java | 161 ++++--- .../plantuml/project/LoadPlanable.java | 2 +- .../plantuml/project/PlanUtils.java | 2 +- .../sourceforge/plantuml/project/Solver3.java | 2 +- .../project/command/CommandPrintBetween.java | 10 +- .../project/command/CommandPrintScale.java | 1 + .../core/AbstractTask.java} | 40 +- .../plantuml/project/core/Moment.java | 2 + .../plantuml/project/core/MomentImpl.java | 2 + .../plantuml/project/core/PrintScale.java | 15 +- .../plantuml/project/core/Resource.java | 9 +- .../plantuml/project/core/Task.java | 16 +- .../plantuml/project/core/TaskImpl.java | 32 +- .../plantuml/project/core/TaskInstant.java | 1 + .../plantuml/project/core/TaskSeparator.java | 18 +- .../project/draw/AbstractTaskDraw.java | 73 ++++ .../draw/PathUtils.java} | 33 +- .../plantuml/project/draw/ResourceDraw.java | 20 +- .../plantuml/project/draw/TaskDraw.java | 3 - .../project/draw/TaskDrawDiamond.java | 110 +++++ .../project/draw/TaskDrawRegular.java | 128 ++---- .../project/draw/TaskDrawSeparator.java | 39 +- .../plantuml/project/draw/TimeHeader.java | 19 +- .../project/draw/TimeHeaderDaily.java | 169 ++++---- .../project/draw/TimeHeaderMonthly.java | 150 +++++++ .../project/draw/TimeHeaderSimple.java | 66 +-- .../project/draw/TimeHeaderWeekly.java | 168 +++----- .../project/lang/ComplementColors.java | 10 +- .../plantuml/project/lang/ComplementDate.java | 10 +- .../project/lang/ComplementDates.java | 14 +- .../project/lang/ComplementDayOfWeek.java | 2 +- .../project/lang/ComplementInColors.java | 6 +- .../project/lang/ComplementInColors2.java | 6 +- .../project/lang/SubjectDayAsDate.java | 4 +- .../project/lang/SubjectDayOfWeek.java | 2 +- .../project/lang/SubjectDaysAsDates.java | 14 +- .../plantuml/project/lang/VerbAre.java | 2 +- .../plantuml/project/lang/VerbHappens.java | 8 +- .../plantuml/project/lang/VerbIsForToday.java | 4 +- .../plantuml/project/lang/VerbIsOff.java | 8 +- .../plantuml/project/lang/VerbIsOn.java | 6 +- .../plantuml/project/lang/VerbIsOrAre.java | 26 +- .../project/lang/VerbIsOrAreNamed.java | 4 +- .../project/lang/VerbProjectStarts.java | 4 +- .../project/lang/VerbTaskEndsAbsolute.java | 6 +- .../project/lang/VerbTaskStartsAbsolute.java | 6 +- .../project/{DayAsDate.java => time/Day.java} | 75 ++-- .../project/{ => time}/DayOfWeek.java | 2 +- .../project/{ => time}/GCalendar.java | 16 +- .../project/{core => time}/Month.java | 6 +- .../plantuml/project/time/MonthYear.java | 109 +++++ .../plantuml/project/{core => time}/Wink.java | 16 +- .../plantuml/project/timescale/TimeScale.java | 2 +- ...leWeekly.java => TimeScaleCompressed.java} | 17 +- .../project/timescale/TimeScaleDaily.java | 8 +- .../project/timescale/TimeScaleWink.java | 2 +- .../UnusedTimeScaleWithoutWeekEnd.java | 10 +- .../sourceforge/plantuml/salt/Dictionary.java | 13 +- .../plantuml/salt/PSystemSalt.java | 8 +- .../plantuml/salt/element/ElementBorder.java | 4 +- .../plantuml/salt/element/ElementButton.java | 6 +- .../salt/element/ElementDroplist.java | 12 +- .../plantuml/salt/element/ElementLine.java | 14 +- .../plantuml/salt/element/ElementMenuBar.java | 8 +- .../salt/element/ElementMenuEntry.java | 8 +- .../salt/element/ElementMenuPopup.java | 8 +- .../salt/element/ElementPyramidScrolled.java | 22 +- .../salt/element/ElementRadioCheckbox.java | 2 +- .../plantuml/salt/element/ElementTabBar.java | 18 +- .../salt/element/ElementTextField.java | 6 +- .../plantuml/salt/element/ElementTree.java | 4 +- .../plantuml/salt/element/Grid.java | 8 +- .../plantuml/salt/element/Grid2.java | 12 +- .../plantuml/salt/element/Skeleton.java | 4 +- .../plantuml/salt/element/Skeleton2.java | 6 +- .../plantuml/sequencediagram/Englober.java | 4 +- .../plantuml/sequencediagram/Grouping.java | 10 +- .../sequencediagram/GroupingLeaf.java | 10 +- .../sequencediagram/GroupingStart.java | 8 +- .../plantuml/sequencediagram/LinkAnchor.java | 4 +- .../plantuml/sequencediagram/Participant.java | 10 +- .../sequencediagram/ParticipantEnglober.java | 8 +- .../plantuml/sequencediagram/Reference.java | 14 +- .../sequencediagram/SequenceDiagram.java | 41 +- .../command/CommandActivate.java | 6 +- .../sequencediagram/command/CommandArrow.java | 8 +- .../command/CommandExoArrowAny.java | 4 +- .../command/CommandGrouping.java | 8 +- ...CommandReferenceMultilinesOverSeveral.java | 8 +- .../command/CommandReferenceOverSeveral.java | 8 +- .../command/CommandReturn.java | 5 +- .../graphic/ArrowAndParticipant.java | 2 +- .../sequencediagram/graphic/DrawableSet.java | 2 +- .../graphic/GraphicalDivider.java | 2 +- .../graphic/GraphicalNewpage.java | 2 +- .../GroupingGraphicalElementHeader.java | 2 +- .../sequencediagram/graphic/LifeLine.java | 8 +- .../graphic/ParticipantBox.java | 6 +- .../graphic/SegmentColored.java | 6 +- .../SequenceDiagramFileMakerPuma2.java | 10 +- .../graphic/SequenceDiagramTxtMaker.java | 2 +- .../sequencediagram/teoz/AbstractTile.java | 6 +- .../teoz/CommunicationExoTile.java | 2 +- .../teoz/CommunicationTile.java | 6 +- .../teoz/CommunicationTileNoteBottom.java | 4 +- .../teoz/CommunicationTileNoteLeft.java | 2 +- .../teoz/CommunicationTileNoteRight.java | 2 +- .../teoz/CommunicationTileNoteTop.java | 8 +- .../teoz/CommunicationTileSelf.java | 2 +- .../teoz/CommunicationTileSelfNoteRight.java | 2 +- .../sequencediagram/teoz/DelayTile.java | 2 +- .../sequencediagram/teoz/DividerTile.java | 2 +- .../sequencediagram/teoz/GroupingTile.java | 25 +- .../sequencediagram/teoz/LifeEventTile.java | 2 +- .../sequencediagram/teoz/LiveBoxFinder.java | 4 +- .../sequencediagram/teoz/LiveBoxes.java | 2 +- .../sequencediagram/teoz/LivingSpace.java | 4 +- .../sequencediagram/teoz/LivingSpaces.java | 2 +- .../sequencediagram/teoz/MutingLine.java | 2 +- .../sequencediagram/teoz/NoteTile.java | 2 +- .../sequencediagram/teoz/NotesTile.java | 2 +- .../sequencediagram/teoz/PlayingSpace.java | 2 +- .../teoz/PlayingSpaceWithParticipants.java | 22 +- .../sequencediagram/teoz/ReferenceTile.java | 2 +- .../teoz/SequenceDiagramFileMakerTeoz.java | 61 +-- .../plantuml/sequencediagram/teoz/Tile.java | 2 +- .../sequencediagram/teoz/TileArguments.java | 4 +- .../sequencediagram/teoz/TileParallel.java | 14 +- .../sequencediagram/teoz/YPositionedTile.java | 7 +- .../skin/AbstractTextualComponent.java | 16 +- .../plantuml/skin/ArrowConfiguration.java | 10 +- .../plantuml/skin/CircleInterface.java | 10 +- src/net/sourceforge/plantuml/skin/Padder.java | 25 +- .../plantuml/skin/VisibilityModifier.java | 8 +- .../skin/rose/AbstractComponentRoseArrow.java | 8 +- .../skin/rose/ComponentRoseActiveLine.java | 18 +- .../skin/rose/ComponentRoseActor.java | 8 +- .../skin/rose/ComponentRoseArrow.java | 20 +- .../skin/rose/ComponentRoseBoundary.java | 8 +- .../skin/rose/ComponentRoseControl.java | 8 +- .../skin/rose/ComponentRoseDatabase.java | 8 +- .../skin/rose/ComponentRoseDelayLine.java | 8 +- .../skin/rose/ComponentRoseDestroy.java | 8 +- .../skin/rose/ComponentRoseDivider.java | 26 +- .../skin/rose/ComponentRoseEnglober.java | 4 +- .../skin/rose/ComponentRoseEntity.java | 8 +- .../skin/rose/ComponentRoseGroupingElse.java | 16 +- .../rose/ComponentRoseGroupingHeader.java | 21 +- .../plantuml/skin/rose/ComponentRoseLine.java | 10 +- .../skin/rose/ComponentRoseNewpage.java | 8 +- .../skin/rose/ComponentRoseNoteBox.java | 2 +- .../skin/rose/ComponentRoseParticipant.java | 25 +- .../skin/rose/ComponentRoseQueue.java | 6 +- .../skin/rose/ComponentRoseReference.java | 8 +- .../skin/rose/ComponentRoseSelfArrow.java | 18 +- .../sourceforge/plantuml/skin/rose/Rose.java | 304 +++++++------ .../plantuml/sprite/ColorPalette.java | 14 +- .../plantuml/sprite/ColorPalette4096.java | 14 +- .../plantuml/sprite/ListSpriteDiagram.java | 4 +- .../sprite/PSystemListInternalSprites.java | 6 +- .../sourceforge/plantuml/sprite/Sprite.java | 4 +- .../plantuml/sprite/SpriteColor.java | 18 +- .../plantuml/sprite/SpriteGrayLevel.java | 2 +- .../plantuml/sprite/SpriteImage.java | 8 +- .../plantuml/sprite/SpriteMonochrome.java | 26 +- .../plantuml/sprite/SpriteSvg.java | 4 +- .../plantuml/sprite/StdlibDiagram.java | 4 +- .../command/CommandCreatePackageState.java | 4 +- .../command/CommandCreateState.java | 4 +- .../plantuml/stats/PSystemStats.java | 2 +- src/net/sourceforge/plantuml/style/Style.java | 34 +- src/net/sourceforge/plantuml/style/Value.java | 6 +- .../plantuml/style/ValueAbstract.java | 6 +- .../plantuml/style/ValueColor.java | 10 +- .../sourceforge/plantuml/style/ValueImpl.java | 6 +- .../sourceforge/plantuml/style/ValueNull.java | 10 +- .../plantuml/sudoku/GraphicsSudoku.java | 12 +- .../plantuml/svek/AbstractEntityImage.java | 4 +- .../sourceforge/plantuml/svek/Boundary.java | 2 +- .../plantuml/svek/CircleInterface2.java | 8 +- .../sourceforge/plantuml/svek/Cluster.java | 42 +- .../plantuml/svek/ClusterDecoration.java | 4 +- .../plantuml/svek/ConcurrentStateImage.java | 20 +- ...ucaDiagramFileMakerSvek2InternalImage.java | 16 +- .../plantuml/svek/DecorateEntityImage.java | 6 +- .../plantuml/svek/DecorateEntityImage3.java | 8 +- .../plantuml/svek/EntityDomain.java | 2 +- .../plantuml/svek/EntityImageProtected.java | 4 +- .../plantuml/svek/GeneralImageBuilder.java | 6 +- .../plantuml/svek/GraphvizCrash.java | 10 +- .../plantuml/svek/GroupPngMakerActivity.java | 8 +- .../plantuml/svek/GroupPngMakerState.java | 8 +- .../plantuml/svek/IEntityImageMoved.java | 4 +- .../plantuml/svek/InnerActivity.java | 16 +- .../plantuml/svek/InnerStateAutonom.java | 12 +- src/net/sourceforge/plantuml/svek/Line.java | 18 +- .../plantuml/svek/PackageStyle.java | 8 +- .../plantuml/svek/RoundedContainer.java | 23 +- .../sourceforge/plantuml/svek/SvekResult.java | 10 +- .../plantuml/svek/TextBlockBackcolored.java | 4 +- .../extremity/ExtremityArrowAndCircle.java | 4 +- .../svek/extremity/ExtremityCircle.java | 4 +- .../extremity/ExtremityCircleConnect.java | 4 +- .../svek/extremity/ExtremityCircleCross.java | 4 +- .../svek/extremity/ExtremityDiamond.java | 6 +- .../svek/extremity/ExtremityExtends.java | 6 +- .../extremity/ExtremityFactoryDiamond.java | 6 +- .../extremity/ExtremityFactoryExtends.java | 6 +- .../svek/extremity/ExtremityPlus.java | 4 +- .../svek/extremity/ExtremitySquarre.java | 4 +- .../svek/extremity/ExtremityStateLine1.java | 4 +- .../svek/extremity/ExtremityStateLine2.java | 4 +- .../plantuml/svek/extremity/MiddleCircle.java | 6 +- .../svek/extremity/MiddleCircleCircled.java | 10 +- .../svek/extremity/MiddleFactoryCircle.java | 6 +- .../extremity/MiddleFactoryCircleCircled.java | 6 +- .../plantuml/svek/image/ConnectedCircle.java | 4 +- .../svek/image/EntityImageActivity.java | 8 +- .../svek/image/EntityImageArcCircle.java | 2 +- .../image/EntityImageAssociationPoint.java | 4 +- .../svek/image/EntityImageBranch.java | 6 +- .../svek/image/EntityImageCircleEnd.java | 4 +- .../svek/image/EntityImageCircleStart.java | 4 +- .../plantuml/svek/image/EntityImageClass.java | 18 +- .../svek/image/EntityImageClassHeader2.java | 18 +- .../svek/image/EntityImageDescription.java | 6 +- .../svek/image/EntityImageEmptyPackage.java | 6 +- .../EntityImageLollipopInterfaceEye2.java | 6 +- .../plantuml/svek/image/EntityImageNote.java | 10 +- .../svek/image/EntityImageNoteLink.java | 4 +- .../svek/image/EntityImageObject.java | 8 +- .../plantuml/svek/image/EntityImageState.java | 12 +- .../svek/image/EntityImageState2.java | 6 +- .../svek/image/EntityImageStateBorder.java | 4 +- .../EntityImageStateEmptyDescription.java | 10 +- .../svek/image/EntityImageSynchroBar.java | 4 +- .../plantuml/svek/image/EntityImageTips.java | 8 +- .../svek/image/EntityImageUseCase.java | 6 +- .../plantuml/svek/image/Footprint.java | 4 +- .../plantuml/svek/image/Opale.java | 8 +- .../sourceforge/plantuml/svg/SvgGraphics.java | 18 +- .../plantuml/swing/ImageWindow2.java | 2 +- .../plantuml/syntax/LanguageDescriptor.java | 8 +- .../sourceforge/plantuml/tim/TContext.java | 5 + .../sourceforge/plantuml/tim/TimLoader.java | 5 +- .../plantuml/timingdiagram/ChangeState.java | 12 +- .../plantuml/timingdiagram/Highlight.java | 24 +- .../plantuml/timingdiagram/Player.java | 43 +- .../plantuml/timingdiagram/PlayerBinary.java | 79 ++-- .../plantuml/timingdiagram/PlayerClock.java | 90 ++-- ...ctPlayer.java => PlayerRobustConcise.java} | 130 +++--- .../timingdiagram/ReallyAbstractPlayer.java | 80 ---- .../timingdiagram/TimeConstraint.java | 50 ++- .../plantuml/timingdiagram/TimeMessage.java | 4 +- .../plantuml/timingdiagram/TimeProjected.java | 1 + .../plantuml/timingdiagram/TimingDiagram.java | 69 ++- .../timingdiagram/TimingDiagramFactory.java | 16 + .../plantuml/timingdiagram/TimingNote.java | 26 +- .../plantuml/timingdiagram/TimingRuler.java | 20 +- .../plantuml/timingdiagram/TimingStyle.java | 14 +- .../plantuml/timingdiagram/TitleStrategy.java | 39 -- .../{ => command}/CommandAtPlayer.java | 4 +- .../{ => command}/CommandAtTime.java | 4 +- .../{ => command}/CommandBinary.java | 3 +- .../{ => command}/CommandChangeState.java | 5 +- .../CommandChangeStateByPlayerCode.java | 5 +- .../CommandChangeStateByTime.java | 5 +- .../{ => command}/CommandClock.java | 3 +- .../{ => command}/CommandConstraint.java | 5 +- .../{ => command}/CommandDefineStateLong.java | 4 +- .../CommandDefineStateShort.java | 4 +- .../{ => command}/CommandHideTimeAxis.java | 3 +- .../{ => command}/CommandHighlight.java | 5 +- .../{ => command}/CommandNote.java | 5 +- .../{ => command}/CommandNoteLong.java | 5 +- .../{ => command}/CommandRobustConcise.java | 4 +- .../{ => command}/CommandScalePixel.java | 3 +- .../{ => command}/CommandTimeMessage.java | 6 +- .../{ => command}/TimeTickBuilder.java | 5 +- .../{ => graphic}/HexaShape.java | 2 +- .../{ => graphic}/Histogram.java | 210 ++++----- .../{ => graphic}/IntricatedPoint.java | 2 +- .../{ => graphic}/PentaAShape.java | 2 +- .../{ => graphic}/PentaBShape.java | 2 +- .../PlayerDrawing.java} | 13 +- .../{ => graphic}/PlayerFrame.java | 5 +- .../{ => graphic}/PlayerFrame2.java | 28 +- .../graphic/PlayerFrameEmpty.java} | 14 +- .../timingdiagram/{ => graphic}/Ribbon.java | 255 ++++++----- .../{ => graphic}/TimeArrow.java | 2 +- .../ugraphic/AbstractCommonUGraphic.java | 12 +- .../plantuml/ugraphic/AbstractUGraphic.java | 2 + .../AbstractUGraphicHorizontalLine.java | 2 +- .../plantuml/ugraphic/FontChecker.java | 5 +- .../plantuml/ugraphic/ImageBuilder.java | 76 ++-- .../plantuml/ugraphic/LimitFinder.java | 2 + .../sourceforge/plantuml/ugraphic/MinMax.java | 8 +- .../plantuml/ugraphic/TextLimitFinder.java | 1 + .../plantuml/ugraphic/UChangeBackColor.java | 8 +- .../plantuml/ugraphic/UChangeColor.java | 8 +- .../plantuml/ugraphic/UDriver.java | 2 + .../sourceforge/plantuml/ugraphic/UFont.java | 4 +- .../plantuml/ugraphic/UGraphic.java | 1 + .../plantuml/ugraphic/UGraphicNull.java | 1 + .../plantuml/ugraphic/UGraphicUtils.java | 9 +- .../plantuml/ugraphic/UHorizontalLine.java | 2 +- .../sourceforge/plantuml/ugraphic/UImage.java | 2 + .../sourceforge/plantuml/ugraphic/ULine.java | 8 + .../sourceforge/plantuml/ugraphic/UParam.java | 6 +- .../plantuml/ugraphic/UParamNull.java | 6 +- .../plantuml/ugraphic/URectangle.java | 82 ++-- .../plantuml/ugraphic/UTranslate.java | 12 + .../{ => color}/ColorChangerMonochrome.java | 2 +- .../ugraphic/{ => color}/ColorMapper.java | 6 +- .../{ => color}/ColorMapperIdentity.java | 27 +- .../color/ColorMapperLightnessInverse.java | 63 +++ .../{ => color}/ColorMapperMonochrome.java | 11 +- .../{ => color}/ColorMapperReverse.java | 14 +- .../ColorMapperTransparentWrapper.java | 11 +- .../ugraphic/{ => color}/ColorOrder.java | 2 +- .../plantuml/ugraphic/color/ColorUtils.java | 108 +++++ .../color/HColor.java} | 4 +- .../color/HColorAutomatic.java} | 4 +- .../color/HColorBackground.java} | 31 +- .../color/HColorGradient.java} | 24 +- .../color/HColorMiddle.java} | 12 +- .../color/HColorSet.java} | 83 ++-- .../color/HColorSimple.java} | 22 +- .../color/HColorUserDef.java} | 4 +- .../color/HColorUtils.java} | 78 ++-- .../ugraphic/color/HUSLColorConverter.java | 402 ++++++++++++++++++ .../plantuml/ugraphic/comp/SlotFinder.java | 4 +- .../plantuml/ugraphic/comp/SlotSet.java | 2 +- .../ugraphic/crossing/UGraphicCrossing.java | 12 +- .../eps/DriverCenteredCharacterEps.java | 2 +- .../ugraphic/eps/DriverDotPathEps.java | 2 +- .../ugraphic/eps/DriverEllipseEps.java | 2 +- .../plantuml/ugraphic/eps/DriverImageEps.java | 2 +- .../plantuml/ugraphic/eps/DriverLineEps.java | 2 +- .../plantuml/ugraphic/eps/DriverPathEps.java | 2 +- .../ugraphic/eps/DriverPolygonEps.java | 12 +- .../ugraphic/eps/DriverRectangleEps.java | 12 +- .../plantuml/ugraphic/eps/DriverTextEps.java | 10 +- .../plantuml/ugraphic/eps/UGraphicEps.java | 2 +- .../g2d/DriverCenteredCharacterG2d.java | 2 +- .../ugraphic/g2d/DriverDotPathG2d.java | 2 +- .../ugraphic/g2d/DriverEllipseG2d.java | 12 +- .../plantuml/ugraphic/g2d/DriverImageG2d.java | 2 +- .../plantuml/ugraphic/g2d/DriverLineG2d.java | 6 +- .../plantuml/ugraphic/g2d/DriverPathG2d.java | 12 +- .../ugraphic/g2d/DriverPathG2dLegacy.java | 12 +- .../ugraphic/g2d/DriverPathOldG2d.java | 12 +- .../plantuml/ugraphic/g2d/DriverPixelG2d.java | 2 +- .../ugraphic/g2d/DriverPolygonG2d.java | 12 +- .../ugraphic/g2d/DriverRectangleG2d.java | 28 +- .../ugraphic/g2d/DriverTextAsPathG2d.java | 10 +- .../plantuml/ugraphic/g2d/DriverTextG2d.java | 10 +- .../plantuml/ugraphic/g2d/UGraphicG2d.java | 2 +- .../ugraphic/hand/UGraphicHandwritten.java | 2 +- .../ugraphic/html5/DriverLineHtml5.java | 2 +- .../ugraphic/html5/DriverNopHtml5.java | 2 +- .../ugraphic/html5/DriverRectangleHtml5.java | 10 +- .../ugraphic/html5/UGraphicHtml5.java | 2 +- .../svg/DriverCenteredCharacterSvg.java | 2 +- .../ugraphic/svg/DriverDotPathSvg.java | 2 +- .../ugraphic/svg/DriverEllipseSvg.java | 16 +- .../plantuml/ugraphic/svg/DriverImagePng.java | 2 +- .../ugraphic/svg/DriverImageSvgSvg.java | 2 +- .../plantuml/ugraphic/svg/DriverLineSvg.java | 12 +- .../plantuml/ugraphic/svg/DriverNoneSvg.java | 2 +- .../plantuml/ugraphic/svg/DriverPathSvg.java | 12 +- .../ugraphic/svg/DriverPolygonSvg.java | 12 +- .../ugraphic/svg/DriverRectangleSvg.java | 18 +- .../ugraphic/svg/DriverTextAsPathSvg.java | 2 +- .../plantuml/ugraphic/svg/DriverTextSvg.java | 12 +- .../plantuml/ugraphic/svg/UGraphicSvg.java | 6 +- .../ugraphic/tikz/DriverAtomTextTikz.java | 8 +- .../tikz/DriverCenteredCharacterTikz.java | 2 +- .../tikz/DriverCenteredCharacterTikz2.java | 2 +- .../ugraphic/tikz/DriverDotPathTikz.java | 2 +- .../ugraphic/tikz/DriverEllipseTikz.java | 2 +- .../ugraphic/tikz/DriverImageTikz.java | 2 +- .../ugraphic/tikz/DriverLineTikz.java | 2 +- .../ugraphic/tikz/DriverNoneTikz.java | 2 +- .../ugraphic/tikz/DriverPolygonTikz.java | 12 +- .../ugraphic/tikz/DriverRectangleTikz.java | 12 +- .../ugraphic/tikz/DriverUPathTikz.java | 12 +- .../ugraphic/tikz/DriverUTextTikz.java | 6 +- .../plantuml/ugraphic/tikz/UGraphicTikz.java | 4 +- .../plantuml/ugraphic/txt/UGraphicTxt.java | 2 +- .../ugraphic/visio/DriverDotPathVdx.java | 2 +- .../ugraphic/visio/DriverLineVdx.java | 2 +- .../ugraphic/visio/DriverNoneVdx.java | 2 +- .../ugraphic/visio/DriverPolygonVdx.java | 2 +- .../ugraphic/visio/DriverRectangleVdx.java | 2 +- .../ugraphic/visio/DriverTextVdx.java | 2 +- .../ugraphic/visio/DriverUPathVdx.java | 2 +- .../plantuml/ugraphic/visio/UGraphicVdx.java | 4 +- .../sourceforge/plantuml/utils/Cypher.java | 2 +- .../sourceforge/plantuml/version/License.java | 26 ++ .../plantuml/version/PSystemKeycheck.java | 10 +- .../plantuml/version/PSystemKeygen.java | 10 +- .../plantuml/version/PSystemLicense.java | 8 +- .../plantuml/version/PSystemVersion.java | 2 +- .../sourceforge/plantuml/version/Version.java | 4 +- src/net/sourceforge/plantuml/wbs/Fork.java | 2 +- .../sourceforge/plantuml/wbs/ITFComposed.java | 2 +- .../sourceforge/plantuml/wbs/WBSDiagram.java | 4 +- .../plantuml/wbs/WBSTextBlock.java | 4 +- src/net/sourceforge/plantuml/wire/Block.java | 4 +- .../plantuml/wire/WireDiagram.java | 4 +- 721 files changed, 5390 insertions(+), 3980 deletions(-) rename src/net/sourceforge/plantuml/creole/{ => atom}/AbstractAtom.java (97%) rename src/net/sourceforge/plantuml/creole/{ => atom}/Atom.java (97%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomHorizontalTexts.java (96%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomImg.java (98%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomImgSvg.java (97%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomMath.java (86%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomOpenIcon.java (91%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomSpace.java (97%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomSprite.java (88%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomTable.java (87%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomText.java (95%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomTree.java (90%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomVerticalTexts.java (96%) rename src/net/sourceforge/plantuml/creole/{ => atom}/AtomWithMargin.java (93%) rename src/net/sourceforge/plantuml/creole/{ => atom}/Bullet.java (92%) rename src/net/sourceforge/plantuml/creole/{ => command}/Command.java (93%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleColorAndSizeChange.java (91%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleColorChange.java (90%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleExposantChange.java (96%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleFontFamilyChange.java (96%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleImg.java (96%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleLatex.java (95%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleMath.java (95%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleMonospaced.java (96%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleOpenIcon.java (86%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleQrcode.java (95%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSizeChange.java (96%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSpace.java (96%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSprite.java (86%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleStyle.java (94%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSvgAttributeChange.java (96%) rename src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleUrl.java (96%) delete mode 100644 src/net/sourceforge/plantuml/graphic/HtmlColorTransparent.java rename src/net/sourceforge/plantuml/{timingdiagram/PlayerRobust.java => project/core/AbstractTask.java} (66%) create mode 100644 src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java rename src/net/sourceforge/plantuml/{timingdiagram/PlayerConcise.java => project/draw/PathUtils.java} (58%) create mode 100644 src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java create mode 100644 src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java rename src/net/sourceforge/plantuml/project/{DayAsDate.java => time/Day.java} (69%) rename src/net/sourceforge/plantuml/project/{ => time}/DayOfWeek.java (98%) rename src/net/sourceforge/plantuml/project/{ => time}/GCalendar.java (84%) rename src/net/sourceforge/plantuml/project/{core => time}/Month.java (95%) create mode 100644 src/net/sourceforge/plantuml/project/time/MonthYear.java rename src/net/sourceforge/plantuml/project/{core => time}/Wink.java (86%) rename src/net/sourceforge/plantuml/project/timescale/{TimeScaleWeekly.java => TimeScaleCompressed.java} (77%) rename src/net/sourceforge/plantuml/timingdiagram/{AbstractPlayer.java => PlayerRobustConcise.java} (53%) delete mode 100644 src/net/sourceforge/plantuml/timingdiagram/ReallyAbstractPlayer.java delete mode 100644 src/net/sourceforge/plantuml/timingdiagram/TitleStrategy.java rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandAtPlayer.java (93%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandAtTime.java (93%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandBinary.java (95%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandChangeState.java (93%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandChangeStateByPlayerCode.java (92%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandChangeStateByTime.java (92%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandClock.java (96%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandConstraint.java (93%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandDefineStateLong.java (94%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandDefineStateShort.java (94%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandHideTimeAxis.java (95%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandHighlight.java (95%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandNote.java (93%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandNoteLong.java (93%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandRobustConcise.java (93%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandScalePixel.java (95%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandTimeMessage.java (92%) rename src/net/sourceforge/plantuml/timingdiagram/{ => command}/TimeTickBuilder.java (94%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/HexaShape.java (97%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/Histogram.java (71%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/IntricatedPoint.java (96%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/PentaAShape.java (97%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/PentaBShape.java (97%) rename src/net/sourceforge/plantuml/timingdiagram/{TimeDrawing.java => graphic/PlayerDrawing.java} (79%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/PlayerFrame.java (89%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/PlayerFrame2.java (71%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorSet.java => timingdiagram/graphic/PlayerFrameEmpty.java} (79%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/Ribbon.java (57%) rename src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/TimeArrow.java (99%) rename src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorChangerMonochrome.java (97%) rename src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapper.java (90%) rename src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapperIdentity.java (65%) create mode 100644 src/net/sourceforge/plantuml/ugraphic/color/ColorMapperLightnessInverse.java rename src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapperMonochrome.java (82%) rename src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapperReverse.java (78%) rename src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapperTransparentWrapper.java (85%) rename src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorOrder.java (97%) create mode 100644 src/net/sourceforge/plantuml/ugraphic/color/ColorUtils.java rename src/net/sourceforge/plantuml/{graphic/HtmlColor.java => ugraphic/color/HColor.java} (94%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorAutomatic.java => ugraphic/color/HColorAutomatic.java} (92%) rename src/net/sourceforge/plantuml/{graphic/IHtmlColorSet.java => ugraphic/color/HColorBackground.java} (68%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorGradient.java => ugraphic/color/HColorGradient.java} (79%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorMiddle.java => ugraphic/color/HColorMiddle.java} (87%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorSetSimple.java => ugraphic/color/HColorSet.java} (89%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorSimple.java => ugraphic/color/HColorSimple.java} (77%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorUserDef.java => ugraphic/color/HColorUserDef.java} (92%) rename src/net/sourceforge/plantuml/{graphic/HtmlColorUtils.java => ugraphic/color/HColorUtils.java} (62%) create mode 100644 src/net/sourceforge/plantuml/ugraphic/color/HUSLColorConverter.java diff --git a/pom.xml b/pom.xml index dfa4ca19a..fd82e8e7a 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2020.3-SNAPSHOT + 1.2020.4-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/AnnotatedWorker.java b/src/net/sourceforge/plantuml/AnnotatedWorker.java index 7f7996a1b..5c86cc8f7 100644 --- a/src/net/sourceforge/plantuml/AnnotatedWorker.java +++ b/src/net/sourceforge/plantuml/AnnotatedWorker.java @@ -44,8 +44,6 @@ import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; @@ -60,6 +58,8 @@ import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class AnnotatedWorker { @@ -97,7 +97,7 @@ public class AnnotatedWorker { final double y1 = 10; final double y2 = 10; - final SymbolContext symbolContext = new SymbolContext(getSkinParam().getBackgroundColor(), HtmlColorUtils.BLACK) + final SymbolContext symbolContext = new SymbolContext(getSkinParam().getBackgroundColor(), HColorUtils.BLACK) .withShadow(getSkinParam().shadowing(null) ? 3 : 0); final MinMax originalMinMax = TextBlockUtils.getMinMax(original, stringBounder); final TextBlock title = mainFrame.create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null), @@ -112,7 +112,7 @@ public class AnnotatedWorker { return new TextBlockBackcolored() { public void drawU(UGraphic ug) { - frame.drawU(ug.apply(new UTranslate(originalMinMax.getMinX(), 0))); + frame.drawU(ug.apply(UTranslate.dx(originalMinMax.getMinX()))); original.drawU(ug.apply(new UTranslate(x1, y1 + dimTitle.getHeight()))); // original.drawU(ug); } @@ -131,7 +131,7 @@ public class AnnotatedWorker { return original.calculateDimension(stringBounder); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return symbolContext.getBackColor(); } }; diff --git a/src/net/sourceforge/plantuml/BlockUml.java b/src/net/sourceforge/plantuml/BlockUml.java index 4d49c9c7f..d4547ef68 100644 --- a/src/net/sourceforge/plantuml/BlockUml.java +++ b/src/net/sourceforge/plantuml/BlockUml.java @@ -40,7 +40,9 @@ import java.security.MessageDigest; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import net.sourceforge.plantuml.code.AsciiEncoder; import net.sourceforge.plantuml.code.Transcoder; @@ -49,6 +51,7 @@ import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemErrorPreprocessor; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc2.PreprocessorModeSet; import net.sourceforge.plantuml.tim.TimLoader; import net.sourceforge.plantuml.utils.StartUtils; @@ -61,6 +64,11 @@ public class BlockUml { private Diagram system; private final Defines localDefines; private final ISkinSimple skinParam; + private final Set included = new HashSet(); + + public Set getIncluded() { + return Collections.unmodifiableSet(included); + } BlockUml(String... strings) { this(convert(strings), Defines.createEmpty(), null, null); @@ -111,7 +119,7 @@ public class BlockUml { } else { final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset(), (DefinitionsContainer) mode); - timLoader.load(strings); + this.included.addAll(timLoader.load(strings)); this.data = timLoader.getResultList(); this.debug = timLoader.getDebug(); this.preprocessorError = timLoader.isPreprocessorError(); diff --git a/src/net/sourceforge/plantuml/BlockUmlBuilder.java b/src/net/sourceforge/plantuml/BlockUmlBuilder.java index 92319e1ca..b103ea1bc 100644 --- a/src/net/sourceforge/plantuml/BlockUmlBuilder.java +++ b/src/net/sourceforge/plantuml/BlockUmlBuilder.java @@ -75,7 +75,7 @@ public final class BlockUmlBuilder implements DefinitionsContainer { } finally { if (includer != null) { includer.close(); - usedFiles = includer.getFilesUsed(); + // usedFiles = includer.getFilesUsedTOBEREMOVED(); } readerInit.close(); } @@ -120,7 +120,9 @@ public final class BlockUmlBuilder implements DefinitionsContainer { if (paused) { current2.add(s); } - blocks.add(new BlockUml(current2, defines.cloneMe(), null, this)); + final BlockUml uml = new BlockUml(current2, defines.cloneMe(), null, this); + usedFiles.addAll(uml.getIncluded()); + blocks.add(uml); current2 = null; reader.setPaused(false); } diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java index b1b8b0b9c..36c5ddacb 100644 --- a/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/net/sourceforge/plantuml/ColorParam.java @@ -35,164 +35,164 @@ */ package net.sourceforge.plantuml; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public enum ColorParam { - background(HtmlColorUtils.WHITE, true, ColorType.BACK), - hyperlink(HtmlColorUtils.BLUE), + background(HColorUtils.WHITE, true, ColorType.BACK), + hyperlink(HColorUtils.BLUE), - activityDiamondBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - activityDiamondBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - activityBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - activityBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - activityStart(HtmlColorUtils.BLACK), - activityEnd(HtmlColorUtils.BLACK), - activityBar(HtmlColorUtils.BLACK), - swimlaneBorder(HtmlColorUtils.BLACK), + activityDiamondBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + activityDiamondBorder(HColorUtils.MY_RED, ColorType.LINE), + activityBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + activityBorder(HColorUtils.MY_RED, ColorType.LINE), + activityStart(HColorUtils.BLACK), + activityEnd(HColorUtils.BLACK), + activityBar(HColorUtils.BLACK), + swimlaneBorder(HColorUtils.BLACK), swimlaneTitleBackground(null), - usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - usecaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), + usecaseBorder(HColorUtils.MY_RED, ColorType.LINE), + usecaseBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), - objectBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - objectBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + objectBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + objectBorder(HColorUtils.MY_RED, ColorType.LINE), classHeaderBackground(null, true, ColorType.BACK), - classBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - enumBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - classBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - stereotypeCBackground(HtmlColorUtils.COL_ADD1B2), - stereotypeNBackground(HtmlColorUtils.COL_E3664A), - stereotypeABackground(HtmlColorUtils.COL_A9DCDF), - stereotypeIBackground(HtmlColorUtils.COL_B4A7E5), - stereotypeEBackground(HtmlColorUtils.COL_EB937F), + classBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + enumBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + classBorder(HColorUtils.MY_RED, ColorType.LINE), + stereotypeCBackground(HColorUtils.COL_ADD1B2), + stereotypeNBackground(HColorUtils.COL_E3664A), + stereotypeABackground(HColorUtils.COL_A9DCDF), + stereotypeIBackground(HColorUtils.COL_B4A7E5), + stereotypeEBackground(HColorUtils.COL_EB937F), stereotypeCBorder(null), stereotypeNBorder(null), stereotypeABorder(null), stereotypeIBorder(null), stereotypeEBorder(null), - packageBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - packageBorder(HtmlColorUtils.BLACK, ColorType.LINE), + packageBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + packageBorder(HColorUtils.BLACK, ColorType.LINE), - partitionBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - partitionBorder(HtmlColorUtils.BLACK, ColorType.LINE), + partitionBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + partitionBorder(HColorUtils.BLACK, ColorType.LINE), - componentBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - componentBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - interfaceBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - interfaceBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - arrow(HtmlColorUtils.MY_RED, ColorType.ARROW), + componentBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + componentBorder(HColorUtils.MY_RED, ColorType.LINE), + interfaceBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + interfaceBorder(HColorUtils.MY_RED, ColorType.LINE), + arrow(HColorUtils.MY_RED, ColorType.ARROW), - stateBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - stateBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - stateStart(HtmlColorUtils.BLACK), - stateEnd(HtmlColorUtils.BLACK), + stateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + stateBorder(HColorUtils.MY_RED, ColorType.LINE), + stateStart(HColorUtils.BLACK), + stateEnd(HColorUtils.BLACK), - noteBackground(HtmlColorUtils.COL_FBFB77, true, ColorType.BACK), - noteBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + noteBackground(HColorUtils.COL_FBFB77, true, ColorType.BACK), + noteBorder(HColorUtils.MY_RED, ColorType.LINE), - legendBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK), - legendBorder(HtmlColorUtils.BLACK, ColorType.LINE), + legendBackground(HColorUtils.COL_DDDDDD, true, ColorType.BACK), + legendBorder(HColorUtils.BLACK, ColorType.LINE), titleBackground(null, true, ColorType.BACK), titleBorder(null, ColorType.LINE), diagramBorder(null, ColorType.LINE), - actorBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - actorBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - participantBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - participantBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - sequenceGroupBorder(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), - sequenceGroupBodyBackground(HtmlColorUtils.RED, true, ColorType.BACK), - sequenceReferenceBorder(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), - sequenceReferenceBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), - sequenceDividerBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), - sequenceDividerBorder(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceLifeLineBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), - sequenceLifeLineBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - sequenceNewpageSeparator(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceBoxBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK), + actorBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + actorBorder(HColorUtils.MY_RED, ColorType.LINE), + participantBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + participantBorder(HColorUtils.MY_RED, ColorType.LINE), + sequenceGroupBorder(HColorUtils.BLACK, ColorType.LINE), + sequenceGroupBackground(HColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceGroupBodyBackground(HColorUtils.RED, true, ColorType.BACK), + sequenceReferenceBorder(HColorUtils.BLACK, ColorType.LINE), + sequenceReferenceHeaderBackground(HColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceReferenceBackground(HColorUtils.WHITE, true, ColorType.BACK), + sequenceDividerBackground(HColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceDividerBorder(HColorUtils.BLACK, ColorType.LINE), + sequenceLifeLineBackground(HColorUtils.WHITE, true, ColorType.BACK), + sequenceLifeLineBorder(HColorUtils.MY_RED, ColorType.LINE), + sequenceNewpageSeparator(HColorUtils.BLACK, ColorType.LINE), + sequenceBoxBorder(HColorUtils.MY_RED, ColorType.LINE), + sequenceBoxBackground(HColorUtils.COL_DDDDDD, true, ColorType.BACK), - artifactBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - artifactBorder(HtmlColorUtils.BLACK, ColorType.LINE), - cloudBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - cloudBorder(HtmlColorUtils.BLACK, ColorType.LINE), - queueBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - queueBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - stackBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - stackBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - databaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - databaseBorder(HtmlColorUtils.BLACK, ColorType.LINE), - folderBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - folderBorder(HtmlColorUtils.BLACK, ColorType.LINE), - fileBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - fileBorder(HtmlColorUtils.BLACK, ColorType.LINE), - frameBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - frameBorder(HtmlColorUtils.BLACK, ColorType.LINE), - nodeBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - nodeBorder(HtmlColorUtils.BLACK, ColorType.LINE), - rectangleBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - rectangleBorder(HtmlColorUtils.BLACK, ColorType.LINE), - archimateBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - archimateBorder(HtmlColorUtils.BLACK, ColorType.LINE), - cardBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - cardBorder(HtmlColorUtils.BLACK, ColorType.LINE), - agentBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - agentBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - storageBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - storageBorder(HtmlColorUtils.BLACK, ColorType.LINE), - boundaryBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - boundaryBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - collectionsBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - collectionsBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - controlBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - controlBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - entityBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - entityBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + artifactBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + artifactBorder(HColorUtils.BLACK, ColorType.LINE), + cloudBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + cloudBorder(HColorUtils.BLACK, ColorType.LINE), + queueBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + queueBorder(HColorUtils.MY_RED, ColorType.LINE), + stackBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + stackBorder(HColorUtils.MY_RED, ColorType.LINE), + databaseBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + databaseBorder(HColorUtils.BLACK, ColorType.LINE), + folderBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + folderBorder(HColorUtils.BLACK, ColorType.LINE), + fileBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + fileBorder(HColorUtils.BLACK, ColorType.LINE), + frameBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + frameBorder(HColorUtils.BLACK, ColorType.LINE), + nodeBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + nodeBorder(HColorUtils.BLACK, ColorType.LINE), + rectangleBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + rectangleBorder(HColorUtils.BLACK, ColorType.LINE), + archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + archimateBorder(HColorUtils.BLACK, ColorType.LINE), + cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + cardBorder(HColorUtils.BLACK, ColorType.LINE), + agentBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + agentBorder(HColorUtils.MY_RED, ColorType.LINE), + storageBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + storageBorder(HColorUtils.BLACK, ColorType.LINE), + boundaryBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + boundaryBorder(HColorUtils.MY_RED, ColorType.LINE), + collectionsBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + collectionsBorder(HColorUtils.MY_RED, ColorType.LINE), + controlBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + controlBorder(HColorUtils.MY_RED, ColorType.LINE), + entityBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + entityBorder(HColorUtils.MY_RED, ColorType.LINE), - iconPrivate(HtmlColorUtils.COL_C82930), - iconPrivateBackground(HtmlColorUtils.COL_F24D5C), - iconPackage(HtmlColorUtils.COL_1963A0), - iconPackageBackground(HtmlColorUtils.COL_4177AF), - iconProtected(HtmlColorUtils.COL_B38D22), - iconProtectedBackground(HtmlColorUtils.COL_FFFF44), - iconPublic(HtmlColorUtils.COL_038048), - iconPublicBackground(HtmlColorUtils.COL_84BE84), - iconIEMandatory(HtmlColorUtils.BLACK), + iconPrivate(HColorUtils.COL_C82930), + iconPrivateBackground(HColorUtils.COL_F24D5C), + iconPackage(HColorUtils.COL_1963A0), + iconPackageBackground(HColorUtils.COL_4177AF), + iconProtected(HColorUtils.COL_B38D22), + iconProtectedBackground(HColorUtils.COL_FFFF44), + iconPublic(HColorUtils.COL_038048), + iconPublicBackground(HColorUtils.COL_84BE84), + iconIEMandatory(HColorUtils.BLACK), - arrowLollipop(HtmlColorUtils.WHITE), + arrowLollipop(HColorUtils.WHITE), - machineBackground(HtmlColorUtils.WHITE), - machineBorder(HtmlColorUtils.BLACK, ColorType.LINE), - requirementBackground(HtmlColorUtils.WHITE), - requirementBorder(HtmlColorUtils.BLACK, ColorType.LINE), - designedBackground(HtmlColorUtils.WHITE), - designedBorder(HtmlColorUtils.BLACK, ColorType.LINE), - domainBackground(HtmlColorUtils.WHITE), - domainBorder(HtmlColorUtils.BLACK, ColorType.LINE), - lexicalBackground(HtmlColorUtils.WHITE), - lexicalBorder(HtmlColorUtils.BLACK, ColorType.LINE), - biddableBackground(HtmlColorUtils.WHITE), - biddableBorder(HtmlColorUtils.BLACK, ColorType.LINE); + machineBackground(HColorUtils.WHITE), + machineBorder(HColorUtils.BLACK, ColorType.LINE), + requirementBackground(HColorUtils.WHITE), + requirementBorder(HColorUtils.BLACK, ColorType.LINE), + designedBackground(HColorUtils.WHITE), + designedBorder(HColorUtils.BLACK, ColorType.LINE), + domainBackground(HColorUtils.WHITE), + domainBorder(HColorUtils.BLACK, ColorType.LINE), + lexicalBackground(HColorUtils.WHITE), + lexicalBorder(HColorUtils.BLACK, ColorType.LINE), + biddableBackground(HColorUtils.WHITE), + biddableBorder(HColorUtils.BLACK, ColorType.LINE); private final boolean isBackground; - private final HtmlColor defaultValue; + private final HColor defaultValue; private final ColorType colorType; - private ColorParam(HtmlColor defaultValue, ColorType colorType) { + private ColorParam(HColor defaultValue, ColorType colorType) { this(defaultValue, false, colorType); } - private ColorParam(HtmlColor defaultValue) { + private ColorParam(HColor defaultValue) { this(defaultValue, false, null); } @@ -204,7 +204,7 @@ public enum ColorParam { this(null, isBackground, null); } - private ColorParam(HtmlColor defaultValue, boolean isBackground, ColorType colorType) { + private ColorParam(HColor defaultValue, boolean isBackground, ColorType colorType) { this.isBackground = isBackground; this.defaultValue = defaultValue; this.colorType = colorType; @@ -218,7 +218,7 @@ public enum ColorParam { return isBackground; } - public final HtmlColor getDefaultValue() { + public final HColor getDefaultValue() { return defaultValue; } diff --git a/src/net/sourceforge/plantuml/EmbeddedDiagram.java b/src/net/sourceforge/plantuml/EmbeddedDiagram.java index d6409ed2f..b7294982e 100644 --- a/src/net/sourceforge/plantuml/EmbeddedDiagram.java +++ b/src/net/sourceforge/plantuml/EmbeddedDiagram.java @@ -45,7 +45,7 @@ import java.util.List; import javax.imageio.ImageIO; import net.sourceforge.plantuml.core.Diagram; -import net.sourceforge.plantuml.creole.Atom; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; diff --git a/src/net/sourceforge/plantuml/EmptyImageBuilder.java b/src/net/sourceforge/plantuml/EmptyImageBuilder.java index e11dac0ed..a7801f8ff 100644 --- a/src/net/sourceforge/plantuml/EmptyImageBuilder.java +++ b/src/net/sourceforge/plantuml/EmptyImageBuilder.java @@ -41,8 +41,8 @@ import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UAntiAliasing; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; public class EmptyImageBuilder { diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 1016c718d..92ae31cf0 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.ActorStyle; @@ -54,22 +53,23 @@ import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface ISkinParam extends ISkinSimple { public static final int SWIMLANE_WIDTH_SAME = -1; - public HtmlColor getHyperlinkColor(); + public HColor getHyperlinkColor(); public boolean useUnderlineForHyperlink(); - public HtmlColor getBackgroundColor(); + public HColor getBackgroundColor(); - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable); + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable); public Colors getColors(ColorParam param, Stereotype stereotype); - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param); + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param); public UStroke getThickness(LineParam param, Stereotype stereotype); @@ -156,7 +156,7 @@ public interface ISkinParam extends ISkinSimple { public UmlDiagramType getUmlDiagramType(); - public HtmlColor getHoverPathColor(); + public HColor getHoverPathColor(); public TikzFontDistortion getTikzFontDistortion(); diff --git a/src/net/sourceforge/plantuml/ISkinSimple.java b/src/net/sourceforge/plantuml/ISkinSimple.java index b008383e8..5a86337d5 100644 --- a/src/net/sourceforge/plantuml/ISkinSimple.java +++ b/src/net/sourceforge/plantuml/ISkinSimple.java @@ -37,8 +37,8 @@ package net.sourceforge.plantuml; import java.util.Map; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public interface ISkinSimple extends SpriteContainer { @@ -52,7 +52,7 @@ public interface ISkinSimple extends SpriteContainer { public int getTabSize(); - public IHtmlColorSet getIHtmlColorSet(); + public HColorSet getIHtmlColorSet(); public int getDpi(); diff --git a/src/net/sourceforge/plantuml/LineConfigurable.java b/src/net/sourceforge/plantuml/LineConfigurable.java index 8358bc886..b55381981 100644 --- a/src/net/sourceforge/plantuml/LineConfigurable.java +++ b/src/net/sourceforge/plantuml/LineConfigurable.java @@ -35,15 +35,15 @@ */ package net.sourceforge.plantuml; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface LineConfigurable { public Colors getColors(ISkinParam skinParam); - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color); + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color); diff --git a/src/net/sourceforge/plantuml/LineParam.java b/src/net/sourceforge/plantuml/LineParam.java index bebacc0e3..3b3704394 100644 --- a/src/net/sourceforge/plantuml/LineParam.java +++ b/src/net/sourceforge/plantuml/LineParam.java @@ -58,6 +58,7 @@ public enum LineParam { archimateBorder, componentBorder, cardBorder, + queueBorder, agentBorder, domainBorder, designedDomainBorder, machineBorder, requirementBorder; // sequenceBoxBorder(0.1); diff --git a/src/net/sourceforge/plantuml/PSystemUtils.java b/src/net/sourceforge/plantuml/PSystemUtils.java index c3fe74f62..0dff2f50a 100644 --- a/src/net/sourceforge/plantuml/PSystemUtils.java +++ b/src/net/sourceforge/plantuml/PSystemUtils.java @@ -49,11 +49,11 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.html.CucaDiagramHtmlMaker; import net.sourceforge.plantuml.png.PngSplitter; import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemUtils { @@ -300,7 +300,7 @@ public class PSystemUtils { List result = Arrays.asList(suggestedFile.getFile(0)); if (fileFormat.getFileFormat() == FileFormat.PNG) { - final SplitParam splitParam = new SplitParam(HtmlColorUtils.BLACK, null, 5); + final SplitParam splitParam = new SplitParam(HColorUtils.BLACK, null, 5); result = new PngSplitter(suggestedFile, system.getHorizontalPages(), system.getVerticalPages(), system.getMetadata(), system.getDpi(fileFormat), fileFormat.isWithMetadata(), splitParam) .getFiles(); diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java index 9715273b2..4964007ec 100644 --- a/src/net/sourceforge/plantuml/Run.java +++ b/src/net/sourceforge/plantuml/Run.java @@ -291,8 +291,8 @@ public class Run { } final String name = getSpriteName(fileName); - final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level) : SpriteUtils.encode(im, name, - level); + final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level) + : SpriteUtils.encode(im, name, level); System.out.println(s); } @@ -326,8 +326,8 @@ public class Run { public static void printFonts() { final Font fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); for (Font f : fonts) { - System.out.println("f=" + f + "/" + f.getPSName() + "/" + f.getName() + "/" + f.getFontName() + "/" - + f.getFamily()); + System.out.println( + "f=" + f + "/" + f.getPSName() + "/" + f.getName() + "/" + f.getFontName() + "/" + f.getFamily()); } final String name[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for (String n : name) { @@ -458,8 +458,8 @@ public class Run { ProgressBar.incTotal(nb); } - private static void manageFileInternal(File f, Option option, ErrorStatus error) throws IOException, - InterruptedException { + private static void manageFileInternal(File f, Option option, ErrorStatus error) + throws IOException, InterruptedException { Log.info("Working on " + f.getAbsolutePath()); if (OptionFlags.getInstance().isExtractFromMetadata()) { System.out.println("------------------------"); @@ -540,9 +540,19 @@ public class Run { final File file = suggested.getFile(0); Log.info("Export preprocessing source to " + file.getAbsolutePath()); final PrintWriter pw = charset == null ? new PrintWriter(file) : new PrintWriter(file, charset); - for (CharSequence s : blockUml.getDefinition(true)) { + int level = 0; + for (CharSequence cs : blockUml.getDefinition(true)) { + String s = cs.toString(); if (cypher != null) { - s = cypher.cypher(s.toString()); + if (s.contains("skinparam") && s.contains("{")) { + level++; + } + if (level == 0 && s.contains("skinparam") == false) { + s = cypher.cypher(s); + } + if (level > 0 && s.contains("}")) { + level--; + } } pw.println(s); } diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index f98652eb4..5b3b82ae8 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -52,16 +52,12 @@ import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; -import net.sourceforge.plantuml.creole.CommandCreoleMonospaced; +import net.sourceforge.plantuml.creole.command.CommandCreoleMonospaced; import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.ActorStyle; @@ -76,13 +72,17 @@ import net.sourceforge.plantuml.style.StyleLoader; import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; -import net.sourceforge.plantuml.ugraphic.ColorMapperMonochrome; -import net.sourceforge.plantuml.ugraphic.ColorMapperReverse; -import net.sourceforge.plantuml.ugraphic.ColorOrder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperLightnessInverse; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperMonochrome; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperReverse; +import net.sourceforge.plantuml.ugraphic.color.ColorOrder; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class SkinParam implements ISkinParam { @@ -255,18 +255,18 @@ public class SkinParam implements ISkinParam { return s.replaceAll(src, target); } - public HtmlColor getHyperlinkColor() { - final HtmlColor result = getHtmlColor(ColorParam.hyperlink, null, false); + public HColor getHyperlinkColor() { + final HColor result = getHtmlColor(ColorParam.hyperlink, null, false); if (result == null) { - return HtmlColorUtils.BLUE; + return HColorUtils.BLUE; } return result; } - public HtmlColor getBackgroundColor() { - final HtmlColor result = getHtmlColor(ColorParam.background, null, false); + public HColor getBackgroundColor() { + final HColor result = getHtmlColor(ColorParam.background, null, false); if (result == null) { - return HtmlColorUtils.WHITE; + return HColorUtils.WHITE; } return result; } @@ -296,7 +296,7 @@ public class SkinParam implements ISkinParam { return sb.toString(); } - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (stereotype != null) { checkStereotype(stereotype); for (String s : stereotype.getMultipleLabels()) { @@ -310,9 +310,16 @@ public class SkinParam implements ISkinParam { if (value == null) { return null; } - final boolean acceptTransparent = param == ColorParam.background - || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground; - return getIHtmlColorSet().getColorIfValid(value, acceptTransparent); + if (param == ColorParam.background && value.equalsIgnoreCase("transparent")) { + return null; + } + if (param == ColorParam.background) { + return getIHtmlColorSet().getColorIfValid(value); + } + assert param != ColorParam.background; +// final boolean acceptTransparent = param == ColorParam.background +// || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground; + return getIHtmlColorSet().getColorIfValid(value, getBackgroundColor()); } public char getCircledCharacter(Stereotype stereotype) { @@ -352,7 +359,8 @@ public class SkinParam implements ISkinParam { } private void checkStereotype(Stereotype stereotype) { - // if (stereotype.startsWith("<<") == false || stereotype.endsWith(">>") == false) { + // if (stereotype.startsWith("<<") == false || stereotype.endsWith(">>") == + // false) { // throw new IllegalArgumentException(); // } } @@ -399,7 +407,7 @@ public class SkinParam implements ISkinParam { return param[0].getDefaultFamily(); } - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { String value = null; if (stereotype != null) { checkStereotype(stereotype); @@ -684,6 +692,9 @@ public class SkinParam implements ISkinParam { if (value == null) { return new ColorMapperIdentity(); } + if ("dark".equalsIgnoreCase(value)) { + return new ColorMapperLightnessInverse(); + } final ColorOrder order = ColorOrder.fromString(value); if (order == null) { return new ColorMapperIdentity(); @@ -876,14 +887,14 @@ public class SkinParam implements ISkinParam { if (stereotype != null) { checkStereotype(stereotype); - final String styleValue = getValue(param.name() + "style" - + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); + final String styleValue = getValue( + param.name() + "style" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); if (styleValue != null) { style = LinkStyle.fromString2(styleValue); } - final String value2 = getValue(param.name() + "thickness" - + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); + final String value2 = getValue( + param.name() + "thickness" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); if (value2 != null && value2.matches("[\\d.]+")) { if (style == null) { style = LinkStyle.NORMAL(); @@ -1000,9 +1011,9 @@ public class SkinParam implements ISkinParam { return false; } - private final IHtmlColorSet htmlColorSet = new HtmlColorSetSimple(); + private final HColorSet htmlColorSet = HColorSet.instance(); - public IHtmlColorSet getIHtmlColorSet() { + public HColorSet getIHtmlColorSet() { return htmlColorSet; } @@ -1116,12 +1127,12 @@ public class SkinParam implements ISkinParam { return type; } - public HtmlColor getHoverPathColor() { + public HColor getHoverPathColor() { final String value = getValue("pathhovercolor"); if (value == null) { return null; } - return getIHtmlColorSet().getColorIfValid(value, false); + return getIHtmlColorSet().getColorIfValid(value, null); } public double getPadding() { @@ -1199,8 +1210,8 @@ public class SkinParam implements ISkinParam { if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) { return Padder.NONE; } - final HtmlColor border = getIHtmlColorSet().getColorIfValid(borderColor); - final HtmlColor background = getIHtmlColorSet().getColorIfValid(backgroundColor); + final HColor border = getIHtmlColorSet().getColorIfValid(borderColor); + final HColor background = getIHtmlColorSet().getColorIfValid(backgroundColor); final double roundCorner = getRoundCorner(CornerParam.DEFAULT, null); return Padder.NONE.withMargin(margin).withPadding(padding).withBackgroundColor(background) .withBorderColor(border).withRoundCorner(roundCorner); diff --git a/src/net/sourceforge/plantuml/SkinParamBackcolored.java b/src/net/sourceforge/plantuml/SkinParamBackcolored.java index fb19cb225..fe4e7a983 100644 --- a/src/net/sourceforge/plantuml/SkinParamBackcolored.java +++ b/src/net/sourceforge/plantuml/SkinParamBackcolored.java @@ -39,23 +39,23 @@ import java.util.EnumMap; import java.util.Map; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamBackcolored extends SkinParamDelegator { - final private HtmlColor backColorElement; - final private HtmlColor backColorGeneral; + final private HColor backColorElement; + final private HColor backColorGeneral; final private boolean forceClickage; - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement) { + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement) { this(skinParam, backColorElement, null, false); } - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, boolean forceClickage) { + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement, boolean forceClickage) { this(skinParam, backColorElement, null, forceClickage); } - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, HtmlColor backColorGeneral) { + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement, HColor backColorGeneral) { this(skinParam, backColorElement, backColorGeneral, false); } @@ -64,7 +64,7 @@ public class SkinParamBackcolored extends SkinParamDelegator { return super.toString() + " " + backColorElement + " " + backColorGeneral; } - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, HtmlColor backColorGeneral, + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement, HColor backColorGeneral, boolean forceClickage) { super(skinParam); this.forceClickage = forceClickage; @@ -73,7 +73,7 @@ public class SkinParamBackcolored extends SkinParamDelegator { } @Override - public HtmlColor getBackgroundColor() { + public HColor getBackgroundColor() { if (backColorGeneral != null) { return backColorGeneral; } @@ -81,27 +81,27 @@ public class SkinParamBackcolored extends SkinParamDelegator { } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (param.isBackground() && backColorElement != null) { return backColorElement; } if (forceClickage) { - final HtmlColor c1 = super.getHtmlColor(param, stereotype, true); + final HColor c1 = super.getHtmlColor(param, stereotype, true); if (c1 != null) { return c1; } // clickable = true; } - final HtmlColor forcedColor = forced.get(param); + final HColor forcedColor = forced.get(param); if (forcedColor != null) { return forcedColor; } return super.getHtmlColor(param, stereotype, clickable); } - private final Map forced = new EnumMap(ColorParam.class); + private final Map forced = new EnumMap(ColorParam.class); - public void forceColor(ColorParam param, HtmlColor color) { + public void forceColor(ColorParam param, HColor color) { forced.put(param, color); } diff --git a/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java b/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java index 79c5d112b..1c5092f4d 100644 --- a/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java +++ b/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java @@ -36,22 +36,22 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamBackcoloredReference extends SkinParamDelegator { - final private HtmlColor sequenceReferenceHeaderBackground; - final private HtmlColor sequenceReferenceBackground; + final private HColor sequenceReferenceHeaderBackground; + final private HColor sequenceReferenceBackground; - public SkinParamBackcoloredReference(ISkinParam skinParam, HtmlColor sequenceReferenceHeaderBackground, - HtmlColor sequenceReferenceBackground) { + public SkinParamBackcoloredReference(ISkinParam skinParam, HColor sequenceReferenceHeaderBackground, + HColor sequenceReferenceBackground) { super(skinParam); this.sequenceReferenceBackground = sequenceReferenceBackground; this.sequenceReferenceHeaderBackground = sequenceReferenceHeaderBackground; } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (param == ColorParam.sequenceReferenceHeaderBackground && sequenceReferenceHeaderBackground != null) { return sequenceReferenceHeaderBackground; } diff --git a/src/net/sourceforge/plantuml/SkinParamColors.java b/src/net/sourceforge/plantuml/SkinParamColors.java index 4233e68eb..bd278ab6d 100644 --- a/src/net/sourceforge/plantuml/SkinParamColors.java +++ b/src/net/sourceforge/plantuml/SkinParamColors.java @@ -36,9 +36,9 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamColors extends SkinParamDelegator { @@ -67,8 +67,8 @@ public class SkinParamColors extends SkinParamDelegator { } @Override - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { - final HtmlColor value = colors.getColor(ColorType.TEXT); + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { + final HColor value = colors.getColor(ColorType.TEXT); if (value == null) { return super.getFontHtmlColor(stereotype, param); } @@ -76,12 +76,12 @@ public class SkinParamColors extends SkinParamDelegator { } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { final ColorType type = param.getColorType(); if (type == null) { return super.getHtmlColor(param, stereotype, clickable); } - final HtmlColor value = colors.getColor(type); + final HColor value = colors.getColor(type); if (value != null) { return value; } diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 618eb708b..665653c83 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -42,8 +42,6 @@ import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.ActorStyle; @@ -55,9 +53,11 @@ import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class SkinParamDelegator implements ISkinParam { @@ -67,11 +67,11 @@ public class SkinParamDelegator implements ISkinParam { this.skinParam = skinParam; } - public HtmlColor getHyperlinkColor() { + public HColor getHyperlinkColor() { return skinParam.getHyperlinkColor(); } - public HtmlColor getBackgroundColor() { + public HColor getBackgroundColor() { return skinParam.getBackgroundColor(); } @@ -83,11 +83,11 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getFont(stereotype, false, fontParam); } - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { return skinParam.getFontHtmlColor(stereotype, param); } - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { return skinParam.getHtmlColor(param, stereotype, clickable); } @@ -204,7 +204,7 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.useOctagonForActivity(stereotype); } - public IHtmlColorSet getIHtmlColorSet() { + public HColorSet getIHtmlColorSet() { return skinParam.getIHtmlColorSet(); } @@ -276,7 +276,7 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getUmlDiagramType(); } - public HtmlColor getHoverPathColor() { + public HColor getHoverPathColor() { return skinParam.getHoverPathColor(); } diff --git a/src/net/sourceforge/plantuml/SkinParamForceColor.java b/src/net/sourceforge/plantuml/SkinParamForceColor.java index 428e653c3..f7c4a5cb0 100644 --- a/src/net/sourceforge/plantuml/SkinParamForceColor.java +++ b/src/net/sourceforge/plantuml/SkinParamForceColor.java @@ -36,21 +36,21 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamForceColor extends SkinParamDelegator { final private ColorParam colorParam;; - final private HtmlColor color; + final private HColor color; - public SkinParamForceColor(ISkinParam skinParam, ColorParam colorParam, HtmlColor color) { + public SkinParamForceColor(ISkinParam skinParam, ColorParam colorParam, HColor color) { super(skinParam); this.color = color; this.colorParam = colorParam; } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (colorParam == param) { return color; } diff --git a/src/net/sourceforge/plantuml/SkinParamForecolored.java b/src/net/sourceforge/plantuml/SkinParamForecolored.java index c773cc4b2..082308ecc 100644 --- a/src/net/sourceforge/plantuml/SkinParamForecolored.java +++ b/src/net/sourceforge/plantuml/SkinParamForecolored.java @@ -36,19 +36,19 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamForecolored extends SkinParamDelegator { - final private HtmlColor forecolor; + final private HColor forecolor; - public SkinParamForecolored(ISkinParam skinParam, HtmlColor forecolor) { + public SkinParamForecolored(ISkinParam skinParam, HColor forecolor) { super(skinParam); this.forecolor = forecolor; } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { return forecolor; } diff --git a/src/net/sourceforge/plantuml/SkinParamUtils.java b/src/net/sourceforge/plantuml/SkinParamUtils.java index d92c235c6..c324c5cf3 100644 --- a/src/net/sourceforge/plantuml/SkinParamUtils.java +++ b/src/net/sourceforge/plantuml/SkinParamUtils.java @@ -36,9 +36,9 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamUtils { @@ -48,11 +48,11 @@ public class SkinParamUtils { return skinParam.getFont(stereo, false, fontParam); } - public static HtmlColor getFontColor(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { + public static HColor getFontColor(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { return skinParam.getFontHtmlColor(stereo, fontParam); } - public static HtmlColor getColor(ISkinParam skinParam, Stereotype stereo, ColorParam... colorParam) { + public static HColor getColor(ISkinParam skinParam, Stereotype stereo, ColorParam... colorParam) { return rose.getHtmlColor(skinParam, stereo, colorParam); } diff --git a/src/net/sourceforge/plantuml/SourceStringReader.java b/src/net/sourceforge/plantuml/SourceStringReader.java index 8338002fe..d2bcbbac2 100644 --- a/src/net/sourceforge/plantuml/SourceStringReader.java +++ b/src/net/sourceforge/plantuml/SourceStringReader.java @@ -51,8 +51,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class SourceStringReader { diff --git a/src/net/sourceforge/plantuml/SplitParam.java b/src/net/sourceforge/plantuml/SplitParam.java index f11f76dfc..ee83ed390 100644 --- a/src/net/sourceforge/plantuml/SplitParam.java +++ b/src/net/sourceforge/plantuml/SplitParam.java @@ -37,20 +37,20 @@ package net.sourceforge.plantuml; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class SplitParam { - private final HtmlColor borderColor; - private final HtmlColor externalColor; + private final HColor borderColor; + private final HColor externalColor; private final int externalMargin; public SplitParam() { this(null, null, 0); } - public SplitParam(HtmlColor borderColor, HtmlColor externalColor, int externalMargin) { + public SplitParam(HColor borderColor, HColor externalColor, int externalMargin) { if (borderColor != null && externalMargin == 0) { externalMargin = 1; } @@ -71,14 +71,14 @@ public class SplitParam { if (borderColor == null) { return null; } - return ((HtmlColorSimple) borderColor).getColor999(); + return ((HColorSimple) borderColor).getColor999(); } public Color getExternalColor() { if (externalColor == null) { return null; } - return ((HtmlColorSimple) externalColor).getColor999(); + return ((HColorSimple) externalColor).getColor999(); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java index b217641d1..063a82a84 100644 --- a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java +++ b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java @@ -37,13 +37,12 @@ package net.sourceforge.plantuml; import java.util.Map; -import net.sourceforge.plantuml.creole.CommandCreoleMonospaced; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.command.CommandCreoleMonospaced; import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.SpriteImage; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { @@ -71,8 +70,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { return 8; } - public IHtmlColorSet getIHtmlColorSet() { - return new HtmlColorSetSimple(); + public HColorSet getIHtmlColorSet() { + return HColorSet.instance(); } public int getDpi() { diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java index 54a16fb76..5231c61b5 100644 --- a/src/net/sourceforge/plantuml/StringUtils.java +++ b/src/net/sourceforge/plantuml/StringUtils.java @@ -49,9 +49,9 @@ import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; // Do not move public class StringUtils { @@ -371,7 +371,9 @@ public class StringUtils { public static List splitComma(String s) { s = trin(s); - // if (s.matches("([\\p{L}0-9_.]+|[%g][^%g]+[%g])(\\s*,\\s*([\\p{L}0-9_.]+|[%g][^%g]+[%g]))*") == false) { + // if + // (s.matches("([\\p{L}0-9_.]+|[%g][^%g]+[%g])(\\s*,\\s*([\\p{L}0-9_.]+|[%g][^%g]+[%g]))*") + // == false) { // throw new IllegalArgumentException(); // } final List result = new ArrayList(); @@ -390,12 +392,12 @@ public class StringUtils { return getAsHtml(color.getRGB()); } - public static String getAsSvg(ColorMapper mapper, HtmlColor color) { + public static String getAsSvg(ColorMapper mapper, HColor color) { if (color == null) { return "none"; } - if (color instanceof HtmlColorTransparent) { - return "#FFFFFF"; + if (color instanceof HColorBackground) { + return ((HColorBackground) color).getSvg(mapper); } return getAsHtml(mapper.getMappedColor(color)); } diff --git a/src/net/sourceforge/plantuml/SvgString.java b/src/net/sourceforge/plantuml/SvgString.java index 080a85397..3264516bc 100644 --- a/src/net/sourceforge/plantuml/SvgString.java +++ b/src/net/sourceforge/plantuml/SvgString.java @@ -47,6 +47,10 @@ public class SvgString { this.svg = svg; this.scale = scale; } + + public String getMD5Hex() { + return SignatureUtils.getMD5Hex(svg); + } public String getSvg(boolean raw) { String result = svg; diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index 2254c09b7..3e54ebd25 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -70,8 +70,6 @@ import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.fun.IconLoader; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.mjpeg.MJPEGGenerator; import net.sourceforge.plantuml.pdf.PdfConverter; @@ -79,11 +77,13 @@ import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.svek.EmptySvgException; import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.version.Version; public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite { @@ -182,7 +182,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) throws IOException { - final HtmlColor hover = getSkinParam().getHoverPathColor(); + final HColor hover = getSkinParam().getHoverPathColor(); if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) { fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget()); } @@ -227,7 +227,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot strings.addAll(CommandExecutionResult.getStackTrace(exception)); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, metadata, null, 0, 0, null, false); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); @@ -246,7 +246,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot public void drawU(UGraphic ug) { graphicStrings.drawU(ug); final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); - ug = ug.apply(new UTranslate(0, height)); + ug = ug.apply(UTranslate.dy(height)); ug.draw(new UImage(im).scaleNearestNeighbor(3)); } }); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index f1c2c1c72..ca4695275 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -54,7 +54,6 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockRecentred; @@ -63,6 +62,7 @@ import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.comp.CompressionMode; import net.sourceforge.plantuml.ugraphic.comp.TextBlockCompressedOnXorY; @@ -86,7 +86,7 @@ public class ActivityDiagram3 extends UmlDiagram { } } - public CommandExecutionResult swimlane(String name, HtmlColor color, Display label) { + public CommandExecutionResult swimlane(String name, HColor color, Display label) { if (swimlaneStrategy == null) { swimlaneStrategy = SwimlaneStrategy.SWIMLANE_ALLOWED; } @@ -122,7 +122,7 @@ public class ActivityDiagram3 extends UmlDiagram { } } - public void addSpot(String spot, HtmlColor color) { + public void addSpot(String spot, HColor color) { final InstructionSpot ins = new InstructionSpot(spot, color, nextLinkRenderer(), swinlanes.getCurrentSwimlane()); current().add(ins); setNextLinkRendererInternal(LinkRendering.none()); @@ -295,7 +295,7 @@ public class ActivityDiagram3 extends UmlDiagram { return CommandExecutionResult.error("Cannot find split"); } - public void startSwitch(Display test, HtmlColor color) { + public void startSwitch(Display test, HColor color) { manageSwimlaneStrategy(); final InstructionSwitch instructionSwitch = new InstructionSwitch(swinlanes.getCurrentSwimlane(), current(), test, nextLinkRenderer(), color, getSkinParam()); @@ -327,7 +327,7 @@ public class ActivityDiagram3 extends UmlDiagram { return CommandExecutionResult.error("Cannot find switch"); } - public void startIf(Display test, Display whenThen, HtmlColor color, Url url) { + public void startIf(Display test, Display whenThen, HColor color, Url url) { manageSwimlaneStrategy(); final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test, whenThen, nextLinkRenderer(), color, getSkinParam(), url); @@ -336,7 +336,7 @@ public class ActivityDiagram3 extends UmlDiagram { setCurrent(instructionIf); } - public CommandExecutionResult elseIf(Display inlabel, Display test, Display whenThen, HtmlColor color) { + public CommandExecutionResult elseIf(Display inlabel, Display test, Display whenThen, HColor color) { if (current() instanceof InstructionIf) { final boolean ok = ((InstructionIf) current()).elseIf(inlabel, test, whenThen, nextLinkRenderer(), color); if (ok == false) { @@ -371,7 +371,7 @@ public class ActivityDiagram3 extends UmlDiagram { return CommandExecutionResult.error("Cannot find if"); } - public void startRepeat(HtmlColor color, Display label, BoxStyle boxStyleIn, Colors colors) { + public void startRepeat(HColor color, Display label, BoxStyle boxStyleIn, Colors colors) { manageSwimlaneStrategy(); final InstructionRepeat instructionRepeat = new InstructionRepeat(swinlanes.getCurrentSwimlane(), current(), nextLinkRenderer(), color, label, boxStyleIn, colors); @@ -410,7 +410,7 @@ public class ActivityDiagram3 extends UmlDiagram { } - public void doWhile(Display test, Display yes, HtmlColor color) { + public void doWhile(Display test, Display yes, HColor color) { manageSwimlaneStrategy(); final InstructionWhile instructionWhile = new InstructionWhile(swinlanes.getCurrentSwimlane(), current(), test, nextLinkRenderer(), yes, color, getSkinParam()); @@ -435,7 +435,7 @@ public class ActivityDiagram3 extends UmlDiagram { return CommandExecutionResult.ok(); } - public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor, HtmlColor borderColor, + public void startGroup(Display name, HColor backColor, HColor titleColor, HColor borderColor, USymbol type, double roundCorner) { manageSwimlaneStrategy(); final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor, diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java index 79b742408..af64a0b24 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; @@ -54,6 +53,7 @@ import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Branch { @@ -61,7 +61,7 @@ public class Branch { private final Display labelTest; private final Display labelPositive; private final Display inlabel; - private final HtmlColor color; + private final HColor color; private LinkRendering inlinkRendering = LinkRendering.none(); private Ftile ftile; @@ -79,7 +79,7 @@ public class Branch { } public Branch(StyleBuilder styleBuilder, Swimlane swimlane, Display labelPositive, Display labelTest, - HtmlColor color, Display inlabel) { + HColor color, Display inlabel) { if (labelPositive == null) { throw new IllegalArgumentException(); } @@ -162,7 +162,7 @@ public class Branch { return ftile.skinParam(); } - public final HtmlColor getColor() { + public final HColor getColor() { return color; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java index 4fe8d574e..4848679a9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java @@ -43,19 +43,19 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNotes; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionGroup implements Instruction, InstructionCollection { private final InstructionList list; private final Instruction parent; - private final HtmlColor backColor; - private final HtmlColor borderColor; - private final HtmlColor titleColor; + private final HColor backColor; + private final HColor borderColor; + private final HColor titleColor; private final LinkRendering linkRendering; private final USymbol type; @@ -67,8 +67,8 @@ public class InstructionGroup implements Instruction, InstructionCollection { return list.containsBreak(); } - public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor, - Swimlane swimlane, HtmlColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) { + public InstructionGroup(Instruction parent, Display test, HColor backColor, HColor titleColor, + Swimlane swimlane, HColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) { this.list = new InstructionList(swimlane); this.type = type; this.linkRendering = linkRendering; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java index b19a94c39..c78b47392 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java @@ -50,10 +50,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionIf extends WithNote implements Instruction, InstructionCollection { @@ -84,7 +84,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC } public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, Display whenThen, - LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam, Url url) { + LinkRendering inlinkRendering, HColor color, ISkinParam skinParam, Url url) { this.url = url; this.parent = parent; this.skinParam = skinParam; @@ -142,7 +142,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC } public boolean elseIf(Display inlabel, Display test, Display whenThen, LinkRendering nextLinkRenderer, - HtmlColor color) { + HColor color) { if (elseBranch != null) { return false; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java index 40467e168..5ff0153ae 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java @@ -43,10 +43,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionRepeat implements Instruction { @@ -73,7 +73,7 @@ public class InstructionRepeat implements Instruction { return repeatList.containsBreak(); } - public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HtmlColor color, + public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HColor color, Display startLabel, BoxStyle boxStyleIn, Colors colors) { this.boxStyleIn = boxStyleIn; this.startLabel = startLabel; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java index 03a1fde31..3261fd0d6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java @@ -39,20 +39,20 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionSpot extends MonoSwimable implements Instruction { private boolean killed = false; private final LinkRendering inlinkRendering; private final String spot; - private final HtmlColor color; + private final HColor color; public boolean containsBreak() { return false; } - public InstructionSpot(String spot, HtmlColor color, LinkRendering inlinkRendering, Swimlane swimlane) { + public InstructionSpot(String spot, HColor color, LinkRendering inlinkRendering, Swimlane swimlane) { super(swimlane); this.spot = spot; this.inlinkRendering = inlinkRendering; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java index 63ca781e4..270dca865 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java @@ -46,7 +46,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionSwitch extends WithNote implements Instruction, InstructionCollection { @@ -72,7 +72,7 @@ public class InstructionSwitch extends WithNote implements Instruction, Instruct } public InstructionSwitch(Swimlane swimlane, Instruction parent, Display labelTest, LinkRendering inlinkRendering, - HtmlColor color, ISkinParam skinParam) { + HColor color, ISkinParam skinParam) { this.topInlinkRendering = inlinkRendering; this.parent = parent; this.skinParam = skinParam; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java index ca3ecb52f..9a8b27227 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java @@ -44,17 +44,17 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionWhile extends WithNote implements Instruction, InstructionCollection { private final InstructionList repeatList = new InstructionList(); private final Instruction parent; private final LinkRendering nextLinkRenderer; - private final HtmlColor color; + private final HColor color; private boolean killed = false; private final Display test; @@ -73,7 +73,7 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi } public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer, - Display yes, HtmlColor color, ISkinParam skinParam) { + Display yes, HColor color, ISkinParam skinParam) { if (test == null) { throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java index 6e822a853..f71501cf5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java @@ -43,8 +43,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCircleSpot3 extends SingleLineCommand2 { @@ -62,7 +62,7 @@ public class CommandCircleSpot3 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); diagram.addSpot(arg.get("SPOT", 0), color); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java index 236c045fa..680a3c749 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java @@ -45,8 +45,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandElseIf2 extends SingleLineCommand2 { @@ -80,7 +80,7 @@ public class CommandElseIf2 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java index 933e562d7..e264ff25f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java @@ -48,8 +48,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandIf2 extends SingleLineCommand2 { @@ -79,7 +79,7 @@ public class CommandIf2 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java index b309b0935..c6719a4a5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java @@ -44,8 +44,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandIf4 extends SingleLineCommand2 { @@ -76,7 +76,7 @@ public class CommandIf4 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java index b4b99b2df..1a702ab9a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java @@ -43,8 +43,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandLink3 extends SingleLineCommand2 { @@ -63,7 +63,7 @@ public class CommandLink3 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); if (color != null) { diagram.setColorNextArrow(Rainbow.fromColor(color)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java index 77d479830..928d622ce 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java @@ -49,8 +49,6 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -59,6 +57,8 @@ import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class CommandPartition3 extends SingleLineCommand2 { @@ -129,20 +129,20 @@ public class CommandPartition3 extends SingleLineCommand2 { final String stereo = arg.get("STEREO", 0); final Stereotype stereotype = stereo == null ? null : new Stereotype(stereo); - final HtmlColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), + final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), stereotype, false); - HtmlColor backColor; + HColor backColor; if (backColorInSkinparam == null) { backColor = colors.getColor(ColorType.BACK); } else { backColor = backColorInSkinparam; } - HtmlColor titleColor = colors.getColor(ColorType.HEADER); + HColor titleColor = colors.getColor(ColorType.HEADER); // Warning : titleColor unused in FTileGroupW - HtmlColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false); + HColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false); if (borderColor == null) { - borderColor = HtmlColorUtils.BLACK; + borderColor = HColorUtils.BLACK; } double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype); @@ -155,7 +155,7 @@ public class CommandPartition3 extends SingleLineCommand2 { backColor = stylePartition.value(PName.BackGroundColor).asColor( diagram.getSkinParam().getIHtmlColorSet()); } - titleColor = HtmlColorUtils.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet()); + titleColor = HColorUtils.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet()); roundCorner = stylePartition.value(PName.RoundCorner).asDouble(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java index 929768ce3..2812bac5c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java @@ -48,10 +48,10 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandRepeat3 extends SingleLineCommand2 { @@ -77,7 +77,7 @@ public class CommandRepeat3 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); final BoxStyle boxStyle; final String styleString = arg.get("STYLE", 0); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java index 15b580bbc..a8044eac1 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java @@ -44,8 +44,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandSwimlane extends SingleLineCommand2 { @@ -65,7 +65,7 @@ public class CommandSwimlane extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String name = arg.get("SWIMLANE", 0); final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); return diagram.swimlane(name, color, label); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java index 5a1ba1462..30b783d66 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java @@ -45,8 +45,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandSwimlane2 extends SingleLineCommand2 { @@ -73,7 +73,7 @@ public class CommandSwimlane2 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String name = arg.get("SWIMLANE", 0); final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); return diagram.swimlane(name, color, label); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java index 5586b603e..84f199f9d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java @@ -44,8 +44,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandSwitch extends SingleLineCommand2 { @@ -67,7 +67,7 @@ public class CommandSwitch extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java index 38c4a80d6..324e3cc98 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java @@ -45,8 +45,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandWhile3 extends SingleLineCommand2 { @@ -73,7 +73,7 @@ public class CommandWhile3 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); diagram.doWhile(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("YES", 0)), color); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java index 0977926b7..69cadd9fb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java @@ -45,11 +45,11 @@ import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public abstract class AbstractFtile extends AbstractTextBlock implements Ftile { @@ -66,7 +66,7 @@ public abstract class AbstractFtile extends AbstractTextBlock implements Ftile { return skinParam; } - final public IHtmlColorSet getIHtmlColorSet() { + final public HColorSet getIHtmlColorSet() { return skinParam.getIHtmlColorSet(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java index 4bddf93a3..ae4646549 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java @@ -50,7 +50,7 @@ public enum BoxStyle { PLAIN { @Override protected Shadowable getShape(double width, double height, double roundCorner) { - return new URectangle(width, height, roundCorner, roundCorner); + return new URectangle(width, height).rounded(roundCorner); } }, SDL_INPUT('<') { @@ -83,9 +83,9 @@ public enum BoxStyle { final URectangle rect = new URectangle(width, height); rect.setDeltaShadow(shadowing); ug.draw(rect); - final ULine vline = new ULine(0, height); - ug.apply(new UTranslate(PADDING, 0)).draw(vline); - ug.apply(new UTranslate(width - PADDING, 0)).draw(vline); + final ULine vline = ULine.vline(height); + ug.apply(UTranslate.dx(PADDING)).draw(vline); + ug.apply(UTranslate.dx(width - PADDING)).draw(vline); } }, SDL_SAVE('\\') { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java index 32a5c29e7..e0b1923f3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java @@ -40,10 +40,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -57,6 +54,9 @@ import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class CollisionDetector implements UGraphic { @@ -88,7 +88,7 @@ public class CollisionDetector implements UGraphic { minmax.drawGrey(ug); } } - final HtmlColor color = HtmlColorUtils.BLACK; + final HColor color = HColorUtils.BLACK; ug = ug.apply(new UChangeColor(color)).apply(new UStroke(5)); for (Snake snake : snakes) { for (Line2D line : snake.getHorizontalLines()) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java index 28e07855b..59e0a826c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java @@ -42,11 +42,11 @@ import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageLegend { @@ -55,8 +55,8 @@ public class EntityImageLegend { final TextBlock textBlock = note.create(new FontConfiguration(skinParam, FontParam.LEGEND, null), HorizontalAlignment.LEFT, skinParam); final Rose rose = new Rose(); - final HtmlColor legendBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.legendBackground); - final HtmlColor legendColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder); + final HColor legendBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.legendBackground); + final HColor legendColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder); final UStroke stroke = skinParam.getThickness(LineParam.legendBorder, null); final int cornersize = 10; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java index cbb78ae95..5af01bed8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java @@ -133,7 +133,7 @@ public class FtileAssemblySimple extends AbstractTextBlock implements Ftile { private UTranslate getTranslated1(StringBounder stringBounder) { final double left = calculateDimension(stringBounder).getLeft(); - return new UTranslate(left - tile1.calculateDimension(stringBounder).getLeft(), 0); + return UTranslate.dx(left - tile1.calculateDimension(stringBounder).getLeft()); } private UTranslate getTranslated2(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java index 3ad653946..77c927698 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java @@ -46,10 +46,10 @@ import net.sourceforge.plantuml.activitydiagram3.Instruction; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.PositionedNote; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface FtileFactory { @@ -63,7 +63,7 @@ public interface FtileFactory { public Ftile end(Swimlane swimlane); - public Ftile spot(Swimlane swimlane, String spot, HtmlColor color); + public Ftile spot(Swimlane swimlane, String spot, HColor color); public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors); @@ -82,7 +82,7 @@ public interface FtileFactory { Ftile backward, boolean noOut); public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut); + LinkRendering afterEndwhile, HColor color, Instruction specialOut); public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, LinkRendering topInlinkRendering, Url url); @@ -92,7 +92,7 @@ public interface FtileFactory { public Ftile createParallel(List all, ForkStyle style, String label, Swimlane in, Swimlane out); - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner); + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java index fce49ae03..927b5e9ca 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -61,6 +60,7 @@ import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegator implements FtileFactory { @@ -145,7 +145,7 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.stop(swimlane); } - public Ftile spot(Swimlane swimlane, String spot, HtmlColor color) { + public Ftile spot(Swimlane swimlane, String spot, HColor color) { return factory.spot(swimlane, spot, color); } @@ -187,7 +187,7 @@ public class FtileFactoryDelegator implements FtileFactory { } public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { + LinkRendering afterEndwhile, HColor color, Instruction specialOut) { return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color, specialOut); } @@ -205,8 +205,8 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.createParallel(all, style, label, in, out); } - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner) { + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner) { return factory.createGroup(list, name, backColor, titleColor, note, borderColor, type, roundCorner); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java index d5ee3b610..48034d41b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java @@ -86,7 +86,7 @@ public class FtileHeightFixed extends AbstractFtile { if (dim.getHeight() > fixedHeight) { throw new IllegalStateException(); } - return new UTranslate(0, (fixedHeight - dim.getHeight()) / 2); + return UTranslate.dy((fixedHeight - dim.getHeight()) / 2); } public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java index 304cf07a3..e73d0687e 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java @@ -102,7 +102,7 @@ public class FtileMarged extends AbstractFtile { } private UTranslate getTranslate() { - return new UTranslate(margin1, 0); + return UTranslate.dx(margin1); } public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java index 4a5651b4b..9c10f91b9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java @@ -53,7 +53,7 @@ public class FtileMargedVertically extends FtileDecorate { public void drawU(UGraphic ug) { if (margin1 > 0) { - ug = ug.apply(new UTranslate(0, margin1)); + ug = ug.apply(UTranslate.dy(margin1)); } ug.draw(getFtileDelegated()); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java index fac071ab8..dec42bb76 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java @@ -87,7 +87,7 @@ public class FtileMinWidth extends FtileDecorate { private UTranslate getUTranslateInternal(final StringBounder stringBounder) { final Dimension2D dimTile = getFtileDelegated().calculateDimension(stringBounder); final Dimension2D dimTotal = getDimensionInternal(stringBounder); - final UTranslate change = new UTranslate((dimTotal.getWidth() - dimTile.getWidth()) / 2, 0); + final UTranslate change = UTranslate.dx((dimTotal.getWidth() - dimTile.getWidth()) / 2); return change; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java index 23f2d56a0..bc6079179 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java @@ -68,8 +68,8 @@ public class Snake implements UShape { private Direction emphasizeDirection; private final HorizontalAlignment horizontalAlignment; - public final void setIgnoreForCompression(boolean ignoreForCompression) { - this.worm.setIgnoreForCompression(ignoreForCompression); + public final void setIgnoreForCompression() { + this.worm.setIgnoreForCompression(); } public Snake transformX(CompressionTransform compressionTransform) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java index cb3aa282e..ab0e6297c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java @@ -38,11 +38,11 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Swimlane implements SpecificBackcolorable { @@ -88,7 +88,7 @@ public class Swimlane implements SpecificBackcolorable { return colors; } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) { if (color != null) { this.colors = colors.add(type, color); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java index 9dc8909eb..710362303 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java @@ -57,7 +57,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicIntercep import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.VCompactFactory; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -77,6 +76,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.comp.SlotSet; import net.sourceforge.plantuml.utils.MathUtils; @@ -126,7 +126,7 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleabl return factory; } - public void swimlane(String name, HtmlColor color, Display label) { + public void swimlane(String name, HColor color, Display label) { currentSwimlane = getOrCreate(name); if (color != null) { currentSwimlane.setSpecificColorTOBEREMOVED(ColorType.BACK, color); @@ -203,7 +203,7 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleabl drawWhenSwimlanes(ug, full); } - static private void printDebug(UGraphic ug, SlotSet slot, HtmlColor col, TextBlock full) { + static private void printDebug(UGraphic ug, SlotSet slot, HColor col, TextBlock full) { slot.drawDebugX(ug.apply(new UChangeColor(col)).apply(new UChangeBackColor(col)), full.calculateDimension(ug.getStringBounder()).getHeight()); @@ -218,13 +218,12 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleabl double x2 = 0; for (Swimlane swimlane : swimlanes) { - final HtmlColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK); + final HColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK); if (back != null) { final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back)) - .apply(new UTranslate(x2, 0)); + .apply(UTranslate.dx(x2)); final URectangle rectangle = new URectangle(swimlane.getActualWidth(), dimensionFull.getHeight() - + titleHeightTranslate.getDy()); - rectangle.setIgnoreForCompression(true); + + titleHeightTranslate.getDy()).ignoreForCompression(); background.draw(rectangle); } @@ -270,8 +269,8 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleabl for (Swimlane swimlane : swimlanes) { final double swimlaneActualWidth = swimlaneActualWidth(ug.getStringBounder(), swimlaneWidth, swimlane); - final UTranslate translate = new UTranslate(x1 - swimlane.getMinMax().getMinX() + separationMargin - + (swimlaneActualWidth - rawDrawingWidth(swimlane)) / 2.0, 0); + final UTranslate translate = UTranslate.dx(x1 - swimlane.getMinMax().getMinX() + separationMargin + + (swimlaneActualWidth - rawDrawingWidth(swimlane)) / 2.0); swimlane.setTranslateAndWidth(translate, swimlaneActualWidth); x1 += swimlaneActualWidth; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java index 2a33556e8..d973307b3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.style.PName; @@ -52,6 +51,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class SwimlanesB extends SwimlanesA { @@ -67,21 +67,20 @@ public class SwimlanesB extends SwimlanesA { final StringBounder stringBounder = ug.getStringBounder(); - HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false); + HColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false); if (SkinParam.USE_STYLES()) { color = getStyle().value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); } if (color != null) { final double titleHeight = getTitlesHeight(stringBounder); - final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight); - back.setIgnoreForCompression(true); + final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight).ignoreForCompression(); ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back); } for (Swimlane swimlane : swimlanes) { final TextBlock swTitle = getTitle(swimlane); final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth(); final double posTitle = x2 + (swimlane.getActualWidth() - titleWidth) / 2; - swTitle.drawU(ug.apply(new UTranslate(posTitle, 0))); + swTitle.drawU(ug.apply(UTranslate.dx(posTitle))); x2 += swimlane.getActualWidth(); } } @@ -132,7 +131,7 @@ public class SwimlanesB extends SwimlanesA { @Override protected UTranslate getTitleHeightTranslate(final StringBounder stringBounder) { double titlesHeight = getTitlesHeight(stringBounder); - return new UTranslate(0, titlesHeight > 0 ? titlesHeight + 5 : 0); + return UTranslate.dy(titlesHeight > 0 ? titlesHeight + 5 : 0); } private double getTitlesHeight(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java index b84c49cf8..679519bad 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.rose.Rose; @@ -52,6 +51,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SwimlanesC extends SwimlanesB { @@ -70,17 +70,17 @@ public class SwimlanesC extends SwimlanesB { final UTranslate titleHeightTranslate = getTitleHeightTranslate(stringBounder); for (Swimlane swimlane : swimlanes) { - drawSeparation(ug.apply(new UTranslate(x2, 0)), dimensionFull.getHeight() + titleHeightTranslate.getDy()); + drawSeparation(ug.apply(UTranslate.dx(x2)), dimensionFull.getHeight() + titleHeightTranslate.getDy()); x2 += swimlane.getActualWidth(); } - drawSeparation(ug.apply(new UTranslate(x2, 0)), dimensionFull.getHeight() + titleHeightTranslate.getDy()); + drawSeparation(ug.apply(UTranslate.dx(x2)), dimensionFull.getHeight() + titleHeightTranslate.getDy()); } private void drawSeparation(UGraphic ug, double height) { - HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneBorder, null, false); + HColor color = skinParam.getHtmlColor(ColorParam.swimlaneBorder, null, false); if (color == null) { color = ColorParam.swimlaneBorder.getDefaultValue(); } @@ -89,7 +89,7 @@ public class SwimlanesC extends SwimlanesB { color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); thickness = getStyle().getStroke(); } - ug.apply(thickness).apply(new UChangeColor(color)).draw(new ULine(0, height)); + ug.apply(thickness).apply(new UChangeColor(color)).draw(ULine.vline(height)); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java index 670600614..14051bb81 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java @@ -38,7 +38,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.awt.geom.Point2D; import java.util.Map; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UGraphicDelegator; import net.sourceforge.plantuml.svek.UGraphicForSnake; @@ -50,6 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator { @@ -89,8 +89,8 @@ public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator { private void drawGoto(FtileGoto ftile) { final FtileGeometry geom = ftile.calculateDimension(getStringBounder()); final Point2D pt = geom.getPointIn(); - UGraphic ugGoto = getUg().apply(new UChangeColor(HtmlColorUtils.GREEN)).apply( - new UChangeBackColor(HtmlColorUtils.GREEN)); + UGraphic ugGoto = getUg().apply(new UChangeColor(HColorUtils.GREEN)).apply( + new UChangeBackColor(HColorUtils.GREEN)); ugGoto = ugGoto.apply(new UTranslate(pt)); final UTranslate posNow = getPosition(); final UTranslate dest = positions.get(ftile.getName()); @@ -98,8 +98,8 @@ public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator { final double dy = dest.getDy() - posNow.getDy(); ugGoto.draw(new UEllipse(3, 3)); ugGoto.apply(new UTranslate(dx, dy)).draw(new UEllipse(3, 3)); - ugGoto.draw(new ULine(dx, 0)); - ugGoto.apply(new UTranslate(dx, 0)).draw(new ULine(0, dy)); + ugGoto.draw(ULine.hline(dx)); + ugGoto.apply(UTranslate.dx(dx)).draw(ULine.vline(dy)); // ugGoto.draw(new ULine(dx, dy)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java index 911fd434b..76a6a6fbd 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java @@ -45,7 +45,6 @@ import java.util.List; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.cucadiagram.LinkStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.comp.CompressionMode; public class Worm implements Iterable { @@ -67,13 +67,13 @@ public class Worm implements Iterable { private boolean ignoreForCompression; - public final void setIgnoreForCompression(boolean ignoreForCompression) { - this.ignoreForCompression = ignoreForCompression; + public final void setIgnoreForCompression() { + this.ignoreForCompression = true; } public void drawInternalOneColor(UPolygon startDecoration, UGraphic ug, HtmlColorAndStyle color, double stroke, Direction emphasizeDirection, UPolygon endDecoration) { - final HtmlColor color2 = color.getColor(); + final HColor color2 = color.getColor(); if (color2 == null) { throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java index d5891d158..0bd0cf827 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java @@ -135,19 +135,19 @@ public class WormMutation { private static UTranslate translation(int type, double delta) { switch (type) { case 1: - return new UTranslate(0, -delta); + return UTranslate.dy(-delta); case 2: return new UTranslate(delta, -delta); case 3: - return new UTranslate(delta, 0); + return UTranslate.dx(delta); case 4: return new UTranslate(delta, delta); case 5: - return new UTranslate(0, delta); + return UTranslate.dy(delta); case 6: return new UTranslate(-delta, delta); case 7: - return new UTranslate(-delta, 0); + return UTranslate.dx(-delta); case 8: return new UTranslate(-delta, -delta); } @@ -182,7 +182,7 @@ public class WormMutation { for (UTranslate tr : translations) { result.append(tr.getDx()); } - return new UTranslate(result.getExtreme() * (size - 1), 0); + return UTranslate.dx(result.getExtreme() * (size - 1)); } public boolean isDxNegative() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java index 97af63ff0..c6eb486c1 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java @@ -38,11 +38,11 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Zad { @@ -55,7 +55,7 @@ public class Zad { } public void drawDebug(UGraphic ug) { - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.BLUE)).apply(new UChangeColor(HtmlColorUtils.RED_LIGHT)); + ug = ug.apply(new UChangeBackColor(HColorUtils.BLUE)).apply(new UChangeColor(HColorUtils.RED_LIGHT)); for (MinMax minMax : rectangles) { System.err.println("minmax=" + minMax); minMax.drawGrey(ug); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java index 2bc8e2828..e744042da 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java @@ -37,7 +37,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class ZadBuilder implements UGraphic { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java index 0670a2b58..3da553f1f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java @@ -51,13 +51,13 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FloatingNote extends AbstractTextBlock implements Stencil, TextBlock { @@ -67,8 +67,8 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + final HColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + final HColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java index 883f449d7..bed47c9e1 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java @@ -43,9 +43,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator { @@ -56,9 +56,9 @@ public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator { } @Override - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner) { - final HtmlColor arrowColor = rose.getHtmlColor(skinParam(), ColorParam.arrow); + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner) { + final HColor arrowColor = rose.getHtmlColor(skinParam(), ColorParam.arrow); Ftile result = new FtileGroup(list, name, null, arrowColor, backColor, titleColor, skinParam(), borderColor, type, roundCorner); if (note != null) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java index af97283dd..57b2763fd 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java @@ -50,12 +50,12 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { @@ -74,8 +74,8 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle(); final Branch branch0 = thens.get(0); - final HtmlColor borderColor; - final HtmlColor backColor; + final HColor borderColor; + final HColor backColor; final Rainbow arrowColor; final FontConfiguration fcTest; final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND @@ -113,7 +113,7 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { conditionEndStyle, thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest, url); } - private HtmlColor fontColor(FontParam param) { + private HColor fontColor(FontParam param) { return skinParam().getFontHtmlColor(null, param); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java index 2086d28ea..702038be8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java @@ -57,7 +57,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -66,6 +65,7 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { @@ -80,8 +80,8 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { final ConditionStyle conditionStyle = skinParam().getConditionStyle(); - final HtmlColor borderColor; - final HtmlColor diamondColor; + final HColor borderColor; + final HColor diamondColor; final Rainbow arrowColor; final FontConfiguration fcDiamond; final FontConfiguration fcArrow; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java index 2897197c4..83ce01867 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java @@ -55,10 +55,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInsi import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator { @@ -113,8 +113,8 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator { } private Ftile getDiamond1(Swimlane swimlane, Branch branch0, Display test) { - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), + final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + final HColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) : branch0.getColor(); final FontConfiguration fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null); @@ -126,14 +126,14 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator { } private Ftile getDiamond2(Swimlane swimlane, Branch branch0) { - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), + final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + final HColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) : branch0.getColor(); return new FtileDiamondInside(branch0.skinParam(), backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0)); } - private HtmlColor fontColor(FontParam param) { + private HColor fontColor(FontParam param) { return skinParam().getFontHtmlColor(null, param); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java index dd2c6704d..f735197c1 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java @@ -56,13 +56,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { @@ -72,10 +72,10 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { @Override public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { + LinkRendering afterEndwhile, HColor color, Instruction specialOut) { - final HtmlColor borderColor; - final HtmlColor backColor; + final HColor borderColor; + final HColor backColor; final Rainbow arrowColor; final FontConfiguration fontArrow; final FontConfiguration fcTest; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java index da520dfea..b267c779a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java @@ -87,7 +87,7 @@ class FtileForkInner extends AbstractFtile { double xpos = 0; for (Ftile ftile : forks) { - ug.apply(new UTranslate(xpos, 0)).draw(ftile); + ug.apply(UTranslate.dx(xpos)).draw(ftile); final Dimension2D dim = ftile.calculateDimension(stringBounder); xpos += dim.getWidth(); } @@ -112,7 +112,7 @@ class FtileForkInner extends AbstractFtile { double xpos = 0; for (Ftile ftile : forks) { if (ftile == searched) { - return new UTranslate(xpos, 0); + return UTranslate.dx(xpos); } final Dimension2D dim = ftile.calculateDimension(stringBounder); xpos += dim.getWidth(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java index 065170005..5076cf749 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java @@ -87,7 +87,7 @@ class FtileForkInnerOverlapped extends AbstractFtile { final double xpos = 0; for (Ftile ftile : forks) { - ug.apply(new UTranslate(xpos, 0)).draw(ftile); + ug.apply(UTranslate.dx(xpos)).draw(ftile); // final Dimension2D dim = ftile.calculateDimension(stringBounder); // xpos += dim.getWidth(); } @@ -113,7 +113,7 @@ class FtileForkInnerOverlapped extends AbstractFtile { final double xpos = 0; for (Ftile ftile : forks) { if (ftile == searched) { - return new UTranslate(xpos, 0); + return UTranslate.dx(xpos); } // final Dimension2D dim = ftile.calculateDimension(stringBounder); // xpos += dim.getWidth(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index 978acf8e1..d21e36fa8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -53,8 +53,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -72,6 +70,8 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.utils.MathUtils; public class FtileGroup extends AbstractFtile { @@ -80,8 +80,8 @@ public class FtileGroup extends AbstractFtile { private final Ftile inner; private final TextBlock name; private final TextBlock headerNote; - private final HtmlColor borderColor; - private final HtmlColor backColor; + private final HColor borderColor; + private final HColor backColor; private final double shadowing; private final UStroke stroke; private final USymbol type; @@ -91,14 +91,14 @@ public class FtileGroup extends AbstractFtile { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition); } - public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor arrowColor, HtmlColor backColor, - HtmlColor titleColor, ISkinParam skinParam, HtmlColor borderColor, USymbol type, double roundCorner) { + public FtileGroup(Ftile inner, Display title, Display displayNote, HColor arrowColor, HColor backColor, + HColor titleColor, ISkinParam skinParam, HColor borderColor, USymbol type, double roundCorner) { super(inner.skinParam()); this.roundCorner = roundCorner; this.type = type; - this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor; + this.backColor = backColor == null ? HColorUtils.WHITE : backColor; this.inner = FtileUtils.addHorizontalMargin(inner, 10); - this.borderColor = borderColor == null ? HtmlColorUtils.BLACK : borderColor; + this.borderColor = borderColor == null ? HColorUtils.BLACK : borderColor; final FontConfiguration fc; if (SkinParam.USE_STYLES()) { @@ -107,7 +107,7 @@ public class FtileGroup extends AbstractFtile { this.shadowing = style.value(PName.Shadowing).asDouble(); } else { final UFont font = skinParam.getFont(null, false, FontParam.PARTITION); - final HtmlColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); + final HColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); this.shadowing = skinParam().shadowing(null) ? 3 : 0; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java index 6a1e91e40..02eda2028 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java @@ -68,13 +68,13 @@ import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileIfAndStop extends AbstractFtile { @@ -111,7 +111,7 @@ class FtileIfAndStop extends AbstractFtile { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch nonStop, ISkinParam skinParam, StringBounder stringBounder, Display labelTest) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index fd68b59c3..b2da362f2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -67,13 +67,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInsi import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileIfLongHorizontal extends AbstractFtile { @@ -141,7 +141,7 @@ class FtileIfLongHorizontal extends AbstractFtile { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, Branch branch2, FontConfiguration fcArrow, LinkRendering topInlinkRendering, LinkRendering afterEndwhile, FontConfiguration fcTest) { @@ -164,7 +164,7 @@ class FtileIfLongHorizontal extends AbstractFtile { final TextBlock tbTest = branch.getLabelTest().create(fcTest, ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam()); - final HtmlColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); + final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor, swimlane, tbTest); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java index b52e05952..b001bd70d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java @@ -63,13 +63,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside3; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileIfLongVertical extends AbstractFtile { @@ -127,7 +127,7 @@ class FtileIfLongVertical extends AbstractFtile { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, Branch branch2, FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) { final List tiles = new ArrayList(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java index d8e2d5c11..0efb9abed 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java @@ -58,7 +58,6 @@ import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.rose.Rose; @@ -70,6 +69,7 @@ import net.sourceforge.plantuml.style.Styleable; import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable { @@ -107,8 +107,8 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable this.withOutPoint = withOutPoint; final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor; - final HtmlColor borderColor; + final HColor noteBackgroundColor; + final HColor borderColor; final double shadowing; if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java index 3fe4b96fd..dbc07e722 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java @@ -66,7 +66,6 @@ import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -75,6 +74,7 @@ import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileRepeat extends AbstractFtile { @@ -111,8 +111,8 @@ class FtileRepeat extends AbstractFtile { } public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Swimlane swimlaneOut, - Ftile entry, Ftile repeat, Display test, Display yes, Display out, HtmlColor borderColor, - HtmlColor diamondColor, Rainbow arrowColor, Rainbow endRepeatLinkColor, ConditionStyle conditionStyle, + Ftile entry, Ftile repeat, Display test, Display yes, Display out, HColor borderColor, + HColor diamondColor, Rainbow arrowColor, Rainbow endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer, FontConfiguration fcDiamond, FontConfiguration fcArrow, Ftile backward, boolean noOut) { @@ -579,7 +579,7 @@ class FtileRepeat extends AbstractFtile { private UTranslate getTranslateDiamond1(StringBounder stringBounder) { final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); final double left = getLeft(stringBounder); - return new UTranslate(left - dimDiamond1.getWidth() / 2, 0); + return UTranslate.dx(left - dimDiamond1.getWidth() / 2); } private UTranslate getTranslateBackward(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java index e32ad35b4..bfede99f6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java @@ -111,7 +111,7 @@ class FtileSplit1 extends AbstractFtile { public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) { final Dimension2D dim = searched.calculateDimension(stringBounder); final double xpos = calculateDimension(stringBounder).getWidth() - dim.getWidth(); - return new UTranslate(xpos / 2, 0); + return UTranslate.dx(xpos / 2); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java index b20a5d439..14802f4fa 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java @@ -56,13 +56,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInsi import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileSwitch extends AbstractFtile { @@ -95,7 +95,7 @@ class FtileSwitch extends AbstractFtile { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, FontConfiguration fcArrow, LinkRendering topInlinkRendering, LinkRendering afterEndwhile, FontConfiguration fcTest) { if (afterEndwhile == null) { @@ -114,7 +114,7 @@ class FtileSwitch extends AbstractFtile { final TextBlock tbTest = branch.getLabelTest().create(fcTest, ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam()); - final HtmlColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); + final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor, swimlane, tbTest); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 1cf69898a..38da22c79 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -66,7 +66,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInsi import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -77,6 +76,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileWhile extends AbstractFtile { @@ -113,8 +113,8 @@ class FtileWhile extends AbstractFtile { this.specialOut = specialOut; } - public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HtmlColor borderColor, - HtmlColor backColor, Rainbow arrowColor, Display yes, Display out2, Rainbow endInlinkColor, + public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HColor borderColor, + HColor backColor, Rainbow arrowColor, Display yes, Display out2, Rainbow endInlinkColor, LinkRendering afterEndwhile, FontConfiguration fontArrow, FtileFactory ftileFactory, ConditionStyle conditionStyle, FontConfiguration fcTest, Instruction specialOut) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java index c68cfff91..7a4b0a9ca 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java @@ -62,7 +62,6 @@ import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.sequencediagram.NotePosition; @@ -77,6 +76,7 @@ import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Styleable { @@ -138,8 +138,8 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor; - final HtmlColor borderColor; + final HColor noteBackgroundColor; + final HColor borderColor; final FontConfiguration fc; final double shadowing; @@ -189,7 +189,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea final double yForNote = (dimTotal.getHeight() - dimNote.getHeight()) / 2; if (notePosition == NotePosition.LEFT) { - return new UTranslate(0, yForNote); + return UTranslate.dy(yForNote); } final double dx = dimTotal.getWidth() - dimNote.getWidth(); return new UTranslate(dx, yForNote); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java index b8d499d41..ef52afe82 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java @@ -58,7 +58,6 @@ import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -72,6 +71,7 @@ import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class FtileWithNotes extends AbstractFtile { @@ -110,8 +110,8 @@ public class FtileWithNotes extends AbstractFtile { if (note.getColors() != null) { skinParam2 = note.getColors().mute(skinParam2); } - final HtmlColor noteBackgroundColor; - final HtmlColor borderColor; + final HColor noteBackgroundColor; + final HColor borderColor; final FontConfiguration fc; final double shadowing; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java index f936c139a..c8060dc6b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java @@ -123,7 +123,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { final List conns = new ArrayList(); double x = 0; for (Ftile tmp : getList()) { - final UTranslate translate0 = new UTranslate(0, barHeight); + final UTranslate translate0 = UTranslate.dy(barHeight); final Dimension2D dim = tmp.calculateDimension(getStringBounder()); final Rainbow def; if (SkinParam.USE_STYLES()) { @@ -154,7 +154,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { @@ -166,7 +166,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); @@ -182,7 +182,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { snake.addPoint(mp1a.getX(), middle); snake.addPoint(mp2b.getX(), middle); snake.addPoint(mp2b); - snake.setIgnoreForCompression(true); + snake.setIgnoreForCompression(); ug.draw(snake); } } @@ -206,7 +206,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); if (geo.hasPointOut() == false) { return; @@ -223,7 +223,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); if (geo.hasPointOut() == false) { return; @@ -242,7 +242,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { snake.addPoint(mp1a.getX(), middle); snake.addPoint(mp2b.getX(), middle); snake.addPoint(mp2b); - snake.setIgnoreForCompression(true); + snake.setIgnoreForCompression(); ug.draw(snake); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java index c908b5359..e76311e94 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java @@ -55,13 +55,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { @@ -73,7 +73,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { protected Ftile doStep1() { Ftile result = getMiddle(); final List conns = new ArrayList(); - final HtmlColor colorBar = getRose().getHtmlColor(skinParam(), ColorParam.activityBar); + final HColor colorBar = getRose().getHtmlColor(skinParam(), ColorParam.activityBar); final Ftile black = new FtileBlackBlock(skinParam(), colorBar, getList().get(0).getSwimlaneIn()); double x = 0; @@ -100,8 +100,8 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { @Override protected Ftile doStep2(Ftile result) { - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground); + final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + final HColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground); final Ftile out = new FtileDiamond(skinParam(), backColor, borderColor, swimlaneOutForStep2()); result = new FtileAssemblySimple(result, out); final List conns = new ArrayList(); @@ -198,7 +198,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { @@ -210,7 +210,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java index ae15edbde..d56e794b0 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java @@ -55,7 +55,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileThinSplit; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.SName; @@ -63,6 +62,7 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { @@ -123,7 +123,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { return new FtileAssemblySimple(thin, result); } - private HtmlColor getThin1Color(final Rainbow thinColor) { + private HColor getThin1Color(final Rainbow thinColor) { for (Ftile tmp : getList()) { final Rainbow rainbow; final LinkRendering inLinkRendering = tmp.getInLinkRendering(); @@ -174,7 +174,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { double first = 0; double last = 0; for (Ftile tmp : getList()) { - final UTranslate translate0 = new UTranslate(0, 1.5); + final UTranslate translate0 = UTranslate.dy(1.5); final FtileGeometry dim = tmp.calculateDimension(getStringBounder()); if (dim.hasPointOut()) { if (first == 0) { @@ -220,7 +220,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { @@ -232,7 +232,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); @@ -271,7 +271,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); if (geo.hasPointOut() == false) { return; @@ -288,7 +288,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); if (geo.hasPointOut() == false) { return; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java index 68c23a9bd..be2c75358 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java @@ -40,7 +40,6 @@ import java.util.Set; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UGraphicDelegator; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -48,6 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator { @@ -88,8 +88,8 @@ public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator { } private void drawGoto() { - final UGraphic ugGoto = getUg().apply(new UChangeColor(HtmlColorUtils.GREEN)).apply( - new UChangeBackColor(HtmlColorUtils.GREEN)); + final UGraphic ugGoto = getUg().apply(new UChangeColor(HColorUtils.GREEN)).apply( + new UChangeBackColor(HColorUtils.GREEN)); ugGoto.draw(new ULine(100, 100)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index 3dedf46a4..212b963fd 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -62,7 +62,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStop; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateIn; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOut; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; @@ -73,6 +72,7 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class VCompactFactory implements FtileFactory { @@ -98,7 +98,7 @@ public class VCompactFactory implements FtileFactory { } public Ftile start(Swimlane swimlane) { - final HtmlColor color; + final HColor color; Style style = null; if (SkinParam.USE_STYLES()) { style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); @@ -110,7 +110,7 @@ public class VCompactFactory implements FtileFactory { } public Ftile stop(Swimlane swimlane) { - final HtmlColor color; + final HColor color; Style style = null; if (SkinParam.USE_STYLES()) { style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); @@ -121,7 +121,7 @@ public class VCompactFactory implements FtileFactory { return new FtileCircleStop(skinParam(), color, swimlane, style); } - public Ftile spot(Swimlane swimlane, String spot, HtmlColor color) { + public Ftile spot(Swimlane swimlane, String spot, HColor color) { // final HtmlColor color = rose.getHtmlColor(skinParam, // ColorParam.activityBackground); final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); @@ -129,7 +129,7 @@ public class VCompactFactory implements FtileFactory { } public Ftile end(Swimlane swimlane) { - final HtmlColor color; + final HColor color; Style style = null; if (SkinParam.USE_STYLES()) { style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); @@ -169,7 +169,7 @@ public class VCompactFactory implements FtileFactory { } public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { + LinkRendering afterEndwhile, HColor color, Instruction specialOut) { return whileBlock; } @@ -196,8 +196,8 @@ public class VCompactFactory implements FtileFactory { return new FtileForkInner(all); } - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner) { + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner) { return list; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java index 67f5ca270..01d80f3bc 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java @@ -61,7 +61,6 @@ import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -71,12 +70,13 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ConditionalBuilder { private final Swimlane swimlane; - private final HtmlColor borderColor; - private final HtmlColor backColor; + private final HColor borderColor; + private final HColor backColor; private final Rainbow arrowColor; private final FtileFactory ftileFactory; private final ConditionStyle conditionStyle; @@ -100,7 +100,7 @@ public class ConditionalBuilder { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); } - public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + public ConditionalBuilder(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest, Url url) { @@ -137,7 +137,7 @@ public class ConditionalBuilder { } - static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static public Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest, Url url) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java index 1e60d7d47..8b277349b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java @@ -116,14 +116,14 @@ public class FtileIfWithDiamonds extends FtileIfNude { protected UTranslate getTranslate1(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); return super.getTranslate1(stringBounder).compose( - new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder))); + UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder))); } @Override protected UTranslate getTranslate2(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); return super.getTranslate2(stringBounder).compose( - new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder))); + UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder))); } protected UTranslate getTranslateDiamond1(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java index 347ad7615..e18c640df 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java @@ -100,7 +100,7 @@ public class FtileSwitchNude extends FtileDimensionMemoize { for (Ftile candidate : tiles) { final FtileGeometry dim1 = candidate.calculateDimension(stringBounder); if (candidate == tile) { - return new UTranslate(x1, 0); + return UTranslate.dx(x1); } x1 += dim1.getWidth() + xSeparation; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java index f69ffd62a..c12357381 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java @@ -155,14 +155,14 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude { final double suppx = (w13 - w9) / (tiles.size() - 1); for (int i = 0; i < tiles.size() - 1; i++) { if (tile == tiles.get(i)) { - return main.compose(new UTranslate(dx, 0)); + return main.compose(UTranslate.dx(dx)); } dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx; } if (tile == tiles.get(tiles.size() - 1)) { final double dx9 = tiles.get(0).calculateDimension(stringBounder).getWidth() + w13 + SUPP15 + SUPP15; - return main.compose(new UTranslate(dx9, 0)); + return main.compose(UTranslate.dx(dx9)); } throw new IllegalArgumentException(); @@ -173,7 +173,7 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude { protected UTranslate getTranslateMain(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final double dy1 = dimDiamond1.getHeight() + getYdelta1a(stringBounder); - return new UTranslate(0, dy1); + return UTranslate.dy(dy1); } protected UTranslate getTranslateDiamond1(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java index c9a65d431..f925a61b7 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -52,6 +51,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileBlackBlock extends AbstractFtile { @@ -60,10 +60,10 @@ public class FtileBlackBlock extends AbstractFtile { private double width; private double height; private TextBlock label = TextBlockUtils.empty(0, 0); - private final HtmlColor colorBar; + private final HColor colorBar; private final Swimlane swimlane; - public FtileBlackBlock(ISkinParam skinParam, HtmlColor colorBar, Swimlane swimlane) { + public FtileBlackBlock(ISkinParam skinParam, HColor colorBar, Swimlane swimlane) { super(skinParam); this.colorBar = colorBar; this.swimlane = swimlane; @@ -91,8 +91,7 @@ public class FtileBlackBlock extends AbstractFtile { } public void drawU(UGraphic ug) { - final URectangle rect = new URectangle(width, height, 5, 5); - rect.setIgnoreForCompression(true); + final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompression(); if (skinParam().shadowing(null)) { rect.setDeltaShadow(3); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java index 40080df27..3993ff281 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java @@ -63,7 +63,6 @@ import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -80,6 +79,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileBox extends AbstractFtile { @@ -98,8 +98,8 @@ public class FtileBox extends AbstractFtile { private final Swimlane swimlane; private final BoxStyle boxStyle; - private final HtmlColor borderColor; - private final HtmlColor backColor; + private final HColor borderColor; + private final HColor backColor; private final Style style; static public StyleSignature getDefaultStyleDefinitionActivity() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java index 6ea30151a..2ba8f2edb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java @@ -45,8 +45,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; @@ -57,12 +55,14 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FtileCircleEnd extends AbstractFtile { private static final int SIZE = 20; - private final HtmlColor backColor; + private final HColor backColor; private final Swimlane swimlane; private double shadowing; @@ -71,7 +71,7 @@ public class FtileCircleEnd extends AbstractFtile { return Collections.emptyList(); } - public FtileCircleEnd(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane, Style style) { + public FtileCircleEnd(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { super(skinParam); this.backColor = backColor; this.swimlane = swimlane; @@ -109,7 +109,7 @@ public class FtileCircleEnd extends AbstractFtile { circle.setDeltaShadow(shadowing); ug = ug.apply(new UChangeColor(backColor)); final double thickness = 2.5; - ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UStroke(1.5)) + ug.apply(new UChangeBackColor(HColorUtils.WHITE)).apply(new UStroke(1.5)) .apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle); final double size2 = (SIZE - thickness) / Math.sqrt(2); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java index 796c0dd50..e1613eeb6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -57,6 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileCircleSpot extends AbstractFtile { @@ -65,9 +65,9 @@ public class FtileCircleSpot extends AbstractFtile { private final Swimlane swimlane; private final String spot; private final FontConfiguration fc; - private final HtmlColor backColor; + private final HColor backColor; - public FtileCircleSpot(ISkinParam skinParam, Swimlane swimlane, String spot, UFont font, HtmlColor backColor) { + public FtileCircleSpot(ISkinParam skinParam, Swimlane swimlane, String spot, UFont font, HColor backColor) { super(skinParam); this.spot = spot; this.swimlane = swimlane; @@ -97,8 +97,8 @@ public class FtileCircleSpot extends AbstractFtile { public void drawU(UGraphic ug) { - final HtmlColor borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder); - final HtmlColor backColor = this.backColor == null ? SkinParamUtils.getColor(skinParam(), null, + final HColor borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder); + final HColor backColor = this.backColor == null ? SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground) : this.backColor; final UEllipse circle = new UEllipse(SIZE, SIZE); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java index a192adf47..87b2f59af 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; @@ -53,16 +52,17 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileCircleStart extends AbstractFtile { private static final int SIZE = 20; - private final HtmlColor backColor; + private final HColor backColor; private final Swimlane swimlane; private double shadowing; - public FtileCircleStart(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane, Style style) { + public FtileCircleStart(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { super(skinParam); this.backColor = backColor; this.swimlane = swimlane; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java index 12b1dedd3..c1110736b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java @@ -45,9 +45,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorMiddle; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; @@ -56,12 +53,15 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorMiddle; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FtileCircleStop extends AbstractFtile { private static final int SIZE = 22; - private final HtmlColor backColor; + private final HColor backColor; private final Swimlane swimlane; private double shadowing; @@ -70,7 +70,7 @@ public class FtileCircleStop extends AbstractFtile { return Collections.emptyList(); } - public FtileCircleStop(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane, Style style) { + public FtileCircleStop(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { super(skinParam); this.backColor = backColor; this.swimlane = swimlane; @@ -101,14 +101,14 @@ public class FtileCircleStop extends AbstractFtile { public void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); circle.setDeltaShadow(shadowing); - ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)).draw(circle); + ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(HColorUtils.WHITE)).draw(circle); final double delta = 5; final UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2); // if (skinParam().shadowing(null)) { // circleSmall.setDeltaShadow(3); // } - ug.apply(new UChangeColor(new HtmlColorMiddle(backColor, HtmlColorUtils.WHITE))) + ug.apply(new UChangeColor(new HColorMiddle(backColor, HColorUtils.WHITE))) .apply(new UChangeBackColor(backColor)).apply(new UTranslate(delta, delta)).draw(circleSmall); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java index 66f880166..e03362158 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -60,11 +59,12 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileDiamond extends AbstractFtile { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock north; private final TextBlock south; @@ -72,7 +72,7 @@ public class FtileDiamond extends AbstractFtile { private final TextBlock east1; private final double shadowing; - public FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) { + public FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane) { this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); } @@ -108,7 +108,7 @@ public class FtileDiamond extends AbstractFtile { return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1); } - private FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) { super(skinParam); if (SkinParam.USE_STYLES()) { @@ -145,7 +145,7 @@ public class FtileDiamond extends AbstractFtile { public void drawU(UGraphic ug) { final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight(); - ug = ug.apply(new UTranslate(0, suppY1)); + ug = ug.apply(UTranslate.dy(suppY1)); ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)) .draw(Diamond.asPolygon(shadowing)); // final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder()); @@ -161,7 +161,7 @@ public class FtileDiamond extends AbstractFtile { final Dimension2D dimEast1 = east1.calculateDimension(ug.getStringBounder()); east1.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 2, -dimEast1.getHeight() - + Diamond.diamondHalfSize))); + + Diamond.diamondHalfSize))); } @Override diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java index c3e200758..bae905836 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -53,18 +52,19 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileDiamondFoo1 extends AbstractFtile { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; private final TextBlock east; private final TextBlock north; - public FtileDiamondFoo1(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondFoo1(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -82,7 +82,7 @@ public class FtileDiamondFoo1 extends AbstractFtile { return new FtileDiamondFoo1(skinParam(), backColor, borderColor, swimlane, label, north, west, east); } - private FtileDiamondFoo1(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondFoo1(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock west, TextBlock east) { super(skinParam); this.backColor = backColor; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java index 14d6b47e6..de68a93cb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -61,11 +60,12 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileDiamondInside extends AbstractFtile implements Styleable { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; @@ -83,7 +83,7 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); } - public FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -109,7 +109,7 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable { return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } - private FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { super(skinParam); if (SkinParam.USE_STYLES()) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java index d32b92e79..b55b210a5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -58,11 +57,12 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileDiamondInside2 extends AbstractFtile { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; @@ -71,7 +71,7 @@ public class FtileDiamondInside2 extends AbstractFtile { private final TextBlock south; private final double shadowing; - public FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -97,7 +97,7 @@ public class FtileDiamondInside2 extends AbstractFtile { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); } - private FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { super(skinParam); if (SkinParam.USE_STYLES()) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java index 71848e5ba..49caf7230 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileOverpassing; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -54,12 +53,13 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassing { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; @@ -67,7 +67,7 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi private final TextBlock north; private final TextBlock south; - public FtileDiamondInside3(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -89,7 +89,7 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } - private FtileDiamondInside3(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { super(skinParam); this.backColor = backColor; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java index a32255939..3745f7451 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -50,6 +49,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileThinSplit extends AbstractFtile { @@ -57,10 +57,10 @@ public class FtileThinSplit extends AbstractFtile { private double first; private double last; private final double height = 1.5; - private final HtmlColor colorBar; + private final HColor colorBar; private final Swimlane swimlane; - public FtileThinSplit(ISkinParam skinParam, HtmlColor colorBar, Swimlane swimlane) { + public FtileThinSplit(ISkinParam skinParam, HColor colorBar, Swimlane swimlane) { super(skinParam); this.colorBar = colorBar; this.swimlane = swimlane; @@ -78,8 +78,8 @@ public class FtileThinSplit extends AbstractFtile { } public void drawU(UGraphic ug) { - final UShape rect = new ULine(last - first, 0); - ug = ug.apply(new UTranslate(first, 0)); + final UShape rect = ULine.hline(last - first); + ug = ug.apply(UTranslate.dx(first)); ug.apply(new UChangeColor(colorBar)).apply(new UStroke(1.5)).draw(rect); } diff --git a/src/net/sourceforge/plantuml/bpm/BpmElement.java b/src/net/sourceforge/plantuml/bpm/BpmElement.java index 5e293534f..0d35d9463 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmElement.java +++ b/src/net/sourceforge/plantuml/bpm/BpmElement.java @@ -47,8 +47,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -58,6 +56,8 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzzle { @@ -97,7 +97,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz public void drawU(UGraphic ug) { raw.drawU(ug); - ug = ug.apply(new UChangeColor(HtmlColorUtils.RED)); + ug = ug.apply(new UChangeColor(HColorUtils.RED)); for (Where w : Where.values()) { if (have(w)) { drawLine(ug, w, raw.calculateDimension(ug.getStringBounder())); @@ -123,26 +123,26 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz final double width = total.getWidth(); final double height = total.getHeight(); if (w == Where.WEST) { - ug.apply(new UTranslate(-10, height / 2)).draw(new ULine(10, 0)); + ug.apply(new UTranslate(-10, height / 2)).draw(ULine.hline(10)); } if (w == Where.EAST) { - ug.apply(new UTranslate(width, height / 2)).draw(new ULine(10, 0)); + ug.apply(new UTranslate(width, height / 2)).draw(ULine.hline(10)); } if (w == Where.NORTH) { - ug.apply(new UTranslate(width / 2, -10)).draw(new ULine(0, 10)); + ug.apply(new UTranslate(width / 2, -10)).draw(ULine.vline(10)); } if (w == Where.SOUTH) { - ug.apply(new UTranslate(width / 2, height)).draw(new ULine(0, 10)); + ug.apply(new UTranslate(width / 2, height)).draw(ULine.vline(10)); } } public TextBlock toTextBlockInternal(ISkinParam skinParam) { if (type == BpmElementType.START) { - return new FtileCircleStart(skinParam, HtmlColorUtils.BLACK, null, null); + return new FtileCircleStart(skinParam, HColorUtils.BLACK, null, null); } if (type == BpmElementType.MERGE) { - final HtmlColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder); - final HtmlColor backColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBackground); + final HColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder); + final HColor backColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBackground); return new FtileDiamond(skinParam, backColor, borderColor, null); } if (type == BpmElementType.DOCKED_EVENT) { @@ -150,7 +150,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz return FtileBox.create(skinParam, display, null, BoxStyle.PLAIN); } final UFont font = UFont.serif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.RED, HtmlColorUtils.RED, false); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.RED, HColorUtils.RED, false); if (Display.isNull(display)) { return Display.getWithNewlines(type.toString()).create(fc, HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java b/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java index 8d40b59d9..e360e0989 100644 --- a/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java +++ b/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java @@ -40,7 +40,6 @@ import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ConnectorPuzzleEmpty extends AbstractConnectorPuzzle implements Placeable, TextBlock, ConnectorPuzzle { @@ -89,7 +89,7 @@ public class ConnectorPuzzleEmpty extends AbstractConnectorPuzzle implements Pla public void drawU(UGraphic ug) { // System.err.println("DRAWING " + toString()); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)); + ug = ug.apply(new UChangeColor(HColorUtils.BLUE)); for (Where w : Where.values()) { if (have(w)) { drawLine(ug, w); @@ -100,16 +100,16 @@ public class ConnectorPuzzleEmpty extends AbstractConnectorPuzzle implements Pla private void drawLine(UGraphic ug, Where w) { if (w == Where.WEST) { - ug.apply(new UTranslate(0, 10)).draw(new ULine(10, 0)); + ug.apply(UTranslate.dy(10)).draw(ULine.hline(10)); } if (w == Where.EAST) { - ug.apply(new UTranslate(10, 10)).draw(new ULine(10, 0)); + ug.apply(new UTranslate(10, 10)).draw(ULine.hline(10)); } if (w == Where.NORTH) { - ug.apply(new UTranslate(10, 0)).draw(new ULine(0, 10)); + ug.apply(UTranslate.dx(10)).draw(ULine.vline(10)); } if (w == Where.SOUTH) { - ug.apply(new UTranslate(10, 10)).draw(new ULine(0, 10)); + ug.apply(new UTranslate(10, 10)).draw(ULine.vline(10)); } } diff --git a/src/net/sourceforge/plantuml/bpm/GridArray.java b/src/net/sourceforge/plantuml/bpm/GridArray.java index 64e931401..f3fb987e2 100644 --- a/src/net/sourceforge/plantuml/bpm/GridArray.java +++ b/src/net/sourceforge/plantuml/bpm/GridArray.java @@ -39,13 +39,13 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GridArray implements UDrawable { @@ -137,7 +137,7 @@ public class GridArray implements UDrawable { cell.toTextBlock(skinParam).drawU( ug.apply(new UTranslate(dx + (widthOfCol + margin - dim.getWidth()) / 2, dy - + (heightOfLine + margin - dim.getHeight()) / 2))); + + (heightOfLine + margin - dim.getHeight()) / 2))); } dx += widthOfCol + margin; } @@ -155,22 +155,22 @@ public class GridArray implements UDrawable { for (int c = 0; c < cols; c++) { widthMax += getWidthOfCol(ug.getStringBounder(), c) + margin; } - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); double y = 0; for (int l = 0; l < lines; l++) { - ug.apply(new UTranslate(0, y)).draw(new ULine(widthMax, 0)); + ug.apply(UTranslate.dy(y)).draw(ULine.hline(widthMax)); y += getHeightOfLine(ug.getStringBounder(), l) + margin; } double x = 0; for (int c = 0; c < cols; c++) { - ug.apply(new UTranslate(x, 0)).draw(new ULine(0, heightMax)); + ug.apply(UTranslate.dx(x)).draw(ULine.vline(heightMax)); x += getWidthOfCol(ug.getStringBounder(), c) + margin; } } private void drawArrow(UGraphic ug, Point2D pt1, Point2D pt2) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)); + ug = ug.apply(new UChangeColor(HColorUtils.BLUE)); final ULine line = new ULine(pt2.getX() - pt1.getX(), pt2.getY() - pt1.getY()); ug.apply(new UTranslate(pt1)).draw(line); } diff --git a/src/net/sourceforge/plantuml/braille/BrailleDrawer.java b/src/net/sourceforge/plantuml/braille/BrailleDrawer.java index 37672536e..c20b619e1 100644 --- a/src/net/sourceforge/plantuml/braille/BrailleDrawer.java +++ b/src/net/sourceforge/plantuml/braille/BrailleDrawer.java @@ -35,8 +35,6 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -44,6 +42,8 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class BrailleDrawer implements UDrawable { @@ -56,16 +56,16 @@ public class BrailleDrawer implements UDrawable { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(new HtmlColorSetSimple().getColorIfValid("#F0F0F0"))); + ug = ug.apply(new UChangeColor(HColorSet.instance().getColorIfValid("#F0F0F0"))); for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) { - ug.apply(new UTranslate(x * step + spotSize + 1, 0)).draw( - new ULine(0, (grid.getMaxY() - grid.getMinY()) * step)); + ug.apply(UTranslate.dx(x * step + spotSize + 1)).draw( + ULine.vline((grid.getMaxY() - grid.getMinY()) * step)); } for (int y = grid.getMinY(); y <= grid.getMaxY(); y++) { - ug.apply(new UTranslate(0, y * step + spotSize + 1)).draw( - new ULine((grid.getMaxX() - grid.getMinX()) * step, 0)); + ug.apply(UTranslate.dy(y * step + spotSize + 1)).draw( + ULine.hline((grid.getMaxX() - grid.getMinX()) * step)); } - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(HColorUtils.BLACK)); for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) { for (int y = grid.getMinY(); y <= grid.getMaxY(); y++) { if (grid.getState(x, y)) { diff --git a/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java b/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java index 08c6f62da..e83b04771 100644 --- a/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java +++ b/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java @@ -35,11 +35,11 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverCenteredCharacterBraille implements UDriver { diff --git a/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java b/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java index 53238cec7..6fcb3f8e8 100644 --- a/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java +++ b/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java @@ -36,10 +36,10 @@ package net.sourceforge.plantuml.braille; import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverDotPathBraille implements UDriver { diff --git a/src/net/sourceforge/plantuml/braille/DriverLineBraille.java b/src/net/sourceforge/plantuml/braille/DriverLineBraille.java index d136cfbca..002924241 100644 --- a/src/net/sourceforge/plantuml/braille/DriverLineBraille.java +++ b/src/net/sourceforge/plantuml/braille/DriverLineBraille.java @@ -37,12 +37,12 @@ package net.sourceforge.plantuml.braille; import java.awt.geom.Line2D; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverLineBraille implements UDriver { diff --git a/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java b/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java index 54f64c5df..6e132b68a 100644 --- a/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java +++ b/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java @@ -34,10 +34,10 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverNoneBraille implements UDriver { diff --git a/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java b/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java index d3f2802bd..fe9024712 100644 --- a/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java +++ b/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java @@ -39,13 +39,13 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverPolygonBraille implements UDriver { diff --git a/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java b/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java index 7b54d2bc5..37fa98977 100644 --- a/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java +++ b/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java @@ -37,12 +37,12 @@ package net.sourceforge.plantuml.braille; import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverRectangleBraille implements UDriver { diff --git a/src/net/sourceforge/plantuml/braille/DriverTextBraille.java b/src/net/sourceforge/plantuml/braille/DriverTextBraille.java index 8e7f775c2..e20f090c3 100644 --- a/src/net/sourceforge/plantuml/braille/DriverTextBraille.java +++ b/src/net/sourceforge/plantuml/braille/DriverTextBraille.java @@ -34,11 +34,11 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverTextBraille implements UDriver { diff --git a/src/net/sourceforge/plantuml/braille/UGraphicBraille.java b/src/net/sourceforge/plantuml/braille/UGraphicBraille.java index a8eb23eb6..d7d72db46 100644 --- a/src/net/sourceforge/plantuml/braille/UGraphicBraille.java +++ b/src/net/sourceforge/plantuml/braille/UGraphicBraille.java @@ -41,14 +41,11 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.TikzFontDistortion; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UEllipse; @@ -59,6 +56,9 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; // https://www.branah.com/braille-translator public class UGraphicBraille extends AbstractUGraphic implements ClipContainer, UGraphic2 { @@ -128,7 +128,7 @@ public class UGraphicBraille extends AbstractUGraphic implements Cl } public void writeImageTOBEMOVED(OutputStream os, String metadata, int dpi) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, metadata, null, 0, 0, null, false); imageBuilder.setUDrawable(new BrailleDrawer(getGraphicObject())); diff --git a/src/net/sourceforge/plantuml/classdiagram/FullLayout.java b/src/net/sourceforge/plantuml/classdiagram/FullLayout.java index f4428caa3..e05db0af4 100644 --- a/src/net/sourceforge/plantuml/classdiagram/FullLayout.java +++ b/src/net/sourceforge/plantuml/classdiagram/FullLayout.java @@ -53,7 +53,7 @@ public class FullLayout implements UDrawable { public void drawU(UGraphic ug) { double y = 0; for (RowLayout rawLayout : all) { - rawLayout.drawU(ug.apply(new UTranslate(0, y))); + rawLayout.drawU(ug.apply(UTranslate.dy(y))); y += rawLayout.getHeight(ug.getStringBounder()) + 20; } diff --git a/src/net/sourceforge/plantuml/classdiagram/RowLayout.java b/src/net/sourceforge/plantuml/classdiagram/RowLayout.java index 72239fe15..92e26d285 100644 --- a/src/net/sourceforge/plantuml/classdiagram/RowLayout.java +++ b/src/net/sourceforge/plantuml/classdiagram/RowLayout.java @@ -63,7 +63,7 @@ public class RowLayout implements UDrawable { public void drawU(UGraphic ug) { double x = 0; for (TextBlock leaf : all) { - leaf.drawU(ug.apply(new UTranslate(x, 0))); + leaf.drawU(ug.apply(UTranslate.dx(x))); x += leaf.calculateDimension(ug.getStringBounder()).getWidth() + 20; } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index 94cd9821a..8bd36ec23 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -58,10 +58,10 @@ import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateClass extends SingleLineCommand2 { @@ -174,7 +174,7 @@ public class CommandCreateClass extends SingleLineCommand2 { Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index b6da5b900..04285202f 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -64,11 +64,11 @@ import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateClassMultilines extends CommandMultilines2 { @@ -280,7 +280,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2 { @@ -145,7 +145,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0)); final Display display = diagram.manageVariable(lines.toDisplay()); final String backcolor0 = line0.get("COLOR", 0); - Colors colors = Colors.empty().add(ColorType.BACK, HtmlColorSet.getInstance().getColorIfValid(backcolor0)); + Colors colors = Colors.empty().add(ColorType.BACK, HColorSet.instance().getColorIfValid(backcolor0)); final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder()); final String stereotypeString = line0.get("STEREO", 0); if (stereotypeString != null) { diff --git a/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java b/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java index a5a5b0801..e929c4b8a 100644 --- a/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java +++ b/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java @@ -36,12 +36,12 @@ package net.sourceforge.plantuml.creole; import java.awt.geom.Dimension2D; -import java.util.Arrays; -import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.atom.AbstractAtom; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -92,7 +92,7 @@ public class CreoleHorizontalLine extends AbstractAtom implements Atom { public void drawU(UGraphic ug) { // ug = ug.apply(new UChangeColor(fontConfiguration.getColor())); final Dimension2D dim = calculateDimension(ug.getStringBounder()); - ug = ug.apply(new UTranslate(0, dim.getHeight() / 2)); + ug = ug.apply(UTranslate.dy(dim.getHeight() / 2)); ug.draw(getHorizontalLine()); } diff --git a/src/net/sourceforge/plantuml/creole/CreoleParser.java b/src/net/sourceforge/plantuml/creole/CreoleParser.java index 6fed7d687..f4f99c889 100644 --- a/src/net/sourceforge/plantuml/creole/CreoleParser.java +++ b/src/net/sourceforge/plantuml/creole/CreoleParser.java @@ -41,6 +41,7 @@ import java.util.List; import net.sourceforge.plantuml.EmbeddedDiagram; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -75,7 +76,7 @@ public class CreoleParser { FontConfiguration fontConfiguration) { if (lastStripe instanceof StripeTable && isTableLine(line)) { final StripeTable table = (StripeTable) lastStripe; - table.analyzeAndAddNormal(line); + table.analyzeAndAddLine(line); return null; } else if (lastStripe instanceof StripeTree && isTreeStart(StringUtils.trinNoTrace(line))) { final StripeTree tree = (StripeTree) lastStripe; @@ -95,7 +96,7 @@ public class CreoleParser { } public static boolean doesStartByColor(String line) { - return line.matches("^(\\<#\\w+(,#?\\w+)?\\>).*"); + return line.matches("^\\=?\\s*(\\<#\\w+(,#?\\w+)?\\>).*"); } public static boolean isTreeStart(String line) { diff --git a/src/net/sourceforge/plantuml/creole/Fission.java b/src/net/sourceforge/plantuml/creole/Fission.java index 78cd9ed98..fc21f3b43 100644 --- a/src/net/sourceforge/plantuml/creole/Fission.java +++ b/src/net/sourceforge/plantuml/creole/Fission.java @@ -43,6 +43,9 @@ import java.util.Collections; import java.util.List; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.atom.AbstractAtom; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomText; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/creole/PSystemCreole.java b/src/net/sourceforge/plantuml/creole/PSystemCreole.java index b3c1c8842..fbc3aaef8 100644 --- a/src/net/sourceforge/plantuml/creole/PSystemCreole.java +++ b/src/net/sourceforge/plantuml/creole/PSystemCreole.java @@ -50,9 +50,9 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemCreole extends AbstractPSystem { @@ -86,7 +86,7 @@ public class PSystemCreole extends AbstractPSystem { // final Dimension2D dim = TextBlockUtils.getDimension(sheetBlock); // final UGraphic2 ug = fileFormat.createUGraphic(new ColorMapperIdentity(), 1, dim, null, false); - // // sheetBlock.drawU(ug.apply(new UTranslate(0, 10))); + // // sheetBlock.drawU(ug.apply(UTranslate.dy(10))); // sheetBlock.drawU(ug); // ug.writeImageTOBEMOVED(os, null, 96); // return new ImageDataSimple(dim); diff --git a/src/net/sourceforge/plantuml/creole/Position.java b/src/net/sourceforge/plantuml/creole/Position.java index 3863a21ab..0938b8fd5 100644 --- a/src/net/sourceforge/plantuml/creole/Position.java +++ b/src/net/sourceforge/plantuml/creole/Position.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.creole; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Position { @@ -99,7 +99,7 @@ public class Position { public void drawDebug(UGraphic ug) { // ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(null)); ug = ug.apply(new UTranslate(x, y)); ug.draw(new URectangle(dim)); } diff --git a/src/net/sourceforge/plantuml/creole/Sea.java b/src/net/sourceforge/plantuml/creole/Sea.java index 7c352560d..d00a7128e 100644 --- a/src/net/sourceforge/plantuml/creole/Sea.java +++ b/src/net/sourceforge/plantuml/creole/Sea.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import java.util.HashMap; import java.util.Map; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.MinMax; diff --git a/src/net/sourceforge/plantuml/creole/SheetBlock1.java b/src/net/sourceforge/plantuml/creole/SheetBlock1.java index 2fbae6928..0ee09d468 100644 --- a/src/net/sourceforge/plantuml/creole/SheetBlock1.java +++ b/src/net/sourceforge/plantuml/creole/SheetBlock1.java @@ -44,6 +44,7 @@ import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.InnerStrategy; diff --git a/src/net/sourceforge/plantuml/creole/SheetBlock2.java b/src/net/sourceforge/plantuml/creole/SheetBlock2.java index 49587671e..1a87ba729 100644 --- a/src/net/sourceforge/plantuml/creole/SheetBlock2.java +++ b/src/net/sourceforge/plantuml/creole/SheetBlock2.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Rectangle2D; import java.util.List; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; diff --git a/src/net/sourceforge/plantuml/creole/Stripe.java b/src/net/sourceforge/plantuml/creole/Stripe.java index 3a2dc82a0..ccbd039a9 100644 --- a/src/net/sourceforge/plantuml/creole/Stripe.java +++ b/src/net/sourceforge/plantuml/creole/Stripe.java @@ -37,6 +37,8 @@ package net.sourceforge.plantuml.creole; import java.util.List; +import net.sourceforge.plantuml.creole.atom.Atom; + public interface Stripe { public Atom getHeader(); diff --git a/src/net/sourceforge/plantuml/creole/StripeSimple.java b/src/net/sourceforge/plantuml/creole/StripeSimple.java index 00f0fb43e..60863765d 100644 --- a/src/net/sourceforge/plantuml/creole/StripeSimple.java +++ b/src/net/sourceforge/plantuml/creole/StripeSimple.java @@ -42,15 +42,39 @@ import java.util.List; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomImg; +import net.sourceforge.plantuml.creole.atom.AtomMath; +import net.sourceforge.plantuml.creole.atom.AtomOpenIcon; +import net.sourceforge.plantuml.creole.atom.AtomSpace; +import net.sourceforge.plantuml.creole.atom.AtomSprite; +import net.sourceforge.plantuml.creole.atom.AtomText; +import net.sourceforge.plantuml.creole.command.Command; +import net.sourceforge.plantuml.creole.command.CommandCreoleColorAndSizeChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleColorChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleExposantChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleFontFamilyChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleImg; +import net.sourceforge.plantuml.creole.command.CommandCreoleLatex; +import net.sourceforge.plantuml.creole.command.CommandCreoleMath; +import net.sourceforge.plantuml.creole.command.CommandCreoleMonospaced; +import net.sourceforge.plantuml.creole.command.CommandCreoleOpenIcon; +import net.sourceforge.plantuml.creole.command.CommandCreoleQrcode; +import net.sourceforge.plantuml.creole.command.CommandCreoleSizeChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleSpace; +import net.sourceforge.plantuml.creole.command.CommandCreoleSprite; +import net.sourceforge.plantuml.creole.command.CommandCreoleStyle; +import net.sourceforge.plantuml.creole.command.CommandCreoleSvgAttributeChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleUrl; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontPosition; import net.sourceforge.plantuml.graphic.FontStyle; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.math.ScientificEquationSafe; import net.sourceforge.plantuml.openiconic.OpenIcon; import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.CharHidder; public class StripeSimple implements Stripe { @@ -202,14 +226,14 @@ public class StripeSimple implements Stripe { atoms.add(AtomText.createUrl(url, fontConfiguration, skinParam)); } - public void addSprite(String src, double scale, HtmlColor color) { + public void addSprite(String src, double scale, HColor color) { final Sprite sprite = skinParam.getSprite(src); if (sprite != null) { atoms.add(new AtomSprite(color, scale, fontConfiguration, sprite, null)); } } - public void addOpenIcon(String src, double scale, HtmlColor color) { + public void addOpenIcon(String src, double scale, HColor color) { final OpenIcon openIcon = OpenIcon.retrieve(src); if (openIcon != null) { atoms.add(new AtomOpenIcon(color, scale, openIcon, fontConfiguration, null)); diff --git a/src/net/sourceforge/plantuml/creole/StripeStyle.java b/src/net/sourceforge/plantuml/creole/StripeStyle.java index b3ed0e4b1..53107ca63 100644 --- a/src/net/sourceforge/plantuml/creole/StripeStyle.java +++ b/src/net/sourceforge/plantuml/creole/StripeStyle.java @@ -35,6 +35,9 @@ */ package net.sourceforge.plantuml.creole; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomText; +import net.sourceforge.plantuml.creole.atom.Bullet; import net.sourceforge.plantuml.graphic.FontConfiguration; public class StripeStyle { diff --git a/src/net/sourceforge/plantuml/creole/StripeTable.java b/src/net/sourceforge/plantuml/creole/StripeTable.java index a4f941e2b..a06b83f34 100644 --- a/src/net/sourceforge/plantuml/creole/StripeTable.java +++ b/src/net/sourceforge/plantuml/creole/StripeTable.java @@ -43,9 +43,12 @@ import java.util.StringTokenizer; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomTable; +import net.sourceforge.plantuml.creole.atom.AtomWithMargin; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class StripeTable implements Stripe { @@ -53,7 +56,7 @@ public class StripeTable implements Stripe { HEADER, NORMAL }; - private FontConfiguration fontConfiguration; + final private FontConfiguration fontConfiguration; final private ISkinSimple skinParam; final private AtomTable table; final private Atom marged; @@ -62,19 +65,19 @@ public class StripeTable implements Stripe { public StripeTable(FontConfiguration fontConfiguration, ISkinSimple skinParam, String line) { this.skinParam = skinParam; this.fontConfiguration = fontConfiguration; - HtmlColor lineColor = getBackOrFrontColor(line, 1); + HColor lineColor = getBackOrFrontColor(line, 1); if (lineColor == null) { lineColor = fontConfiguration.getColor(); } this.table = new AtomTable(lineColor); this.marged = new AtomWithMargin(table, 2, 2); - analyzeAndAddInternal(line, Mode.HEADER); + analyzeAndAddInternal(line); } public List getAtoms() { - return Collections. singletonList(marged); + return Collections.singletonList(marged); } - + public Atom getHeader() { return null; } @@ -87,7 +90,7 @@ public class StripeTable implements Stripe { return new SheetBlock1(sheet, LineBreakStrategy.NONE, padding); } - private HtmlColor getBackOrFrontColor(String line, int idx) { + private HColor getBackOrFrontColor(String line, int idx) { if (CreoleParser.doesStartByColor(line)) { final int idx1 = line.indexOf('#'); final int idx2 = line.indexOf('>'); @@ -112,27 +115,29 @@ public class StripeTable implements Stripe { private static final String hiddenBar = "\uE000"; - private void analyzeAndAddInternal(String line, Mode mode) { + private void analyzeAndAddInternal(String line) { line = line.replace("\\|", hiddenBar); - HtmlColor lineBackColor = getBackOrFrontColor(line, 0); + HColor lineBackColor = getBackOrFrontColor(line, 0); if (lineBackColor != null) { line = withouBackColor(line); } table.newLine(lineBackColor); for (final StringTokenizer st = new StringTokenizer(line, "|"); st.hasMoreTokens();) { + Mode mode = Mode.NORMAL; String v = st.nextToken().replace(hiddenBar.charAt(0), '|'); - HtmlColor cellBackColor = getBackOrFrontColor(v, 0); + if (v.startsWith("=")) { + v = v.substring(1); + mode = Mode.HEADER; + } + HColor cellBackColor = getBackOrFrontColor(v, 0); if (cellBackColor != null) { v = withouBackColor(v); } - if (mode == Mode.HEADER && v.startsWith("=")) { - v = v.substring(1); - } final List lines = getWithNewlinesInternal(v); final List cells = new ArrayList(); for (String s : lines) { - final StripeSimple cell = new StripeSimple(getFontConfiguration(mode), stripeStyle, - new CreoleContext(), skinParam, CreoleMode.FULL); + final StripeSimple cell = new StripeSimple(getFontConfiguration(mode), stripeStyle, new CreoleContext(), + skinParam, CreoleMode.FULL); if (s.startsWith("")) { cell.setCellAlignment(HorizontalAlignment.RIGHT); s = s.substring("".length()); @@ -179,8 +184,8 @@ public class StripeTable implements Stripe { return fontConfiguration.bold(); } - public void analyzeAndAddNormal(String line) { - analyzeAndAddInternal(line, Mode.NORMAL); + public void analyzeAndAddLine(String line) { + analyzeAndAddInternal(line); } } diff --git a/src/net/sourceforge/plantuml/creole/StripeTree.java b/src/net/sourceforge/plantuml/creole/StripeTree.java index c95572082..edbcd482e 100644 --- a/src/net/sourceforge/plantuml/creole/StripeTree.java +++ b/src/net/sourceforge/plantuml/creole/StripeTree.java @@ -39,6 +39,9 @@ import java.util.Collections; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomTree; +import net.sourceforge.plantuml.creole.atom.AtomWithMargin; import net.sourceforge.plantuml.graphic.FontConfiguration; public class StripeTree implements Stripe { diff --git a/src/net/sourceforge/plantuml/creole/AbstractAtom.java b/src/net/sourceforge/plantuml/creole/atom/AbstractAtom.java similarity index 97% rename from src/net/sourceforge/plantuml/creole/AbstractAtom.java rename to src/net/sourceforge/plantuml/creole/atom/AbstractAtom.java index 0abfe3f5c..37898c6ca 100644 --- a/src/net/sourceforge/plantuml/creole/AbstractAtom.java +++ b/src/net/sourceforge/plantuml/creole/atom/AbstractAtom.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.util.Arrays; import java.util.List; diff --git a/src/net/sourceforge/plantuml/creole/Atom.java b/src/net/sourceforge/plantuml/creole/atom/Atom.java similarity index 97% rename from src/net/sourceforge/plantuml/creole/Atom.java rename to src/net/sourceforge/plantuml/creole/atom/Atom.java index 5c7404176..39457944d 100644 --- a/src/net/sourceforge/plantuml/creole/Atom.java +++ b/src/net/sourceforge/plantuml/creole/atom/Atom.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.List; diff --git a/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java b/src/net/sourceforge/plantuml/creole/atom/AtomHorizontalTexts.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java rename to src/net/sourceforge/plantuml/creole/atom/AtomHorizontalTexts.java index 251112365..3e80d5a3f 100644 --- a/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomHorizontalTexts.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.List; @@ -72,7 +72,7 @@ public class AtomHorizontalTexts extends AbstractAtom implements Atom { double x = 0; for (Atom text : all) { final Dimension2D dim = text.calculateDimension(ug.getStringBounder()); - text.drawU(ug.apply(new UTranslate(x, 0))); + text.drawU(ug.apply(UTranslate.dx(x))); x += dim.getWidth(); } } diff --git a/src/net/sourceforge/plantuml/creole/AtomImg.java b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java similarity index 98% rename from src/net/sourceforge/plantuml/creole/AtomImg.java rename to src/net/sourceforge/plantuml/creole/atom/AtomImg.java index 7f23d9df3..a5b25605f 100644 --- a/src/net/sourceforge/plantuml/creole/AtomImg.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.Color; import java.awt.geom.Dimension2D; @@ -45,8 +45,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; -import java.util.Arrays; -import java.util.List; import javax.imageio.ImageIO; diff --git a/src/net/sourceforge/plantuml/creole/AtomImgSvg.java b/src/net/sourceforge/plantuml/creole/atom/AtomImgSvg.java similarity index 97% rename from src/net/sourceforge/plantuml/creole/AtomImgSvg.java rename to src/net/sourceforge/plantuml/creole/atom/AtomImgSvg.java index e5e78774d..31650f466 100644 --- a/src/net/sourceforge/plantuml/creole/AtomImgSvg.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomImgSvg.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; diff --git a/src/net/sourceforge/plantuml/creole/AtomMath.java b/src/net/sourceforge/plantuml/creole/atom/AtomMath.java similarity index 86% rename from src/net/sourceforge/plantuml/creole/AtomMath.java rename to src/net/sourceforge/plantuml/creole/atom/AtomMath.java index 4815d8735..e8d4b87e5 100644 --- a/src/net/sourceforge/plantuml/creole/AtomMath.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomMath.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.Color; import java.awt.geom.Dimension2D; @@ -41,24 +41,24 @@ import java.awt.image.BufferedImage; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SvgString; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.math.ScientificEquationSafe; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImageSvg; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class AtomMath extends AbstractAtom implements Atom { private final double scale; private final ScientificEquationSafe math; - private final HtmlColor foreground; - private final HtmlColor background; + private final HColor foreground; + private final HColor background; private final ColorMapper colorMapper; - public AtomMath(ScientificEquationSafe math, HtmlColor foreground, HtmlColor background, double scale, + public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background, double scale, ColorMapper colorMapper) { this.math = math; this.colorMapper = colorMapper; @@ -104,8 +104,8 @@ public class AtomMath extends AbstractAtom implements Atom { } } - private Color getColor(HtmlColor color, Color defaultValue) { - if (color instanceof HtmlColorSimple) { + private Color getColor(HColor color, Color defaultValue) { + if (color instanceof HColorSimple) { return colorMapper.getMappedColor(color); // return ((HtmlColorSimple) color).getColor999(); } diff --git a/src/net/sourceforge/plantuml/creole/AtomOpenIcon.java b/src/net/sourceforge/plantuml/creole/atom/AtomOpenIcon.java similarity index 91% rename from src/net/sourceforge/plantuml/creole/AtomOpenIcon.java rename to src/net/sourceforge/plantuml/creole/atom/AtomOpenIcon.java index 1f51ce092..181e6dba0 100644 --- a/src/net/sourceforge/plantuml/creole/AtomOpenIcon.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomOpenIcon.java @@ -33,27 +33,27 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.openiconic.OpenIcon; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AtomOpenIcon extends AbstractAtom implements Atom { private final OpenIcon openIcon; private final double factor; private final Url url; - private final HtmlColor color; + private final HColor color; - public AtomOpenIcon(HtmlColor newColor, double scale, OpenIcon openIcon, FontConfiguration fontConfiguration, + public AtomOpenIcon(HColor newColor, double scale, OpenIcon openIcon, FontConfiguration fontConfiguration, Url url) { this.url = url; this.openIcon = openIcon; diff --git a/src/net/sourceforge/plantuml/creole/AtomSpace.java b/src/net/sourceforge/plantuml/creole/atom/AtomSpace.java similarity index 97% rename from src/net/sourceforge/plantuml/creole/AtomSpace.java rename to src/net/sourceforge/plantuml/creole/atom/AtomSpace.java index 2f73c298b..83378de3b 100644 --- a/src/net/sourceforge/plantuml/creole/AtomSpace.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomSpace.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; diff --git a/src/net/sourceforge/plantuml/creole/AtomSprite.java b/src/net/sourceforge/plantuml/creole/atom/AtomSprite.java similarity index 88% rename from src/net/sourceforge/plantuml/creole/AtomSprite.java rename to src/net/sourceforge/plantuml/creole/atom/AtomSprite.java index 7aa15b1a0..04a8c0cd1 100644 --- a/src/net/sourceforge/plantuml/creole/AtomSprite.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomSprite.java @@ -33,27 +33,25 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; -import java.util.Arrays; -import java.util.List; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AtomSprite extends AbstractAtom implements Atom { private final Sprite sprite; private final double scale; private final Url url; - private final HtmlColor color; + private final HColor color; - public AtomSprite(HtmlColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) { + public AtomSprite(HColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) { this.scale = scale; this.sprite = sprite; this.url = url; diff --git a/src/net/sourceforge/plantuml/creole/AtomTable.java b/src/net/sourceforge/plantuml/creole/atom/AtomTable.java similarity index 87% rename from src/net/sourceforge/plantuml/creole/AtomTable.java rename to src/net/sourceforge/plantuml/creole/atom/AtomTable.java index 6022d5a82..84f0a4153 100644 --- a/src/net/sourceforge/plantuml/creole/AtomTable.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomTable.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.ArrayList; @@ -42,8 +42,9 @@ import java.util.List; import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.creole.Position; +import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -51,19 +52,20 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AtomTable extends AbstractAtom implements Atom { class Line { private final List cells = new ArrayList(); - private final List cellsBackColor = new ArrayList(); - private final HtmlColor lineBackColor; + private final List cellsBackColor = new ArrayList(); + private final HColor lineBackColor; - private Line(HtmlColor lineBackColor) { + private Line(HColor lineBackColor) { this.lineBackColor = lineBackColor; } - public void add(Atom cell, HtmlColor cellBackColor) { + public void add(Atom cell, HColor cellBackColor) { cells.add(cell); cellsBackColor.add(cellBackColor); } @@ -80,9 +82,9 @@ public class AtomTable extends AbstractAtom implements Atom { private final List lines = new ArrayList(); private final Map positions = new HashMap(); - private final HtmlColor lineColor; + private final HColor lineColor; - public AtomTable(HtmlColor lineColor) { + public AtomTable(HColor lineColor) { this.lineColor = lineColor; } @@ -118,7 +120,7 @@ public class AtomTable extends AbstractAtom implements Atom { if (cell instanceof SheetBlock1) { align = ((SheetBlock1) cell).getCellAlignment(); } - final HtmlColor cellBackColor = line.cellsBackColor.get(j); + final HColor cellBackColor = line.cellsBackColor.get(j); final double x1 = getStartingX(j); final double x2 = getStartingX(j + 1); final double cellWidth = x2 - x1; @@ -136,17 +138,17 @@ public class AtomTable extends AbstractAtom implements Atom { } else { dx = 0; } - cell.drawU(ug.apply(pos.getTranslate().compose(new UTranslate(dx, 0)))); + cell.drawU(ug.apply(pos.getTranslate().compose(UTranslate.dx(dx)))); } } ug = ug.apply(new UChangeColor(lineColor)); - final ULine hline = new ULine(getEndingX(getNbCols() - 1), 0); + final ULine hline = ULine.hline(getEndingX(getNbCols() - 1)); for (int i = 0; i <= getNbLines(); i++) { - ug.apply(new UTranslate(0, getStartingY(i))).draw(hline); + ug.apply(UTranslate.dy(getStartingY(i))).draw(hline); } - final ULine vline = new ULine(0, getEndingY(getNbLines() - 1)); + final ULine vline = ULine.vline(getEndingY(getNbLines() - 1)); for (int i = 0; i <= getNbCols(); i++) { - ug.apply(new UTranslate(getStartingX(i), 0)).draw(vline); + ug.apply(UTranslate.dx(getStartingX(i))).draw(vline); } } @@ -256,12 +258,12 @@ public class AtomTable extends AbstractAtom implements Atom { return lines.get(lines.size() - 1); } - public void addCell(Atom cell, HtmlColor cellBackColor) { + public void addCell(Atom cell, HColor cellBackColor) { lastLine().add(cell, cellBackColor); positions.clear(); } - public void newLine(HtmlColor lineBackColor) { + public void newLine(HColor lineBackColor) { lines.add(new Line(lineBackColor)); } } diff --git a/src/net/sourceforge/plantuml/creole/AtomText.java b/src/net/sourceforge/plantuml/creole/atom/AtomText.java similarity index 95% rename from src/net/sourceforge/plantuml/creole/AtomText.java rename to src/net/sourceforge/plantuml/creole/atom/AtomText.java index 2d1b61d4b..872c95ada 100644 --- a/src/net/sourceforge/plantuml/creole/AtomText.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomText.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.font.LineMetrics; import java.awt.geom.Dimension2D; @@ -53,11 +53,9 @@ import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.creole.command.CommandCreoleImg; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAutomatic; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.graphic.StringBounder; @@ -67,6 +65,9 @@ import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorAutomatic; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; import net.sourceforge.plantuml.utils.CharHidder; public class AtomText extends AbstractAtom implements Atom { @@ -240,14 +241,14 @@ public class AtomText extends AbstractAtom implements Atom { if (ug.matchesProperty("SPECIALTXT")) { ug.draw(this); } else { - HtmlColor textColor = fontConfiguration.getColor(); + HColor textColor = fontConfiguration.getColor(); FontConfiguration useFontConfiguration = fontConfiguration; - if (textColor instanceof HtmlColorAutomatic && ug.getParam().getBackcolor() != null) { - textColor = ((HtmlColorSimple) ug.getParam().getBackcolor()).opposite(); + if (textColor instanceof HColorAutomatic && ug.getParam().getBackcolor() != null) { + textColor = ((HColorSimple) ug.getParam().getBackcolor()).opposite(); useFontConfiguration = fontConfiguration.changeColor(textColor); } if (marginLeft != ZERO) { - ug = ug.apply(new UTranslate(marginLeft.getDouble(ug.getStringBounder()), 0)); + ug = ug.apply(UTranslate.dx(marginLeft.getDouble(ug.getStringBounder()))); } final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true); diff --git a/src/net/sourceforge/plantuml/creole/AtomTree.java b/src/net/sourceforge/plantuml/creole/atom/AtomTree.java similarity index 90% rename from src/net/sourceforge/plantuml/creole/AtomTree.java rename to src/net/sourceforge/plantuml/creole/atom/AtomTree.java index 17c5fbf82..c5d32b6d1 100644 --- a/src/net/sourceforge/plantuml/creole/AtomTree.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomTree.java @@ -33,31 +33,30 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.salt.element.Skeleton2; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AtomTree extends AbstractAtom implements Atom { - private final HtmlColor lineColor; + private final HColor lineColor; private final List cells = new ArrayList(); private final Map levels = new HashMap(); private final double margin = 2; - public AtomTree(HtmlColor lineColor) { + public AtomTree(HColor lineColor) { this.lineColor = lineColor; } @@ -84,10 +83,10 @@ public class AtomTree extends AbstractAtom implements Atom { UGraphic ug = ugInit; for (Atom cell : cells) { final int level = getLevel(cell); - cell.drawU(ug.apply(new UTranslate(margin + skeleton.getXEndForLevel(level), 0))); + cell.drawU(ug.apply(UTranslate.dx(margin + skeleton.getXEndForLevel(level)))); final Dimension2D dim = cell.calculateDimension(ug.getStringBounder()); skeleton.add(level, y + dim.getHeight() / 2); - ug = ug.apply(new UTranslate(0, dim.getHeight())); + ug = ug.apply(UTranslate.dy(dim.getHeight())); y += dim.getHeight(); } skeleton.draw(ugInit.apply(new UChangeColor(this.lineColor))); diff --git a/src/net/sourceforge/plantuml/creole/AtomVerticalTexts.java b/src/net/sourceforge/plantuml/creole/atom/AtomVerticalTexts.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/AtomVerticalTexts.java rename to src/net/sourceforge/plantuml/creole/atom/AtomVerticalTexts.java index 649829540..ddc6942d3 100644 --- a/src/net/sourceforge/plantuml/creole/AtomVerticalTexts.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomVerticalTexts.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.List; @@ -69,7 +69,7 @@ public class AtomVerticalTexts extends AbstractAtom implements Atom { double y = 0; for (Atom text : all) { final Dimension2D dim = text.calculateDimension(ug.getStringBounder()); - text.drawU(ug.apply(new UTranslate(0, y))); + text.drawU(ug.apply(UTranslate.dy(y))); y += dim.getHeight(); } } diff --git a/src/net/sourceforge/plantuml/creole/AtomWithMargin.java b/src/net/sourceforge/plantuml/creole/atom/AtomWithMargin.java similarity index 93% rename from src/net/sourceforge/plantuml/creole/AtomWithMargin.java rename to src/net/sourceforge/plantuml/creole/atom/AtomWithMargin.java index 806c85949..7fe4e2d84 100644 --- a/src/net/sourceforge/plantuml/creole/AtomWithMargin.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomWithMargin.java @@ -33,11 +33,10 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -46,7 +45,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class AtomWithMargin extends AbstractAtom implements Atom { +public class AtomWithMargin extends AbstractAtom implements Atom { private final double marginY1; private final double marginY2; @@ -85,7 +84,7 @@ class AtomWithMargin extends AbstractAtom implements Atom { } public void drawU(UGraphic ug) { - atom.drawU(ug.apply(new UTranslate(0, marginY1))); + atom.drawU(ug.apply(UTranslate.dy(marginY1))); } } diff --git a/src/net/sourceforge/plantuml/creole/Bullet.java b/src/net/sourceforge/plantuml/creole/atom/Bullet.java similarity index 92% rename from src/net/sourceforge/plantuml/creole/Bullet.java rename to src/net/sourceforge/plantuml/creole/atom/Bullet.java index 40f2e404f..0293cfbe1 100644 --- a/src/net/sourceforge/plantuml/creole/Bullet.java +++ b/src/net/sourceforge/plantuml/creole/atom/Bullet.java @@ -33,13 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -48,6 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Bullet extends AbstractAtom implements Atom { @@ -80,10 +80,10 @@ public class Bullet extends AbstractAtom implements Atom { } private void drawU0(UGraphic ug) { - final HtmlColor color = fontConfiguration.getColor(); + final HColor color = fontConfiguration.getColor(); ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)).apply(new UStroke(0)); // final double width = getWidth(ug.getStringBounder()); - ug = ug.apply(new UTranslate(3, 0)); + ug = ug.apply(UTranslate.dx(3)); ug.draw(new UEllipse(5, 5)); } @@ -96,10 +96,10 @@ public class Bullet extends AbstractAtom implements Atom { } private void drawU1(UGraphic ug) { - final HtmlColor color = fontConfiguration.getColor(); + final HColor color = fontConfiguration.getColor(); ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)).apply(new UStroke(0)); final double width = getWidth(ug.getStringBounder()); - ug = ug.apply(new UTranslate(width - 5, 0)); + ug = ug.apply(UTranslate.dx(width - 5)); ug.draw(new URectangle(3.5, 3.5)); } diff --git a/src/net/sourceforge/plantuml/creole/Command.java b/src/net/sourceforge/plantuml/creole/command/Command.java similarity index 93% rename from src/net/sourceforge/plantuml/creole/Command.java rename to src/net/sourceforge/plantuml/creole/command/Command.java index 205438144..5c8f87b54 100644 --- a/src/net/sourceforge/plantuml/creole/Command.java +++ b/src/net/sourceforge/plantuml/creole/command/Command.java @@ -33,7 +33,9 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; + +import net.sourceforge.plantuml.creole.StripeSimple; public interface Command { diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java similarity index 91% rename from src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java index 9eecad2f6..ca2c3a0d6 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java @@ -33,14 +33,15 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleColorAndSizeChange implements Command { @@ -84,7 +85,7 @@ public class CommandCreoleColorAndSizeChange implements Command { fc2 = fc2.changeSize(Integer.parseInt(m.group(2))); } if (m.group(3) != null) { - final HtmlColor color = HtmlColorSet.getInstance().getColorIfValid(m.group(3)); + final HColor color = HColorSet.instance().getColorIfValid(m.group(3)); fc2 = fc2.changeColor(color); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java similarity index 90% rename from src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java index 189618e60..495f6b8aa 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java @@ -33,15 +33,16 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.Splitter; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleColorChange implements Command { @@ -74,7 +75,7 @@ public class CommandCreoleColorChange implements Command { throw new IllegalStateException(); } final FontConfiguration fc1 = stripe.getActualFontConfiguration(); - final HtmlColor color = HtmlColorSet.getInstance().getColorIfValid(m.group(2)); + final HColor color = HColorSet.instance().getColorIfValid(m.group(2)); final FontConfiguration fc2 = fc1.changeColor(color); stripe.setActualFontConfiguration(fc2); stripe.analyzeAndAdd(m.group(3)); diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleExposantChange.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleExposantChange.java index 9d8bd96d1..5c86e93f6 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleExposantChange.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontPosition; diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleFontFamilyChange.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleFontFamilyChange.java index 76c36602e..55fbe1bb6 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleFontFamilyChange.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleImg.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleImg.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleImg.java index 2369ff8fe..c41b92560 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleImg.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleImg implements Command { diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleLatex.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java similarity index 95% rename from src/net/sourceforge/plantuml/creole/CommandCreoleLatex.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java index 32a0a3608..185494b3f 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleLatex.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.math.ScientificEquationSafe; diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleMath.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java similarity index 95% rename from src/net/sourceforge/plantuml/creole/CommandCreoleMath.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java index 1dd2ac3ca..27ad87fad 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleMath.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.math.ScientificEquationSafe; diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleMonospaced.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleMonospaced.java index 019308e29..d5b46f2a5 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleMonospaced.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; public class CommandCreoleMonospaced implements Command { diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java similarity index 86% rename from src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java index cb4a87213..74fe4e281 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java @@ -33,26 +33,27 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleOpenIcon implements Command { private final Pattern2 pattern; - private final IHtmlColorSet colorSet; + private final HColorSet colorSet; - private CommandCreoleOpenIcon(IHtmlColorSet colorSet, String p) { + private CommandCreoleOpenIcon(HColorSet colorSet, String p) { this.pattern = MyPattern.cmpile(p); this.colorSet = colorSet; } - public static Command create(IHtmlColorSet colorSet) { + public static Command create(HColorSet colorSet) { return new CommandCreoleOpenIcon(colorSet, "^(?i)(" + Splitter.openiconPattern + ")"); } @@ -72,7 +73,7 @@ public class CommandCreoleOpenIcon implements Command { final String src = m.group(2); final double scale = CommandCreoleImg.getScale(m.group(3), 1); final String colorName = CommandCreoleImg.getColor(m.group(3)); - HtmlColor color = null; + HColor color = null; if (colorName != null) { color = colorSet.getColorIfValid(colorName); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleQrcode.java similarity index 95% rename from src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleQrcode.java index 94a27f34e..8160ce0e0 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleQrcode.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleQrcode implements Command { diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSizeChange.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleSizeChange.java index d8d1ca9f6..b1289f931 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSizeChange.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSpace.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleSpace.java index cb9188491..b667c2492 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSpace.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; public class CommandCreoleSpace implements Command { diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java similarity index 86% rename from src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java index 34d585215..dbed01ccc 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java @@ -33,26 +33,27 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleSprite implements Command { private final Pattern2 pattern; - private final IHtmlColorSet colorSet; + private final HColorSet colorSet; - private CommandCreoleSprite(IHtmlColorSet colorSet, String p) { + private CommandCreoleSprite(HColorSet colorSet, String p) { this.pattern = MyPattern.cmpile(p); this.colorSet = colorSet; } - public static Command create(IHtmlColorSet colorSet) { + public static Command create(HColorSet colorSet) { return new CommandCreoleSprite(colorSet, "^(?i)(" + Splitter.spritePattern2 + ")"); } @@ -72,7 +73,7 @@ public class CommandCreoleSprite implements Command { final String src = m.group(2); final double scale = CommandCreoleImg.getScale(m.group(3), 1); final String colorName = CommandCreoleImg.getColor(m.group(3)); - HtmlColor color = null; + HColor color = null; if (colorName != null) { color = colorSet.getColorIfValid(colorName); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleStyle.java similarity index 94% rename from src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleStyle.java index 5a924e549..7cff02729 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleStyle.java @@ -33,15 +33,16 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.AddStyle; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreoleStyle implements Command { @@ -70,7 +71,7 @@ public class CommandCreoleStyle implements Command { this.tryExtendedColor = tryExtendedColor; } - private HtmlColor getExtendedColor(Matcher2 m) { + private HColor getExtendedColor(Matcher2 m) { if (tryExtendedColor) { return style.getExtendedColor(m.group(2)); } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSvgAttributeChange.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleSvgAttributeChange.java index 7430f3b55..68e62d76d 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSvgAttributeChange.java @@ -33,11 +33,12 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.graphic.SvgAttributes; diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java similarity index 96% rename from src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java index 6d2d3bde8..da90515af 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.Url; @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.StripeSimple; public class CommandCreoleUrl implements Command { diff --git a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java index 754c848a9..977ccde6a 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java +++ b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java @@ -64,7 +64,7 @@ import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.statediagram.StateDiagram; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker; import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker; diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index ddde2d883..ef1fa872a 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -64,7 +64,6 @@ import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.graphic.CircledCharacter; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockSprited; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -75,6 +74,7 @@ import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Display implements Iterable { @@ -102,6 +102,16 @@ public class Display implements Iterable { return result; } + public Stereotype getStereotypeIfAny() { + for (CharSequence cs : displayData) { + if (cs instanceof Stereotype) { + return (Stereotype) cs; + } + } + return null; + + } + public Display replaceBackslashT() { final Display result = new Display(this, defaultCreoleMode); for (int i = 0; i < result.displayData.size(); i++) { @@ -464,7 +474,7 @@ public class Display implements Iterable { public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + UFont fontForStereotype, HColor htmlColorForStereotype) { if (maxMessageSize == null) { throw new IllegalArgumentException(); } @@ -493,7 +503,7 @@ public class Display implements Iterable { } private TextBlock createStereotype(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, - SpriteContainer spriteContainer, int position, UFont fontForStereotype, HtmlColor htmlColorForStereotype, + SpriteContainer spriteContainer, int position, UFont fontForStereotype, HColor htmlColorForStereotype, LineBreakStrategy maxMessageSize, CreoleMode creoleMode) { final Stereotype stereotype = (Stereotype) get(position); TextBlock circledCharacter = null; diff --git a/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java b/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java index 3efe0fc45..01ebf4c9a 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java +++ b/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java @@ -76,17 +76,17 @@ public enum EntityPosition { if (rankdir == Rankdir.TOP_TO_BOTTOM) { final Shadowable rectangle = new URectangle(RADIUS * 2 * 4, RADIUS * 2); ug.draw(rectangle); - final ULine vline = new ULine(0, RADIUS * 2); - ug.apply(new UTranslate(RADIUS * 2, 0)).draw(vline); - ug.apply(new UTranslate(RADIUS * 2 * 2, 0)).draw(vline); - ug.apply(new UTranslate(RADIUS * 2 * 3, 0)).draw(vline); + final ULine vline = ULine.vline(RADIUS * 2); + ug.apply(UTranslate.dx(RADIUS * 2)).draw(vline); + ug.apply(UTranslate.dx(RADIUS * 2 * 2)).draw(vline); + ug.apply(UTranslate.dx(RADIUS * 2 * 3)).draw(vline); } else { final Shadowable rectangle = new URectangle(RADIUS * 2, RADIUS * 2 * 4); - ug.apply(new UTranslate(0, 0)).draw(rectangle); - final ULine hline = new ULine(RADIUS * 2, 0); - ug.apply(new UTranslate(0, RADIUS * 2)).draw(hline); - ug.apply(new UTranslate(0, RADIUS * 2 * 2)).draw(hline); - ug.apply(new UTranslate(0, RADIUS * 2 * 3)).draw(hline); + ug.apply(UTranslate.dy(0)).draw(rectangle); + final ULine hline = ULine.hline(RADIUS * 2); + ug.apply(UTranslate.dy(RADIUS * 2)).draw(hline); + ug.apply(UTranslate.dy(RADIUS * 2 * 2)).draw(hline); + ug.apply(UTranslate.dy(RADIUS * 2 * 3)).draw(hline); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java index dd3d93789..b76d83e91 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java +++ b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -56,6 +55,7 @@ import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.SingleStrategy; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class GroupRoot implements IGroup { @@ -251,7 +251,7 @@ public class GroupRoot implements IGroup { throw new UnsupportedOperationException(); } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) { throw new UnsupportedOperationException(); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Ident.java b/src/net/sourceforge/plantuml/cucadiagram/Ident.java index 077b023b4..54faf3639 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Ident.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Ident.java @@ -85,7 +85,7 @@ public class Ident implements Code { } public static Ident empty() { - return new Ident(Collections. emptyList()); + return new Ident(Collections.emptyList()); } public String getLast() { @@ -150,7 +150,7 @@ public class Ident implements Code { static private Ident from(String full, String separator) { final Ident result = new Ident(new ArrayList()); - if (separator == null || full.contains(separator + separator)) { + if (isOdd(full, separator)) { result.parts.add(full); return result; } @@ -168,12 +168,17 @@ public class Ident implements Code { } } + private static boolean isOdd(String full, String separator) { + return separator == null || full.contains(separator + separator) || full.endsWith(separator); + } + private void checkResult(String separator) { for (String s : this.parts) { if (s.length() == 0) { throw new IllegalStateException(toString()); } - if (separator != null && s.contains(separator) && s.contains(separator + separator) == false) { + if (separator != null && s.contains(separator) && s.endsWith(separator) == false + && s.contains(separator + separator) == false) { throw new IllegalStateException(toString()); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Link.java b/src/net/sourceforge/plantuml/cucadiagram/Link.java index ad74b7850..7861fc0e3 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Link.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Link.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbolInterface; @@ -56,6 +55,7 @@ import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.UniqueSequence; public class Link extends WithLinkType implements Hideable, Removeable { @@ -131,7 +131,7 @@ public class Link extends WithLinkType implements Hideable, Removeable { } public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, String qualifier1, - String qualifier2, String labeldistance, String labelangle, HtmlColor specificColor, + String qualifier2, String labeldistance, String labelangle, HColor specificColor, StyleBuilder styleBuilder) { if (length < 1) { throw new IllegalArgumentException(); diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java b/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java index fc5dba195..c174a292c 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java @@ -42,13 +42,13 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class LinkConstraint { @@ -86,7 +86,7 @@ public class LinkConstraint { if (x2 == 0 && y2 == 0) { return; } - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); // ug.apply(new UTranslate(x1, y1)).draw(new URectangle(10, 10)); // ug.apply(new UTranslate(x2, y2)).draw(new URectangle(10, 10)); diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java index 617056967..65ff0ab60 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.cucadiagram; import net.sourceforge.plantuml.OptionFlags; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryArrow; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryArrowAndCircle; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryParenthesis; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryPlus; import net.sourceforge.plantuml.svek.extremity.ExtremityFactorySquarre; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryTriangle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public enum LinkDecor { @@ -93,7 +93,7 @@ public enum LinkDecor { return arrowSize; } - public ExtremityFactory getExtremityFactory(HtmlColor backgroundColor) { + public ExtremityFactory getExtremityFactory(HColor backgroundColor) { if (this == LinkDecor.PLUS) { return new ExtremityFactoryPlus(); } else if (this == LinkDecor.HALF_ARROW) { diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java b/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java index 81994a9cf..f368b643b 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java @@ -35,17 +35,17 @@ */ package net.sourceforge.plantuml.cucadiagram; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.extremity.MiddleCircleCircledMode; import net.sourceforge.plantuml.svek.extremity.MiddleFactory; import net.sourceforge.plantuml.svek.extremity.MiddleFactoryCircle; import net.sourceforge.plantuml.svek.extremity.MiddleFactoryCircleCircled; +import net.sourceforge.plantuml.ugraphic.color.HColor; public enum LinkMiddleDecor { NONE, CIRCLE, CIRCLE_CIRCLED, CIRCLE_CIRCLED1, CIRCLE_CIRCLED2; - public MiddleFactory getMiddleFactory(HtmlColor backColor) { + public MiddleFactory getMiddleFactory(HColor backColor) { if (this == CIRCLE) { return new MiddleFactoryCircle(backColor); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index cfc30daaf..0503a7b31 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -49,7 +49,6 @@ import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -67,6 +66,7 @@ import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Center; import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Left; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULayoutGroup; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.CharHidder; public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockWidth, TextBlock, WithPorts { @@ -77,8 +77,8 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW private final FontParam fontParam; private final ISkinParam skinParam; - private final HtmlColor color; - private final HtmlColor hyperlinkColor; + private final HColor color; + private final HColor hyperlinkColor; private final boolean useUnderlineForHyperlink; private final Rose rose = new Rose(); private final List members = new ArrayList(); @@ -221,9 +221,9 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW } }; } - final HtmlColor back = modifier.getBackground() == null ? null : rose.getHtmlColor(skinParam, + final HColor back = modifier.getBackground() == null ? null : rose.getHtmlColor(skinParam, modifier.getBackground()); - final HtmlColor fore = rose.getHtmlColor(skinParam, modifier.getForeground()); + final HColor fore = rose.getHtmlColor(skinParam, modifier.getForeground()); final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), fore, back, url != null); return TextBlockWithUrl.withUrl(uBlock, url); diff --git a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java index b6efbb7ee..8fe30c666 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java @@ -53,10 +53,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.creole.CommandCreoleImg; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.command.CommandCreoleImg; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.SpriteUtils; @@ -64,6 +61,9 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Stereotype implements CharSequence { private final static RegexComposed circleChar = new RegexConcat( // @@ -103,12 +103,12 @@ public class Stereotype implements CharSequence { private final boolean automaticPackageStyle; private String label; - private HtmlColor htmlColor; + private HColor htmlColor; private char character; private String spriteName; private double spriteScale; - public Stereotype(String label, double radius, UFont circledFont, IHtmlColorSet htmlColorSet) { + public Stereotype(String label, double radius, UFont circledFont, HColorSet htmlColorSet) { this(label, radius, circledFont, true, htmlColorSet); } @@ -129,7 +129,7 @@ public class Stereotype implements CharSequence { } public Stereotype(String label, double radius, UFont circledFont, boolean automaticPackageStyle, - IHtmlColorSet htmlColorSet) { + HColorSet htmlColorSet) { if (label == null) { throw new IllegalArgumentException(); } @@ -153,8 +153,8 @@ public class Stereotype implements CharSequence { local = null; } final String colName = mCircleSprite.get("COLOR", 0); - final HtmlColor col = htmlColorSet.getColorIfValid(colName); - this.htmlColor = col == null ? HtmlColorUtils.BLACK : col; + final HColor col = htmlColorSet.getColorIfValid(colName); + this.htmlColor = col == null ? HColorUtils.BLACK : col; this.spriteName = mCircleSprite.get("NAME", 0); this.character = '\0'; this.spriteScale = CommandCreoleImg.getScale(mCircleSprite.get("SCALE", 0), 1); @@ -182,7 +182,7 @@ public class Stereotype implements CharSequence { this(label, true); } - public HtmlColor getHtmlColor() { + public HColor getHtmlColor() { return htmlColor; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java b/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java index 12e88ccaf..baf299459 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java +++ b/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java @@ -40,10 +40,10 @@ import java.util.Collections; import java.util.List; import java.util.StringTokenizer; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public abstract class WithLinkType { @@ -55,15 +55,15 @@ public abstract class WithLinkType { private List supplementary = new ArrayList(); - public final HtmlColor getSpecificColor() { + public final HColor getSpecificColor() { return colors.getColor(ColorType.LINE); } - public final void setSpecificColor(HtmlColor specificColor) { + public final void setSpecificColor(HColor specificColor) { setSpecificColor(specificColor, 0); } - public final void setSpecificColor(HtmlColor specificColor, int i) { + public final void setSpecificColor(HColor specificColor, int i) { if (i == 0) { colors = colors.add(ColorType.LINE, specificColor); } else { @@ -147,7 +147,7 @@ public abstract class WithLinkType { } else if (s.startsWith("thickness=")) { this.goThickness(Double.parseDouble(s.substring("thickness=".length()))); } else { - final HtmlColor tmp = HtmlColorSet.getInstance().getColorIfValid(s); + final HColor tmp = HColorSet.instance().getColorIfValid(s); setSpecificColor(tmp, i); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java index 8fe64afda..61de74ea4 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java @@ -122,7 +122,7 @@ public final class CucaDiagramTxtMaker { printClass( ent, (UGraphicTxt) globalUg.apply(new UTranslate(p.getX() / getXPixelPerChar(), p.getY() - / getYPixelPerChar()))); + / getYPixelPerChar()))); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java b/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java index 803ba1e53..261dce13d 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java @@ -55,7 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.svek.DotMode; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; final public class DotData implements PortionShower { diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java index be3c760fc..cf8794179 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java +++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java @@ -63,10 +63,10 @@ import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.SuperGroup; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class EntityFactory { @@ -125,7 +125,7 @@ public final class EntityFactory { } if (g.getColors(skinParam).getColor(ColorType.BACK) == null) { final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack(); - final HtmlColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false); + final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false); folder.setSpecificColorTOBEREMOVED(ColorType.BACK, c1 == null ? skinParam.getBackgroundColor() : c1); } else { folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors(skinParam).getColor(ColorType.BACK)); diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java index 019e5cbf7..fb8dd611e 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java +++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java @@ -71,7 +71,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -80,6 +79,7 @@ import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.SingleStrategy; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.UniqueSequence; final public class EntityImpl implements ILeaf, IGroup { @@ -683,7 +683,7 @@ final public class EntityImpl implements ILeaf, IGroup { public FontConfiguration getFontConfigurationForTitle(final ISkinParam skinParam) { final FontParam fontParam = getTitleFontParam(); - final HtmlColor fontHtmlColor = skinParam.getFontHtmlColor(getStereotype(), fontParam, FontParam.PACKAGE); + final HColor fontHtmlColor = skinParam.getFontHtmlColor(getStereotype(), fontParam, FontParam.PACKAGE); final UFont font = skinParam.getFont(getStereotype(), true, fontParam, FontParam.PACKAGE); final FontConfiguration fontConfiguration = new FontConfiguration(font, fontHtmlColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); @@ -732,7 +732,7 @@ final public class EntityImpl implements ILeaf, IGroup { this.colors = colors; } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) { if (color != null) { this.colors = colors.add(type, color); } diff --git a/src/net/sourceforge/plantuml/cute/CutePath.java b/src/net/sourceforge/plantuml/cute/CutePath.java index 67e01ca0e..ffd3f0f94 100644 --- a/src/net/sourceforge/plantuml/cute/CutePath.java +++ b/src/net/sourceforge/plantuml/cute/CutePath.java @@ -40,11 +40,11 @@ import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class CutePath { @@ -141,7 +141,7 @@ public class CutePath { for (int i = 0; i < arcs.size(); i++) { final BetweenCorners betweenCorners = new BetweenCorners(getCorner(i), getCorner(i + 1), arcs.get(i) .getTension()); - betweenCorners.debugMe(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null))); + betweenCorners.debugMe(ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(null))); } } diff --git a/src/net/sourceforge/plantuml/cute/PSystemCute.java b/src/net/sourceforge/plantuml/cute/PSystemCute.java index e71939c4d..a8d04fddb 100644 --- a/src/net/sourceforge/plantuml/cute/PSystemCute.java +++ b/src/net/sourceforge/plantuml/cute/PSystemCute.java @@ -44,8 +44,8 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemCute extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/cute/PositionnedImpl.java b/src/net/sourceforge/plantuml/cute/PositionnedImpl.java index c5a6a42f8..45dda3277 100644 --- a/src/net/sourceforge/plantuml/cute/PositionnedImpl.java +++ b/src/net/sourceforge/plantuml/cute/PositionnedImpl.java @@ -35,18 +35,18 @@ */ package net.sourceforge.plantuml.cute; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PositionnedImpl implements Positionned { private final CuteShape cuteShape; - private final HtmlColor color; + private final HColor color; private final UTranslate position; private final RotationZoom rotationZoom; @@ -62,7 +62,7 @@ public class PositionnedImpl implements Positionned { this.rotationZoom = RotationZoom.fromVarArgs(args); } - private PositionnedImpl(CuteShape cuteShape, HtmlColor color, UTranslate position, RotationZoom rotationZoom) { + private PositionnedImpl(CuteShape cuteShape, HColor color, UTranslate position, RotationZoom rotationZoom) { this.cuteShape = cuteShape; this.color = color; this.position = position; @@ -71,14 +71,14 @@ public class PositionnedImpl implements Positionned { public PositionnedImpl(Group group, RotationZoom rotation) { this.cuteShape = group; - this.color = HtmlColorUtils.BLACK; + this.color = HColorUtils.BLACK; this.position = new UTranslate(); this.rotationZoom = rotation; } public PositionnedImpl(Group group, UTranslate translation) { this.cuteShape = group; - this.color = HtmlColorUtils.BLACK; + this.color = HColorUtils.BLACK; this.position = translation; this.rotationZoom = RotationZoom.none(); } diff --git a/src/net/sourceforge/plantuml/cute/VarArgs.java b/src/net/sourceforge/plantuml/cute/VarArgs.java index e61e91d9b..6a83b68e8 100644 --- a/src/net/sourceforge/plantuml/cute/VarArgs.java +++ b/src/net/sourceforge/plantuml/cute/VarArgs.java @@ -40,10 +40,10 @@ import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class VarArgs { @@ -89,14 +89,14 @@ public class VarArgs { return new MyDouble(value); } - public HtmlColor getAsColor(String k) { + public HColor getAsColor(String k) { final String value = args.get(k); if (value == null) { - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } - final HtmlColor result = HtmlColorSet.getInstance().getColorIfValid(value); + final HColor result = HColorSet.instance().getColorIfValid(value); if (result == null) { - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } return result; } diff --git a/src/net/sourceforge/plantuml/dedication/PSystemDedication.java b/src/net/sourceforge/plantuml/dedication/PSystemDedication.java index 6bd11de2e..bc9cd7301 100644 --- a/src/net/sourceforge/plantuml/dedication/PSystemDedication.java +++ b/src/net/sourceforge/plantuml/dedication/PSystemDedication.java @@ -43,12 +43,12 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemDedication extends AbstractPSystem { @@ -63,7 +63,7 @@ public class PSystemDedication extends AbstractPSystem { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, getMetadata(), null, 0, 0, null, false); imageBuilder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/definition/PSystemDefinition.java b/src/net/sourceforge/plantuml/definition/PSystemDefinition.java index c9a62bb9c..6562f4fb9 100644 --- a/src/net/sourceforge/plantuml/definition/PSystemDefinition.java +++ b/src/net/sourceforge/plantuml/definition/PSystemDefinition.java @@ -48,12 +48,12 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemDefinition extends AbstractPSystem implements UDrawable { @@ -80,7 +80,7 @@ public class PSystemDefinition extends AbstractPSystem implements UDrawable { public void drawU(UGraphic ug) { final UFont font = UFont.sansSerif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); Display.getWithNewlines(startLine).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()).drawU(ug); } diff --git a/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java b/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java index 7b895fb1a..480e42d74 100644 --- a/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java +++ b/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; @@ -49,17 +48,18 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class BoxedCharacter extends AbstractTextBlock implements TextBlock { private final String c; private final UFont font; - private final HtmlColor innerCircle; - private final HtmlColor circle; - private final HtmlColor fontColor; + private final HColor innerCircle; + private final HColor circle; + private final HColor fontColor; private final double radius; - public BoxedCharacter(char c, double size, UFont font, HtmlColor innerCircle, HtmlColor circle, HtmlColor fontColor) { + public BoxedCharacter(char c, double size, UFont font, HColor innerCircle, HColor circle, HColor fontColor) { this.c = "" + c; this.font = font; this.innerCircle = innerCircle; diff --git a/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java b/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java index d78298089..961f89cbb 100644 --- a/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java +++ b/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -65,6 +64,7 @@ import net.sourceforge.plantuml.ugraphic.ULayoutGroup; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageDesignedDomain extends AbstractEntityImage { final private TextBlock name; @@ -125,11 +125,11 @@ public class EntityImageDesignedDomain extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final URectangle rect = new URectangle(widthTotal, heightTotal, 0, 0); - URectangle rect2 = new URectangle(4, heightTotal, 0, 0); + final URectangle rect = new URectangle(widthTotal, heightTotal); + URectangle rect2 = new URectangle(4, heightTotal); ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBackground); } @@ -144,7 +144,7 @@ public class EntityImageDesignedDomain extends AbstractEntityImage { final ULayoutGroup header = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder())); header.add(name); - header.drawU(ug.apply(new UTranslate(4, 0)), dimTotal.getWidth(), dimTitle.getHeight()); + header.drawU(ug.apply(UTranslate.dx(4)), dimTotal.getWidth(), dimTitle.getHeight()); if (url != null) { ug.closeAction(); diff --git a/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java b/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java index 117995f7f..5c694241f 100644 --- a/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java +++ b/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -66,6 +65,7 @@ import net.sourceforge.plantuml.ugraphic.ULayoutGroup; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageDomain extends AbstractEntityImage { final private TextBlock name; @@ -128,10 +128,10 @@ public class EntityImageDomain extends AbstractEntityImage { final Dimension2D dimTag = getTagDimension(stringBounder); final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final URectangle rect = new URectangle(widthTotal, heightTotal, 0, 0); + final URectangle rect = new URectangle(widthTotal, heightTotal); ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBackground); } diff --git a/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java b/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java index bb71a6594..67c81b37b 100644 --- a/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java +++ b/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -65,6 +64,7 @@ import net.sourceforge.plantuml.ugraphic.ULayoutGroup; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageMachine extends AbstractEntityImage { final private TextBlock name; @@ -124,11 +124,11 @@ public class EntityImageMachine extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final URectangle rect = new URectangle(widthTotal, heightTotal, 0, 0); - URectangle rect2 = new URectangle(4, heightTotal, 0, 0); + final URectangle rect = new URectangle(widthTotal, heightTotal); + URectangle rect2 = new URectangle(4, heightTotal); ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBackground); } @@ -139,11 +139,11 @@ public class EntityImageMachine extends AbstractEntityImage { final UStroke stroke = getStroke(); ug.apply(stroke).draw(rect); - ug.apply(new UTranslate(4, 0)).apply(stroke).draw(rect2); + ug.apply(UTranslate.dx(4)).apply(stroke).draw(rect2); final ULayoutGroup header = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder())); header.add(name); - header.drawU(ug.apply(new UTranslate(5, 0)), dimTotal.getWidth(), dimTitle.getHeight()); + header.drawU(ug.apply(UTranslate.dx(5)), dimTotal.getWidth(), dimTitle.getHeight()); if (url != null) { ug.closeAction(); diff --git a/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java b/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java index d87d9fe5d..d7f581160 100644 --- a/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java +++ b/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -68,6 +67,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageRequirement extends AbstractEntityImage { @@ -119,12 +119,12 @@ public class EntityImageRequirement extends AbstractEntityImage { } ug = ug.apply(getStroke()); - HtmlColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); + HColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); if (linecolor == null) { linecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.requirementBorder); } ug = ug.apply(new UChangeColor(linecolor)); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.requirementBackground); } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index 056844f4e..94608d321 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -59,11 +59,11 @@ import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.descdiagram.DescriptionDiagram; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateElementFull extends SingleLineCommand2 { @@ -225,7 +225,7 @@ public class CommandCreateElementFull extends SingleLineCommand2 { @@ -195,7 +195,7 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2Special thanks to our sponsors and donors !")); header.drawU(ug); final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UTranslate(0, header.calculateDimension(stringBounder).getHeight())); + ug = ug.apply(UTranslate.dy(header.calculateDimension(stringBounder).getHeight())); double x = 0; double lastX = 0; double y = 0; for (TextBlock tb : cols) { final Dimension2D dim = tb.calculateDimension(stringBounder); - tb.drawU(ug.apply(new UTranslate(x, 0))); + tb.drawU(ug.apply(UTranslate.dx(x))); lastX = x; x += dim.getWidth() + 10; y = Math.max(y, dim.getHeight()); diff --git a/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java b/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java index 2363e990f..9b33d2ed5 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java +++ b/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java @@ -47,14 +47,14 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemSkinparameterList extends AbstractPSystem { @@ -62,7 +62,7 @@ public class PSystemSkinparameterList extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final UDrawable result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, getMetadata(), null, 0, 0, null, false); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); @@ -77,7 +77,7 @@ public class PSystemSkinparameterList extends AbstractPSystem { double y = 0; for (TextBlock tb : cols) { final Dimension2D dim = tb.calculateDimension(stringBounder); - tb.drawU(ug.apply(new UTranslate(x, 0))); + tb.drawU(ug.apply(UTranslate.dx(x))); x += dim.getWidth() + 10; y = Math.max(y, dim.getHeight()); } diff --git a/src/net/sourceforge/plantuml/eggs/GraphicsPath.java b/src/net/sourceforge/plantuml/eggs/GraphicsPath.java index 24128e168..63ec27440 100644 --- a/src/net/sourceforge/plantuml/eggs/GraphicsPath.java +++ b/src/net/sourceforge/plantuml/eggs/GraphicsPath.java @@ -44,11 +44,11 @@ import java.io.OutputStream; import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.png.PngIO; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UMotif; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; public class GraphicsPath { @@ -75,7 +75,7 @@ public class GraphicsPath { final UGraphicG2d ug = new UGraphicG2d(colorMapper, g2d, 1.0); ug.setBufferedImage(im); final UMotif motif = new UMotif(path); - motif.drawHorizontal(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)), 20, 20, 1); + motif.drawHorizontal(ug.apply(new UChangeColor(HColorUtils.BLACK)), 20, 20, 1); g2d.dispose(); return im; diff --git a/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java b/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java index 66de2abe9..1a28f81a4 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java @@ -48,8 +48,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemAppleTwo extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java b/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java index b026374b8..e10926004 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java @@ -42,12 +42,12 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemCharlie extends AbstractPSystem { @@ -61,7 +61,7 @@ public class PSystemCharlie extends AbstractPSystem { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.BLACK, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.BLACK, getMetadata(), null, 0, 0, null, false); imageBuilder.setUDrawable(new UDrawable() { diff --git a/src/net/sourceforge/plantuml/eggs/PSystemColors.java b/src/net/sourceforge/plantuml/eggs/PSystemColors.java index 280c6372f..680c2aa80 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemColors.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemColors.java @@ -55,14 +55,9 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -71,13 +66,18 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; // http://www.redblobgames.com/grids/hexagons/ public class PSystemColors extends AbstractPSystem implements UDrawable { private final double rectangleHeight = 28; private final double rectangleWidth = 175; - private final HtmlColorSetSimple colors = new HtmlColorSetSimple(); + private final HColorSet colors = HColorSet.instance(); private final String paletteCentralColor; private final double size = 60; @@ -92,7 +92,7 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, getMetadata(), null, 0, 0, null, false); imageBuilder.setUDrawable(this); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); @@ -103,7 +103,7 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { } public void drawU(UGraphic ug) { - if (colors.getColorIfValid(paletteCentralColor) instanceof HtmlColorSimple) { + if (colors.getColorIfValid(paletteCentralColor) instanceof HColorSimple) { drawPalette(ug); } else { drawFull(ug); @@ -154,7 +154,7 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { } private void drawOneHexa(UGraphic ug, String colorName, int i, int j, UPolygon hexa) { - final HtmlColorSimple color = (HtmlColorSimple) colors.getColorIfValid(colorName); + final HColorSimple color = (HColorSimple) colors.getColorIfValid(colorName); ug = applyColor(ug, color); ug = ug.apply(new UTranslate(centerHexa(i, j))); ug.draw(hexa); @@ -178,7 +178,7 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { continue; } final String candidat = colorName.substring(0, i) + BackSlash.BS_BS_N + colorName.substring(i); - final TextBlock tt = getTextName(font, candidat, (HtmlColorSimple) HtmlColorUtils.BLACK); + final TextBlock tt = getTextName(font, candidat, (HColorSimple) HColorUtils.BLACK); final double width = tt.calculateDimension(stringBounder).getWidth(); if (width < min) { result = candidat; @@ -188,7 +188,7 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { return result; } - private UGraphic applyColor(UGraphic ug, HtmlColor color) { + private UGraphic applyColor(UGraphic ug, HColor color) { return ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)); } @@ -235,11 +235,11 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { } private Comparator closeComparator(String center) { - final HtmlColorSimple centerColor = (HtmlColorSimple) colors.getColorIfValid(center); + final HColorSimple centerColor = (HColorSimple) colors.getColorIfValid(center); return new Comparator() { public int compare(String col1, String col2) { - final double dist1 = centerColor.distance((HtmlColorSimple) colors.getColorIfValid(col1)); - final double dist2 = centerColor.distance((HtmlColorSimple) colors.getColorIfValid(col2)); + final double dist1 = centerColor.distance((HColorSimple) colors.getColorIfValid(col1)); + final double dist2 = centerColor.distance((HColorSimple) colors.getColorIfValid(col2)); return (int) Math.signum(dist1 - dist2); } }; @@ -248,12 +248,12 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { private void drawFull(UGraphic ug) { final UFont font = UFont.sansSerif(14).bold(); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); int i = 0; int j = 0; for (String name : colors.names()) { UGraphic tmp = getPositioned(ug, i, j); - final HtmlColorSimple color = (HtmlColorSimple) colors.getColorIfValid(name); + final HColorSimple color = (HColorSimple) colors.getColorIfValid(name); applyColor(tmp, color).draw(new URectangle(rectangleWidth, rectangleHeight)); final TextBlock tt = getTextName(font, name, color); final Dimension2D dimText = tt.calculateDimension(ug.getStringBounder()); @@ -267,9 +267,9 @@ public class PSystemColors extends AbstractPSystem implements UDrawable { } } - private TextBlock getTextName(final UFont font, String name, final HtmlColorSimple color) { - final HtmlColorSimple opposite = color.opposite(); - final FontConfiguration fc = new FontConfiguration(font, opposite, HtmlColorUtils.BLUE, true); + private TextBlock getTextName(final UFont font, String name, final HColorSimple color) { + final HColorSimple opposite = color.opposite(); + final FontConfiguration fc = new FontConfiguration(font, opposite, HColorUtils.BLUE, true); final TextBlock tt = Display.getWithNewlines(name).create(fc, HorizontalAlignment.CENTER, new SpriteContainerEmpty()); return tt; diff --git a/src/net/sourceforge/plantuml/eggs/PSystemEgg.java b/src/net/sourceforge/plantuml/eggs/PSystemEgg.java index 06a25dd97..d79f7f0f1 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemEgg.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemEgg.java @@ -47,8 +47,8 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemEgg extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/eggs/PSystemLost.java b/src/net/sourceforge/plantuml/eggs/PSystemLost.java index d66f9adf4..9a43722b8 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemLost.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemLost.java @@ -46,8 +46,8 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemLost extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/eggs/PSystemPath.java b/src/net/sourceforge/plantuml/eggs/PSystemPath.java index 2e4263a65..712c6783a 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemPath.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemPath.java @@ -42,7 +42,7 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemPath extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/eggs/PSystemRIP.java b/src/net/sourceforge/plantuml/eggs/PSystemRIP.java index cb8a50195..758313bf5 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemRIP.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemRIP.java @@ -52,8 +52,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemRIP extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java b/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java index fc971c2c7..0b89f8def 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java @@ -47,8 +47,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemWelcome extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/eps/EpsGraphics.java b/src/net/sourceforge/plantuml/eps/EpsGraphics.java index 50636270a..4b257f08b 100644 --- a/src/net/sourceforge/plantuml/eps/EpsGraphics.java +++ b/src/net/sourceforge/plantuml/eps/EpsGraphics.java @@ -43,12 +43,12 @@ import java.util.StringTokenizer; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.Log; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ShadowManager; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.USegment; import net.sourceforge.plantuml.ugraphic.USegmentType; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.utils.MathUtils; import net.sourceforge.plantuml.version.Version; @@ -328,7 +328,7 @@ public class EpsGraphics { } - public void epsPolygon(HtmlColorGradient gr, ColorMapper mapper, double... points) { + public void epsPolygon(HColorGradient gr, ColorMapper mapper, double... points) { assert points.length % 2 == 0; setFillColor(mapper.getMappedColor(gr.getColor1())); epsPolygon(points); @@ -402,7 +402,7 @@ public class EpsGraphics { } public void epsRectangle(double x, double y, double width, double height, double rx, double ry, - HtmlColorGradient gr, ColorMapper mapper) { + HColorGradient gr, ColorMapper mapper) { checkCloseDone(); ensureVisible(x, y); ensureVisible(x + width, y + height); diff --git a/src/net/sourceforge/plantuml/error/PSystemError.java b/src/net/sourceforge/plantuml/error/PSystemError.java index 547f9c5ad..f08659d22 100644 --- a/src/net/sourceforge/plantuml/error/PSystemError.java +++ b/src/net/sourceforge/plantuml/error/PSystemError.java @@ -70,10 +70,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -81,13 +77,17 @@ import net.sourceforge.plantuml.graphic.TextBlockRaw; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; import net.sourceforge.plantuml.version.LicenseInfo; import net.sourceforge.plantuml.version.PSystemVersion; @@ -122,23 +122,22 @@ public abstract class PSystemError extends AbstractPSystem { } private TextBlockBackcolored getGraphicalFormatted() { - final FontConfiguration fc0 = GraphicStrings.sansSerif14(HtmlColorUtils.BLACK).bold(); - final FontConfiguration fc1 = GraphicStrings.sansSerif14(HtmlColorUtils.MY_GREEN).bold(); - final FontConfiguration fc2 = GraphicStrings.sansSerif14(HtmlColorUtils.RED).bold(); + final FontConfiguration fc0 = GraphicStrings.sansSerif14(HColorUtils.BLACK).bold(); + final FontConfiguration fc1 = GraphicStrings.sansSerif14(HColorUtils.MY_GREEN).bold(); + final FontConfiguration fc2 = GraphicStrings.sansSerif14(HColorUtils.RED).bold(); final List fullBody = getTextFullBody(); final TextBlock result0 = TextBlockUtils.addBackcolor( - TextBlockUtils.withMargin(new TextBlockRaw(getTextFromStack(), fc0), 1, 1, 1, 4), - HtmlColorUtils.MY_GREEN); + TextBlockUtils.withMargin(new TextBlockRaw(getTextFromStack(), fc0), 1, 1, 1, 4), HColorUtils.MY_GREEN); final TextBlock result1 = new TextBlockRaw(allButLast(fullBody), fc1); - final TextBlock result2 = new TextBlockRaw(onlyLast(fullBody), fc1.wave(HtmlColorUtils.RED)); + final TextBlock result2 = new TextBlockRaw(onlyLast(fullBody), fc1.wave(HColorUtils.RED)); final TextBlock result3 = new TextBlockRaw(getTextError(), fc2); TextBlock result = result0; result = TextBlockUtils.mergeTB(result, result1, HorizontalAlignment.LEFT); result = TextBlockUtils.mergeTB(result, result2, HorizontalAlignment.LEFT); result = TextBlockUtils.mergeTB(result, result3, HorizontalAlignment.LEFT); result = TextBlockUtils.withMargin(result, 5, 5); - return TextBlockUtils.addBackcolor(result, HtmlColorUtils.BLACK); + return TextBlockUtils.addBackcolor(result, HColorUtils.BLACK); } private List getPureAsciiFormatted() { @@ -219,17 +218,17 @@ public abstract class PSystemError extends AbstractPSystem { } else { udrawable = result; } - final int min = (int) (System.currentTimeMillis() / 60000L) % 60; - // udrawable = addMessageAdopt(udrawable); - if (min == 1 || min == 8 || min == 13 || min == 55) { - udrawable = addMessagePatreon(udrawable); - } else if (min == 15) { - udrawable = addMessageLiberapay(udrawable); - } else if (min == 30 || min == 39 || min == 48) { - udrawable = addMessageDedication(udrawable); - } else if (getSource().containsIgnoreCase("arecibo")) { - udrawable = addMessageArecibo(udrawable); - } + udrawable = addMessageCoronavirus(udrawable); +// final int min = (int) (System.currentTimeMillis() / 60000L) % 60; +// if (min == 1 || min == 8 || min == 13 || min == 55) { +// udrawable = addMessagePatreon(udrawable); +// } else if (min == 15) { +// udrawable = addMessageLiberapay(udrawable); +// } else if (min == 30 || min == 39 || min == 48) { +// udrawable = addMessageDedication(udrawable); +// } else if (getSource().containsIgnoreCase("arecibo")) { +// udrawable = addMessageArecibo(udrawable); +// } imageBuilder.setUDrawable(udrawable); final ImageData imageData = imageBuilder.writeImageTOBEMOVED(fileFormat, seed(), os); ((ImageDataAbstract) imageData).setStatus(FileImageData.ERROR); @@ -283,6 +282,13 @@ public abstract class PSystemError extends AbstractPSystem { return result; } + private TextBlock addMessageCoronavirus(final TextBlock source) throws IOException { + final TextBlock message = getMessageCoronavirus(); + TextBlock result = TextBlockUtils.mergeTB(message, source, HorizontalAlignment.LEFT); + result = TextBlockUtils.mergeTB(result, message, HorizontalAlignment.LEFT); + return result; + } + private TextBlock addMessageDedication(final TextBlock source) throws IOException { if (LicenseInfo.retrieveNamedOrDistributorQuickIsValid()) { return source; @@ -309,17 +315,17 @@ public abstract class PSystemError extends AbstractPSystem { private TextBlockBackcolored getMessageDedication() { final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); - final HtmlColorSimple backColor = (HtmlColorSimple) new HtmlColorSetSimple().getColorIfValid("#eae2c9"); + final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorIfValid("#eae2c9"); - final BufferedImage qrcode = smaller(utils.exportFlashcode("http://plantuml.com/dedication", Color.BLACK, - backColor.getColor999())); + final BufferedImage qrcode = smaller( + utils.exportFlashcode("http://plantuml.com/dedication", Color.BLACK, backColor.getColor999())); final Display disp = Display.create("Add your own dedication into PlantUML", " ", "For just $5 per month!", "Details on [[http://plantuml.com/dedication]]"); final UFont font = UFont.sansSerif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); - final TextBlock text = TextBlockUtils.withMargin( - disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + final TextBlock text = TextBlockUtils + .withMargin(disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); final TextBlock result; if (qrcode == null) { result = text; @@ -332,35 +338,71 @@ public abstract class PSystemError extends AbstractPSystem { } private TextBlockBackcolored getMessageAdopt() { - final HtmlColorSimple backColor = (HtmlColorSimple) new HtmlColorSetSimple().getColorIfValid("#eff4d2"); + final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorIfValid("#eff4d2"); final Display disp = Display.create("Adopt-a-Word and put your message here!", " ", "Details on [[http://plantuml.com/adopt]]", " "); final UFont font = UFont.sansSerif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); - final TextBlock text = TextBlockUtils.withMargin( - disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + final TextBlock text = TextBlockUtils + .withMargin(disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); final TextBlock result; result = text; return TextBlockUtils.addBackcolor(result, backColor); } + private TextBlockBackcolored getMessageCoronavirus() { + + final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); + final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorIfValid("#fff"); + + final BufferedImage qrcode = smaller(utils.exportFlashcode( + "https://medium.com/@tomaspueyo/coronavirus-act-today-or-people-will-die-f4d3d9cd99ca", Color.BLACK, + backColor.getColor999())); + final Display disp = Display.create("Coronavirus: Why You Must Act Now", " ", + "Please use the flashcode or go to", "https://plantuml/coronavirus", " ", + "If you live in UK, Europe, North & South America, Iran, Japan, Korea...", + " please apply social distancing right now!", " ", "The coronavirus is coming to you.", + "It’s coming at an exponential speed: gradually, and then suddenly.", + "It’s a matter of days. Maybe a week or two.", + "When it does, your healthcare system will be overwhelmed.", + "Your fellow citizens will be treated in the hallways.", + "Exhausted healthcare workers will break down. Some will die.", + "They will have to decide which patient gets the oxygen and which one dies.", + "The only way to prevent this is social distancing today. Not tomorrow. Today.", + "That means keeping as many people home as possible, starting now.", " "); + + final UFont font = UFont.sansSerif(14); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + final TextBlock text = TextBlockUtils + .withMargin(disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); + final TextBlock result; + if (qrcode == null) { + result = text; + } else { + final UImage qr = new UImage(qrcode).scaleNearestNeighbor(3); + result = TextBlockUtils.mergeLR(text, TextBlockUtils.fromUImage(qr), VerticalAlignment.CENTER); + } + return TextBlockUtils.addBackcolor(result, backColor); + + } + private TextBlockBackcolored getMessagePatreon() { final UImage message = new UImage(PSystemVersion.getTime01()); final Color back = new Color(message.getImage().getRGB(0, 0)); - final HtmlColor backColor = new HtmlColorSimple(back, false); + final HColor backColor = new HColorSimple(back, false); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); - final BufferedImage qrcode = smaller(utils.exportFlashcode("http://plantuml.com/patreon", Color.BLACK, - Color.WHITE)); + final BufferedImage qrcode = smaller( + utils.exportFlashcode("http://plantuml.com/patreon", Color.BLACK, Color.WHITE)); final int scale = 2; final double imWidth = message.getWidth() + (qrcode == null ? 0 : qrcode.getWidth() * scale + 20); - final double imHeight = qrcode == null ? message.getHeight() : Math.max(message.getHeight(), qrcode.getHeight() - * scale + 10); + final double imHeight = qrcode == null ? message.getHeight() + : Math.max(message.getHeight(), qrcode.getHeight() * scale + 10); return new TextBlockBackcolored() { public void drawU(UGraphic ug) { @@ -385,7 +427,7 @@ public abstract class PSystemError extends AbstractPSystem { return MinMax.fromMax(imWidth + 1, imHeight + 1); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } }; @@ -395,7 +437,7 @@ public abstract class PSystemError extends AbstractPSystem { private TextBlockBackcolored getMessageLiberapay() { final UImage message = new UImage(PSystemVersion.getTime15()); final Color back = new Color(message.getImage().getRGB(0, 0)); - final HtmlColor backColor = new HtmlColorSimple(back, false); + final HColor backColor = new HColorSimple(back, false); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); final BufferedImage qrcode = smaller(utils.exportFlashcode("http://plantuml.com/lp", Color.BLACK, Color.WHITE)); @@ -403,8 +445,8 @@ public abstract class PSystemError extends AbstractPSystem { final int scale = 2; final double imWidth = message.getWidth() + (qrcode == null ? 0 : qrcode.getWidth() * scale + 20); - final double imHeight = qrcode == null ? message.getHeight() : Math.max(message.getHeight(), qrcode.getHeight() - * scale + 10); + final double imHeight = qrcode == null ? message.getHeight() + : Math.max(message.getHeight(), qrcode.getHeight() * scale + 10); return new TextBlockBackcolored() { public void drawU(UGraphic ug) { @@ -429,7 +471,7 @@ public abstract class PSystemError extends AbstractPSystem { return MinMax.fromMax(imWidth + 1, imHeight + 1); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } }; diff --git a/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java b/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java index 343d07f4a..94bce19b0 100644 --- a/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java +++ b/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.golem.Tile; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.Shadowable; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ActivityBox extends AbstractTextBlock { @@ -93,9 +93,9 @@ public class ActivityBox extends AbstractTextBlock { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER); - ug = ug.apply(new UChangeColor(HtmlColorUtils.MY_RED)); - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.MY_YELLOW)); + final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(CORNER); + ug = ug.apply(new UChangeColor(HColorUtils.MY_RED)); + ug = ug.apply(new UChangeBackColor(HColorUtils.MY_YELLOW)); ug.apply(new UStroke(1.5)).draw(rect); tb.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); diff --git a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java index 20d81f88b..a89c45acf 100644 --- a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java +++ b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java @@ -57,11 +57,9 @@ import net.sourceforge.plantuml.golem.Tile; import net.sourceforge.plantuml.golem.TileArea; import net.sourceforge.plantuml.golem.TileGeometry; import net.sourceforge.plantuml.golem.TilesField; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -71,6 +69,8 @@ import net.sourceforge.plantuml.ugraphic.UGraphicUtils; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FlowDiagram extends UmlDiagram implements TextBlock { @@ -126,7 +126,7 @@ public class FlowDiagram extends UmlDiagram implements TextBlock { @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - UGraphicUtils.writeImage(os, null, fileFormatOption, seed(), new ColorMapperIdentity(), HtmlColorUtils.WHITE, + UGraphicUtils.writeImage(os, null, fileFormatOption, seed(), new ColorMapperIdentity(), HColorUtils.WHITE, this); return ImageDataSimple.ok(); } @@ -150,8 +150,8 @@ public class FlowDiagram extends UmlDiagram implements TextBlock { box.drawU(ug.apply(new UTranslate((x + xmin * SINGLE_SIZE_X + deltaX / 2), (y + ymin * SINGLE_SIZE_Y + deltaY / 2)))); } - ug = ug.apply(new UChangeColor(HtmlColorUtils.MY_RED)); - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.MY_RED)); + ug = ug.apply(new UChangeColor(HColorUtils.MY_RED)); + ug = ug.apply(new UChangeBackColor(HColorUtils.MY_RED)); final UShape arrow = new UEllipse(7, 7); for (Path p : field.getPaths()) { final TileArea start = p.getStart(); diff --git a/src/net/sourceforge/plantuml/font/PSystemListFonts.java b/src/net/sourceforge/plantuml/font/PSystemListFonts.java index 6816d3d6e..0bec5b189 100644 --- a/src/net/sourceforge/plantuml/font/PSystemListFonts.java +++ b/src/net/sourceforge/plantuml/font/PSystemListFonts.java @@ -47,8 +47,8 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemListFonts extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/golem/Tile.java b/src/net/sourceforge/plantuml/golem/Tile.java index 91edc23cd..6a4cd7c13 100644 --- a/src/net/sourceforge/plantuml/golem/Tile.java +++ b/src/net/sourceforge/plantuml/golem/Tile.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Tile extends AbstractTextBlock implements TextBlock { @@ -79,7 +79,7 @@ public class Tile extends AbstractTextBlock implements TextBlock { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); final TextBlock n = Display.create("" + num).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final Dimension2D dimNum = n.calculateDimension(ug.getStringBounder()); final Dimension2D dimTotal = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/golem/TilesField.java b/src/net/sourceforge/plantuml/golem/TilesField.java index c921006e6..6a5dd22a7 100644 --- a/src/net/sourceforge/plantuml/golem/TilesField.java +++ b/src/net/sourceforge/plantuml/golem/TilesField.java @@ -45,13 +45,13 @@ import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TilesField extends AbstractTextBlock implements TextBlock { @@ -253,7 +253,7 @@ public class TilesField extends AbstractTextBlock implements TextBlock { final double yt = p.getYmin() * dimSingle.getHeight() / 2; t.drawU(ug.apply(new UTranslate((x + xt), (y + yt)))); } - ug = ug.apply(new UChangeColor(HtmlColorUtils.RED)); + ug = ug.apply(new UChangeColor(HColorUtils.RED)); for (Path p : paths) { final TileArea start = p.getStart(); final TileArea dest = p.getDest(); diff --git a/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java b/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java index 52d6c5c57..506926567 100644 --- a/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java +++ b/src/net/sourceforge/plantuml/graph/AbstractEntityImage.java @@ -39,27 +39,27 @@ import java.awt.Graphics2D; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.cucadiagram.IEntity; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; abstract class AbstractEntityImage { private final IEntity entity; - final private HtmlColor red = HtmlColorUtils.MY_RED; + final private HColor red = HColorUtils.MY_RED; - final private HtmlColor yellow = HtmlColorUtils.MY_YELLOW; - private final HtmlColor yellowNote = HtmlColorUtils.COL_FBFB77; + final private HColor yellow = HColorUtils.MY_YELLOW; + private final HColor yellowNote = HColorUtils.COL_FBFB77; final private UFont font14 = UFont.sansSerif(14); final private UFont font17 = UFont.courier(17).bold(); - final private HtmlColor green = HtmlColorUtils.COL_ADD1B2; - final private HtmlColor violet = HtmlColorUtils.COL_B4A7E5; - final private HtmlColor blue = HtmlColorUtils.COL_A9DCDF; - final private HtmlColor rose = HtmlColorUtils.COL_EB937F; + final private HColor green = HColorUtils.COL_ADD1B2; + final private HColor violet = HColorUtils.COL_B4A7E5; + final private HColor blue = HColorUtils.COL_A9DCDF; + final private HColor rose = HColorUtils.COL_EB937F; public AbstractEntityImage(IEntity entity) { if (entity == null) { @@ -76,11 +76,11 @@ abstract class AbstractEntityImage { return entity; } - protected final HtmlColor getRed() { + protected final HColor getRed() { return red; } - protected final HtmlColor getYellow() { + protected final HColor getYellow() { return yellow; } @@ -92,23 +92,23 @@ abstract class AbstractEntityImage { return font14; } - protected final HtmlColor getGreen() { + protected final HColor getGreen() { return green; } - protected final HtmlColor getViolet() { + protected final HColor getViolet() { return violet; } - protected final HtmlColor getBlue() { + protected final HColor getBlue() { return blue; } - protected final HtmlColor getRose() { + protected final HColor getRose() { return rose; } - protected final HtmlColor getYellowNote() { + protected final HColor getYellowNote() { return yellowNote; } } diff --git a/src/net/sourceforge/plantuml/graph/EntityImageActivityBar.java b/src/net/sourceforge/plantuml/graph/EntityImageActivityBar.java index ee5c2bc32..65566bf4e 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageActivityBar.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageActivityBar.java @@ -42,7 +42,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; class EntityImageActivityBar extends AbstractEntityImage { diff --git a/src/net/sourceforge/plantuml/graph/EntityImageActivityBranch.java b/src/net/sourceforge/plantuml/graph/EntityImageActivityBranch.java index da317ecfa..b83d1adb9 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageActivityBranch.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageActivityBranch.java @@ -42,7 +42,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; class EntityImageActivityBranch extends AbstractEntityImage { diff --git a/src/net/sourceforge/plantuml/graph/EntityImageActivityCircle.java b/src/net/sourceforge/plantuml/graph/EntityImageActivityCircle.java index a0995f212..f8b3a835f 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageActivityCircle.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageActivityCircle.java @@ -42,7 +42,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; class EntityImageActivityCircle extends AbstractEntityImage { diff --git a/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java b/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java index 80032ae73..cba3158a2 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java @@ -46,7 +46,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.CircleInterface; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; class EntityImageCircleInterface extends AbstractEntityImage { diff --git a/src/net/sourceforge/plantuml/graphic/AddStyle.java b/src/net/sourceforge/plantuml/graphic/AddStyle.java index 10300cf4d..d1f2b60c1 100644 --- a/src/net/sourceforge/plantuml/graphic/AddStyle.java +++ b/src/net/sourceforge/plantuml/graphic/AddStyle.java @@ -35,13 +35,14 @@ */ package net.sourceforge.plantuml.graphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AddStyle implements FontChange { private final FontStyle style; - private final HtmlColor extendedColor; + private final HColor extendedColor; - public AddStyle(FontStyle style, HtmlColor extendedColor) { + public AddStyle(FontStyle style, HColor extendedColor) { this.style = style; this.extendedColor = extendedColor; } diff --git a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java index f4ac55146..fe14c67d3 100644 --- a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java +++ b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java @@ -45,18 +45,19 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CircledCharacter extends AbstractTextBlock implements TextBlock { private final String c; private final UFont font; - private final HtmlColor innerCircle; - private final HtmlColor circle; - private final HtmlColor fontColor; + private final HColor innerCircle; + private final HColor circle; + private final HColor fontColor; private final double radius; - public CircledCharacter(char c, double radius, UFont font, HtmlColor innerCircle, HtmlColor circle, - HtmlColor fontColor) { + public CircledCharacter(char c, double radius, UFont font, HColor innerCircle, HColor circle, + HColor fontColor) { this.c = "" + c; this.radius = radius; this.font = font; diff --git a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java index 27644787c..7eadc920b 100644 --- a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java +++ b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java @@ -38,6 +38,8 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; class ColorAndSizeChange implements FontChange { @@ -45,13 +47,13 @@ class ColorAndSizeChange implements FontChange { static final Pattern2 sizePattern = MyPattern.cmpile("(?i)size\\s*=\\s*[%g]?(\\d+)[%g]?"); - private final HtmlColor color; + private final HColor color; private final Integer size; ColorAndSizeChange(String s) { final Matcher2 matcherColor = colorPattern.matcher(s); if (matcherColor.find()) { - color = HtmlColorSet.getInstance().getColorIfValid(matcherColor.group(1)); + color = HColorSet.instance().getColorIfValid(matcherColor.group(1)); } else { color = null; } @@ -63,7 +65,7 @@ class ColorAndSizeChange implements FontChange { } } - HtmlColor getColor() { + HColor getColor() { return color; } diff --git a/src/net/sourceforge/plantuml/graphic/ColorChange.java b/src/net/sourceforge/plantuml/graphic/ColorChange.java index 00c5dfd1b..eb7812a88 100644 --- a/src/net/sourceforge/plantuml/graphic/ColorChange.java +++ b/src/net/sourceforge/plantuml/graphic/ColorChange.java @@ -38,22 +38,24 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; class ColorChange implements FontChange { static private final Pattern2 colorPattern = MyPattern.cmpile("(?i)" + Splitter.fontColorPattern2); - private final HtmlColor color; + private final HColor color; ColorChange(String s) { final Matcher2 matcherColor = colorPattern.matcher(s); if (matcherColor.find() == false) { throw new IllegalArgumentException(); } - this.color = HtmlColorSet.getInstance().getColorIfValid(matcherColor.group(1)); + this.color = HColorSet.instance().getColorIfValid(matcherColor.group(1)); } - HtmlColor getColor() { + HColor getColor() { return color; } diff --git a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java index a44c03963..62a384183 100644 --- a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java +++ b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java @@ -45,34 +45,36 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FontConfiguration { private final EnumSet styles; private final UFont currentFont; private final UFont motherFont; - private final HtmlColor motherColor; - private final HtmlColor hyperlinkColor; - private final HtmlColor currentColor; - private final HtmlColor extendedColor; + private final HColor motherColor; + private final HColor hyperlinkColor; + private final HColor currentColor; + private final HColor extendedColor; private final FontPosition fontPosition; private final SvgAttributes svgAttributes; private final boolean hyperlink; private final boolean useUnderlineForHyperlink; private final int tabSize; - public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { + public FontConfiguration(UFont font, HColor color, HColor hyperlinkColor, boolean useUnderlineForHyperlink) { this(font, color, hyperlinkColor, useUnderlineForHyperlink, 8); } - public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, + public FontConfiguration(UFont font, HColor color, HColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) { this(getStyles(font), font, color, font, color, null, FontPosition.NORMAL, new SvgAttributes(), false, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public static FontConfiguration blackBlueTrue(UFont font) { - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true, 8); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLUE, true, 8); } public FontConfiguration(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { @@ -86,7 +88,7 @@ public class FontConfiguration { return useUnderlineForHyperlink; } - public final HtmlColor getHyperlinkColor() { + public final HColor getHyperlinkColor() { return hyperlinkColor; } @@ -112,9 +114,9 @@ public class FontConfiguration { return styles.toString() + " " + currentColor; } - private FontConfiguration(EnumSet styles, UFont motherFont, HtmlColor motherColor, UFont currentFont, - HtmlColor currentColor, HtmlColor extendedColor, FontPosition fontPosition, SvgAttributes svgAttributes, - boolean hyperlink, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) { + private FontConfiguration(EnumSet styles, UFont motherFont, HColor motherColor, UFont currentFont, + HColor currentColor, HColor extendedColor, FontPosition fontPosition, SvgAttributes svgAttributes, + boolean hyperlink, HColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) { this.styles = styles; this.currentFont = currentFont; this.motherFont = motherFont; @@ -129,7 +131,7 @@ public class FontConfiguration { this.tabSize = tabSize; } - public FontConfiguration forceFont(UFont newFont, HtmlColor htmlColorForStereotype) { + public FontConfiguration forceFont(UFont newFont, HColor htmlColorForStereotype) { if (newFont == null) { return add(FontStyle.ITALIC); } @@ -153,7 +155,7 @@ public class FontConfiguration { fontPosition, svgAttributes, true, hyperlinkColor, useUnderlineForHyperlink, tabSize); } - public FontConfiguration changeColor(HtmlColor htmlColor) { + public FontConfiguration changeColor(HColor htmlColor) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, htmlColor, extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } @@ -162,14 +164,14 @@ public class FontConfiguration { if (colors == null) { throw new IllegalArgumentException(); } - final HtmlColor color = colors.getColor(ColorType.TEXT); + final HColor color = colors.getColor(ColorType.TEXT); if (color == null) { return this; } return changeColor(color); } - FontConfiguration changeExtendedColor(HtmlColor newExtendedColor) { + FontConfiguration changeExtendedColor(HColor newExtendedColor) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, newExtendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } @@ -222,7 +224,7 @@ public class FontConfiguration { return add(FontStyle.UNDERLINE); } - public FontConfiguration wave(HtmlColor color) { + public FontConfiguration wave(HColor color) { return add(FontStyle.WAVE).changeExtendedColor(color); } @@ -248,14 +250,14 @@ public class FontConfiguration { return fontPosition.mute(result); } - public HtmlColor getColor() { + public HColor getColor() { if (hyperlink) { return hyperlinkColor; } return currentColor; } - public HtmlColor getExtendedColor() { + public HColor getExtendedColor() { return extendedColor; } diff --git a/src/net/sourceforge/plantuml/graphic/FontStyle.java b/src/net/sourceforge/plantuml/graphic/FontStyle.java index a212ed1de..7d36d25b1 100644 --- a/src/net/sourceforge/plantuml/graphic/FontStyle.java +++ b/src/net/sourceforge/plantuml/graphic/FontStyle.java @@ -41,6 +41,8 @@ import java.util.EnumSet; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public enum FontStyle { PLAIN, ITALIC, BOLD, UNDERLINE, STRIKE, WAVE, BACKCOLOR; @@ -119,14 +121,14 @@ public enum FontStyle { throw new UnsupportedOperationException(); } - public HtmlColor getExtendedColor(String s) { + public HColor getExtendedColor(String s) { final Matcher2 m = MyPattern.cmpile(getActivationPattern()).matcher(s); if (m.find() == false || m.groupCount() != 1) { return null; } final String color = m.group(1); - if (HtmlColorSet.getInstance().getColorIfValid(color) != null) { - return HtmlColorSet.getInstance().getColorIfValid(color); + if (HColorSet.instance().getColorIfValid(color) != null) { + return HColorSet.instance().getColorIfValid(color); } return null; } diff --git a/src/net/sourceforge/plantuml/graphic/GraphicStrings.java b/src/net/sourceforge/plantuml/graphic/GraphicStrings.java index 882327156..fd8946f9f 100644 --- a/src/net/sourceforge/plantuml/graphic/GraphicStrings.java +++ b/src/net/sourceforge/plantuml/graphic/GraphicStrings.java @@ -52,14 +52,16 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GraphicStrings extends AbstractTextBlock implements IEntityImage { private final double margin = 5; - private final HtmlColor background; + private final HColor background; - private final static HtmlColor hyperlinkColor = HtmlColorUtils.BLUE; + private final static HColor hyperlinkColor = HColorUtils.BLUE; private final static boolean useUnderlineForHyperlink = true; @@ -77,56 +79,56 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage { CreoleMode.NO_CREOLE); } - private static HtmlColor getForeColor(boolean useRed) { + private static HColor getForeColor(boolean useRed) { if (useRed) { - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } - return HtmlColorUtils.MY_GREEN; + return HColorUtils.MY_GREEN; } - private static HtmlColor getBackColor(boolean useRed) { + private static HColor getBackColor(boolean useRed) { if (useRed) { - return HtmlColorUtils.RED_LIGHT; + return HColorUtils.RED_LIGHT; } - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } public static TextBlockBackcolored createGreenOnBlackMonospaced(List strings) { - return new GraphicStrings(strings, monospaced14(HtmlColorUtils.GREEN), HtmlColorUtils.BLACK, null, null, + return new GraphicStrings(strings, monospaced14(HColorUtils.GREEN), HColorUtils.BLACK, null, null, CreoleMode.SIMPLE_LINE); } public static TextBlockBackcolored createBlackOnWhite(List strings) { - return new GraphicStrings(strings, sansSerif12(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, null, null, + return new GraphicStrings(strings, sansSerif12(HColorUtils.BLACK), HColorUtils.WHITE, null, null, CreoleMode.FULL); } public static TextBlockBackcolored createBlackOnWhiteMonospaced(List strings) { - return new GraphicStrings(strings, monospaced14(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, null, null, + return new GraphicStrings(strings, monospaced14(HColorUtils.BLACK), HColorUtils.WHITE, null, null, CreoleMode.FULL); } public static TextBlockBackcolored createBlackOnWhite(List strings, BufferedImage image, GraphicPosition position) { - return new GraphicStrings(strings, sansSerif12(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, image, position, + return new GraphicStrings(strings, sansSerif12(HColorUtils.BLACK), HColorUtils.WHITE, image, position, CreoleMode.FULL); } - private static FontConfiguration sansSerif12(HtmlColor color) { + private static FontConfiguration sansSerif12(HColor color) { return new FontConfiguration(UFont.sansSerif(12), color, hyperlinkColor, useUnderlineForHyperlink); } - public static FontConfiguration sansSerif14(HtmlColor color) { + public static FontConfiguration sansSerif14(HColor color) { return new FontConfiguration(UFont.sansSerif(14), color, hyperlinkColor, useUnderlineForHyperlink); } - private static FontConfiguration monospaced14(HtmlColor color) { + private static FontConfiguration monospaced14(HColor color) { return new FontConfiguration(UFont.monospaced(14), color, hyperlinkColor, useUnderlineForHyperlink); } private final CreoleMode mode; - private GraphicStrings(List strings, FontConfiguration fontConfiguration, HtmlColor background, + private GraphicStrings(List strings, FontConfiguration fontConfiguration, HColor background, BufferedImage image, GraphicPosition position, CreoleMode mode) { this.strings = strings; this.background = background; @@ -187,7 +189,7 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage { return ShapeType.RECTANGLE; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return background; } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java b/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java index afe11da01..3c47e756e 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java +++ b/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java @@ -42,10 +42,12 @@ import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class HtmlColorAndStyle { - private final HtmlColor color; + private final HColor color; private final LinkStyle style; @Override @@ -53,11 +55,11 @@ public class HtmlColorAndStyle { return color + " " + style; } - public HtmlColorAndStyle(HtmlColor color) { + public HtmlColorAndStyle(HColor color) { this(color, LinkStyle.NORMAL()); } - public HtmlColorAndStyle(HtmlColor color, LinkStyle style) { + public HtmlColorAndStyle(HColor color, LinkStyle style) { if (color == null) { throw new IllegalArgumentException(); } @@ -65,7 +67,7 @@ public class HtmlColorAndStyle { this.style = style; } - public HtmlColor getColor() { + public HColor getColor() { return color; } @@ -78,7 +80,7 @@ public class HtmlColorAndStyle { } public static HtmlColorAndStyle build(ISkinParam skinParam, String definition) { - HtmlColor color; + HColor color; if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder()); color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); @@ -86,14 +88,14 @@ public class HtmlColorAndStyle { color = Rainbow.build(skinParam).getColors().get(0).color; } LinkStyle style = LinkStyle.NORMAL(); - final IHtmlColorSet set = skinParam.getIHtmlColorSet(); + final HColorSet set = skinParam.getIHtmlColorSet(); for (String s : definition.split(",")) { final LinkStyle tmpStyle = LinkStyle.fromString1(s); if (tmpStyle.isNormal() == false) { style = tmpStyle; continue; } - final HtmlColor tmpColor = set.getColorIfValid(s); + final HColor tmpColor = set.getColorIfValid(s); if (tmpColor != null) { color = tmpColor; } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorTransparent.java b/src/net/sourceforge/plantuml/graphic/HtmlColorTransparent.java deleted file mode 100644 index 0a71dbe7a..000000000 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorTransparent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2020, Arnaud Roques - * - * Project Info: http://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * http://plantuml.com/patreon (only 1$ per month!) - * http://plantuml.com/paypal - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * - * Original Author: Arnaud Roques - * - */ -package net.sourceforge.plantuml.graphic; - -public class HtmlColorTransparent implements HtmlColor { - -} diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index e520364d7..7188b733d 100644 --- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -247,7 +247,8 @@ public class QuoteUtils { "Cerzngher bcgvzvmngvba vf gur ebbg bs nyy rivy", "Chgnva, w'ra nv zneer q'nibve gbhwbhef envfba", "Guvf vf gur jnl", "Cngvrapr lbh zhfg unir zl lbhat cnqnjna", "V gubhtug lbh jrer ba zl fvqr", "Qba'g cnavp. Abar bs lbh cnavp. Nofbyhgryl ab ernfba gb cnavp.", - "Gung jnf hacyrnfnag. V'z fbeel lbh unq gb frr gung.", "Gur neg bs fvzcyvpvgl vf n chmmyr bs pbzcyrkvgl."); + "Gung jnf hacyrnfnag. V'z fbeel lbh unq gb frr gung.", "Gur neg bs fvzcyvpvgl vf n chmmyr bs pbzcyrkvgl.", + "Xrrc pnyz naq fgnl ng ubzr"); private QuoteUtils() { } diff --git a/src/net/sourceforge/plantuml/graphic/Rainbow.java b/src/net/sourceforge/plantuml/graphic/Rainbow.java index 270a491b3..1985d91cc 100644 --- a/src/net/sourceforge/plantuml/graphic/Rainbow.java +++ b/src/net/sourceforge/plantuml/graphic/Rainbow.java @@ -45,6 +45,8 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class Rainbow { @@ -66,7 +68,7 @@ public class Rainbow { return new Rainbow(0); } - public static Rainbow fromColor(HtmlColor color) { + public static Rainbow fromColor(HColor color) { if (color == null) { return Rainbow.none(); } @@ -80,8 +82,8 @@ public class Rainbow { return fromColor(rose.getHtmlColor(skinParam, ColorParam.arrow)); } - public static Rainbow build(Style style, IHtmlColorSet set) { - final HtmlColor color = style.value(PName.LineColor).asColor(set); + public static Rainbow build(Style style, HColorSet set) { + final HColor color = style.value(PName.LineColor).asColor(set); return fromColor(color); } @@ -127,7 +129,7 @@ public class Rainbow { return Collections.unmodifiableList(colors); } - public HtmlColor getColor() { + public HColor getColor() { return colors.get(0).getColor(); } diff --git a/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java b/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java index 039aa0f76..2ad590e8d 100644 --- a/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java +++ b/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java @@ -42,13 +42,14 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class SimpleTextBlockBordered extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; - private final HtmlColor color; + private final HColor color; - public SimpleTextBlockBordered(TextBlock textBlock, HtmlColor color) { + public SimpleTextBlockBordered(TextBlock textBlock, HColor color) { this.textBlock = textBlock; this.color = color; } diff --git a/src/net/sourceforge/plantuml/graphic/SymbolContext.java b/src/net/sourceforge/plantuml/graphic/SymbolContext.java index 1f7820c7d..ca19ce612 100644 --- a/src/net/sourceforge/plantuml/graphic/SymbolContext.java +++ b/src/net/sourceforge/plantuml/graphic/SymbolContext.java @@ -39,18 +39,20 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; public class SymbolContext { - private final HtmlColor backColor; - private final HtmlColor foreColor; + private final HColor backColor; + private final HColor foreColor; private final UStroke stroke; private final double deltaShadow; private final double roundCorner; private final double diagonalCorner; - private SymbolContext(HtmlColor backColor, HtmlColor foreColor, UStroke stroke, double deltaShadow, - double roundCorner, double diagonalCorner) { + private SymbolContext(HColor backColor, HColor foreColor, UStroke stroke, double deltaShadow, double roundCorner, + double diagonalCorner) { this.backColor = backColor; this.foreColor = foreColor; this.stroke = stroke; @@ -81,13 +83,14 @@ public class SymbolContext { } public SymbolContext transparentBackColorToNull() { - if (backColor instanceof HtmlColorTransparent) { - return new SymbolContext(null, foreColor, stroke, deltaShadow, roundCorner, diagonalCorner); + if (backColor instanceof HColorBackground) { + return new SymbolContext(((HColorBackground) backColor).getNull(), foreColor, stroke, deltaShadow, + roundCorner, diagonalCorner); } return this; } - public SymbolContext(HtmlColor backColor, HtmlColor foreColor) { + public SymbolContext(HColor backColor, HColor foreColor) { this(backColor, foreColor, new UStroke(), 0, 0, 0); } @@ -103,11 +106,11 @@ public class SymbolContext { return new SymbolContext(backColor, foreColor, newStroke, deltaShadow, roundCorner, diagonalCorner); } - public SymbolContext withBackColor(HtmlColor backColor) { + public SymbolContext withBackColor(HColor backColor) { return new SymbolContext(backColor, foreColor, stroke, deltaShadow, roundCorner, diagonalCorner); } - public SymbolContext withForeColor(HtmlColor foreColor) { + public SymbolContext withForeColor(HColor foreColor) { return new SymbolContext(backColor, foreColor, stroke, deltaShadow, roundCorner, diagonalCorner); } @@ -115,11 +118,11 @@ public class SymbolContext { return new SymbolContext(backColor, foreColor, stroke, deltaShadow, roundCorner, diagonalCorner); } - public HtmlColor getBackColor() { + public HColor getBackColor() { return backColor; } - public HtmlColor getForeColor() { + public HColor getForeColor() { return foreColor; } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java b/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java index 29e8e5680..905bf38ff 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java @@ -44,12 +44,13 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockArrow extends AbstractTextBlock implements TextBlock { private final double size; private final Direction arrow; - private final HtmlColor color; + private final HColor color; public TextBlockArrow(Direction arrow, FontConfiguration fontConfiguration) { if (arrow == null) { diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java b/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java index 3f5527b80..0ccfcdaba 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java @@ -45,12 +45,13 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockBordered extends AbstractTextBlock implements TextBlock { private final double cornersize; - private final HtmlColor backgroundColor; - private final HtmlColor borderColor; + private final HColor backgroundColor; + private final HColor borderColor; private final double marginX; private final double marginY; private final UStroke stroke; @@ -58,7 +59,7 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; - TextBlockBordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, HtmlColor backgroundColor, + TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, double cornersize, double marginX, double marginY) { this.marginX = marginX; this.marginY = marginY; @@ -70,7 +71,7 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock { this.backgroundColor = backgroundColor; } - TextBlockBordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, HtmlColor backgroundColor, + TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, double cornersize) { this(textBlock, stroke, borderColor, backgroundColor, cornersize, 6, 5); } @@ -129,7 +130,7 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock { private Shadowable getPolygonNormal(final StringBounder stringBounder) { final double height = getTextHeight(stringBounder); final double width = getTextWidth(stringBounder); - return new URectangle(width, height, cornersize, cornersize); + return new URectangle(width, height).rounded(cornersize); } } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java b/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java index e8944788d..a7429d6d4 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java @@ -42,14 +42,15 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockGeneric extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; - private final HtmlColor background; - private final HtmlColor border; + private final HColor background; + private final HColor border; - public TextBlockGeneric(TextBlock textBlock, HtmlColor background, HtmlColor border) { + public TextBlockGeneric(TextBlock textBlock, HColor background, HColor border) { this.textBlock = textBlock; this.border = border; this.background = background; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java b/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java index b62f7120f..d26b16a78 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java @@ -79,7 +79,7 @@ public class TextBlockHorizontal extends AbstractTextBlock implements TextBlock final double dy = (dimtotal.getHeight() - dimb.getHeight()) / 2; block.drawU(ug.apply(new UTranslate(x, dy))); } else { - block.drawU(ug.apply(new UTranslate(x, 0))); + block.drawU(ug.apply(UTranslate.dx(x))); } x += dimb.getWidth(); } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java b/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java index 5371a79d8..790979fb7 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock, WithPorts { @@ -75,7 +76,7 @@ public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock, } public void drawU(UGraphic ug) { - final HtmlColor color = ug.getParam().getColor(); + final HColor color = ug.getParam().getColor(); if (title == null) { UHorizontalLine.infinite(1, 1, separator).drawMe(ug); } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java b/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java index 81777a47f..e05f07e52 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java @@ -64,7 +64,7 @@ class TextBlockMinWidth extends AbstractTextBlock implements TextBlock { } else if (horizontalAlignment == HorizontalAlignment.RIGHT) { final Dimension2D dim = textBlock.calculateDimension(ug.getStringBounder()); final double diffx = minWidth - dim.getWidth(); - textBlock.drawU(ug.apply(new UTranslate(diffx, 0))); + textBlock.drawU(ug.apply(UTranslate.dx(diffx))); } else { throw new UnsupportedOperationException(); } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java b/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java index af94867cf..0fb2a9aea 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java @@ -87,7 +87,7 @@ public class TextBlockRaw extends AbstractTextBlock implements TextBlock { double y = 0; for (Line line : getLines(ug.getStringBounder())) { - line.drawU(ug.apply(new UTranslate(0, y))); + line.drawU(ug.apply(UTranslate.dy(y))); y += line.calculateDimension(ug.getStringBounder()).getHeight(); } } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java b/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java index 397d24716..4619e659b 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockRecentred extends AbstractTextBlock implements TextBlockBackcolored { @@ -77,7 +78,7 @@ public class TextBlockRecentred extends AbstractTextBlock implements TextBlockBa return minMax.getDimension(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { if (textBlock instanceof TextBlockBackcolored) { return ((TextBlockBackcolored) textBlock).getBackcolor(); } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java b/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java index 13b17c208..d215cead1 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java @@ -71,7 +71,7 @@ public class TextBlockSprited extends AbstractTextBlock { final double widthCircledCharacter = getCircledCharacterWithAndMargin(stringBounder); - parent.drawU(ug.apply(new UTranslate(widthCircledCharacter, 0))); + parent.drawU(ug.apply(UTranslate.dx(widthCircledCharacter))); } } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java b/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java index 9092c74a4..6926d9a2e 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java @@ -63,7 +63,7 @@ public class TextBlockTitle implements TextBlock { } public final void drawU(UGraphic ug) { - textBlock.drawU(ug.apply(new UTranslate(outMargin, 0))); + textBlock.drawU(ug.apply(UTranslate.dx(outMargin))); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java b/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java index e905f01cb..9564124e9 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java @@ -62,16 +62,18 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TextBlockUtils { - public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, - HtmlColor backgroundColor, double cornersize) { + public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, + HColor backgroundColor, double cornersize) { return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize); } - public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, - HtmlColor backgroundColor, double cornersize, double marginX, double marginY) { + public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, + HColor backgroundColor, double cornersize, double marginX, double marginY) { return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, marginX, marginY); } @@ -81,8 +83,8 @@ public class TextBlockUtils { } UStroke stroke = skinParam.getThickness(LineParam.titleBorder, null); final Rose rose = new Rose(); - HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.titleBorder); - final HtmlColor backgroundColor = rose.getHtmlColor(skinParam, ColorParam.titleBackground); + HColor borderColor = rose.getHtmlColor(skinParam, ColorParam.titleBorder); + final HColor backgroundColor = rose.getHtmlColor(skinParam, ColorParam.titleBackground); final TextBlockTitle result = new TextBlockTitle(font, stringsToDisplay, skinParam); if (stroke == null && borderColor == null) { return result; @@ -91,7 +93,7 @@ public class TextBlockUtils { stroke = new UStroke(1.5); } if (borderColor == null) { - borderColor = HtmlColorUtils.BLACK; + borderColor = HColorUtils.BLACK; } final double corner = skinParam.getRoundCorner(CornerParam.titleBorder, null); return withMargin(bordered(result, stroke, borderColor, backgroundColor, corner), 2, 2); @@ -203,7 +205,7 @@ public class TextBlockUtils { }; } - public static TextBlockBackcolored addBackcolor(final TextBlock text, final HtmlColor backColor) { + public static TextBlockBackcolored addBackcolor(final TextBlock text, final HColor backColor) { return new TextBlockBackcolored() { public void drawU(UGraphic ug) { text.drawU(ug); @@ -221,7 +223,7 @@ public class TextBlockUtils { return text.calculateDimension(stringBounder); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } }; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java b/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java index aa24b44e3..bf5b45877 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock, WithPorts { @@ -86,14 +87,14 @@ public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock, for (TextBlock block : blocks) { final Dimension2D dimb = block.calculateDimension(ug.getStringBounder()); if (block instanceof TextBlockBackcolored) { - final HtmlColor back = ((TextBlockBackcolored) block).getBackcolor(); + final HColor back = ((TextBlockBackcolored) block).getBackcolor(); if (back != null) { - ug.apply(new UTranslate(0, y)).apply(new UChangeColor(back)).apply(new UChangeBackColor(back)) + ug.apply(UTranslate.dy(y)).apply(new UChangeColor(back)).apply(new UChangeBackColor(back)) .draw(new URectangle(dimtotal.getWidth(), dimb.getHeight())); } } if (horizontalAlignment == HorizontalAlignment.LEFT) { - block.drawU(ug.apply(new UTranslate(0, y))); + block.drawU(ug.apply(UTranslate.dy(y))); } else if (horizontalAlignment == HorizontalAlignment.CENTER) { final double dx = (dimtotal.getWidth() - dimb.getWidth()) / 2; block.drawU(ug.apply(new UTranslate(dx, y))); @@ -127,7 +128,7 @@ public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock, final Dimension2D dimb = block.calculateDimension(stringBounder); final Rectangle2D result = block.getInnerPosition(member, stringBounder, strategy); if (result != null) { - return new UTranslate(0, y).apply(result); + return UTranslate.dy(y).apply(result); } y += dimb.getHeight(); } diff --git a/src/net/sourceforge/plantuml/graphic/TileImage.java b/src/net/sourceforge/plantuml/graphic/TileImage.java index eeacf8332..e92e98018 100644 --- a/src/net/sourceforge/plantuml/graphic/TileImage.java +++ b/src/net/sourceforge/plantuml/graphic/TileImage.java @@ -61,7 +61,7 @@ public class TileImage extends AbstractTextBlock implements TextBlock { } public void drawU(UGraphic ug) { - ug.apply(new UTranslate(0, vspace)).draw(new UImage(image)); + ug.apply(UTranslate.dy(vspace)).draw(new UImage(image)); } } diff --git a/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java b/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java index 4efcf972d..09886f0fb 100644 --- a/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java +++ b/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java @@ -36,10 +36,10 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public abstract class UGraphicDelegator implements UGraphic { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java index 740a23256..93139e8bb 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java @@ -55,7 +55,7 @@ class USymbolArtifact extends USymbol { private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, double roundCorner) { - final URectangle form = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); if (shadowing) { form.setDeltaShadow(4); } @@ -80,8 +80,8 @@ class USymbolArtifact extends USymbol { final double ySymbol = 5; ug.apply(new UTranslate(xSymbol, ySymbol)).draw(polygon); - ug.apply(new UTranslate(xSymbol + widthSymbol - cornersize, ySymbol)).draw(new ULine(0, cornersize)); - ug.apply(new UTranslate(xSymbol + widthSymbol, ySymbol + cornersize)).draw(new ULine(-cornersize, 0)); + ug.apply(new UTranslate(xSymbol + widthSymbol - cornersize, ySymbol)).draw(ULine.vline(cornersize)); + ug.apply(new UTranslate(xSymbol + widthSymbol, ySymbol + cornersize)).draw(ULine.hline(-cornersize)); } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCard.java b/src/net/sourceforge/plantuml/graphic/USymbolCard.java index 660baa97d..22edd39d0 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCard.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCard.java @@ -57,13 +57,13 @@ class USymbolCard extends USymbol { } private void drawCard(UGraphic ug, double width, double height, boolean shadowing, double top, double roundCorner) { - final URectangle shape = new URectangle(width, height, roundCorner, roundCorner); + final URectangle shape = new URectangle(width, height).rounded(roundCorner); if (shadowing) { shape.setDeltaShadow(3.0); } ug.draw(shape); if (top != 0) { - ug.apply(new UTranslate(0, top)).draw(new ULine(width, 0)); + ug.apply(UTranslate.dy(top)).draw(ULine.hline(width)); } } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java index 2a1984ff1..bed4330ec 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java @@ -67,7 +67,7 @@ class USymbolCloud extends USymbol { if (shadowing) { // shape.setDeltaShadow(3.0); } - ug.apply(new UTranslate(0, 0)).draw(shape); + ug.apply(UTranslate.dy(0)).draw(shape); } private UPath getSpecificFrontierForCloudNew(double width, double height) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCollections.java b/src/net/sourceforge/plantuml/graphic/USymbolCollections.java index 107b12cb9..5e86c1de2 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCollections.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCollections.java @@ -65,14 +65,14 @@ class USymbolCollections extends USymbol { } private void drawCollections(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { - final URectangle small = new URectangle(width - getDeltaCollection(), height - getDeltaCollection(), - roundCorner, roundCorner); + final URectangle small = new URectangle(width - getDeltaCollection(), height - getDeltaCollection()) + .rounded(roundCorner); if (shadowing) { small.setDeltaShadow(3.0); } ug.apply(new UTranslate(getDeltaCollection(), getDeltaCollection())).draw(small); small.setDeltaShadow(0); - ug.apply(new UTranslate(0, 0)).draw(small); + ug.apply(UTranslate.dy(0)).draw(small); } private Margin getMargin() { @@ -96,8 +96,8 @@ class USymbolCollections extends USymbol { symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment); - tb.drawU(ug.apply(new UTranslate(margin.getX1() - getDeltaCollection() / 2, margin.getY1() - - getDeltaCollection() / 2))); + tb.drawU(ug.apply(new UTranslate(margin.getX1() - getDeltaCollection() / 2, + margin.getY1() - getDeltaCollection() / 2))); } public Dimension2D calculateDimension(StringBounder stringBounder) { @@ -110,7 +110,8 @@ class USymbolCollections extends USymbol { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java index ff769dd5b..734dee677 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java @@ -55,7 +55,7 @@ class USymbolComponent1 extends USymbol { private void drawComponent1(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, double roundCorner) { - final URectangle form = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); if (shadowing) { form.setDeltaShadow(4); } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java index f38dced23..868559b01 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java @@ -55,7 +55,7 @@ class USymbolComponent2 extends USymbol { private void drawComponent2(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, double roundCorner) { - final URectangle form = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); if (shadowing) { form.setDeltaShadow(4); } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java index 1a8b8a601..be0537d33 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java @@ -98,9 +98,9 @@ class USymbolDatabase extends USymbol { protected void drawHline(UGraphic ug, UHorizontalLine line, UTranslate translate) { final UPath closing = getClosingPath(endingX); ug = ug.apply(translate); - ug.apply(line.getStroke()).apply(new UChangeBackColor(null)).apply(new UTranslate(0, -15)).draw(closing); + ug.apply(line.getStroke()).apply(new UChangeBackColor(null)).apply(UTranslate.dy(-15)).draw(closing); if (line.isDouble()) { - ug.apply(line.getStroke()).apply(new UChangeBackColor(null)).apply(new UTranslate(0, -15 + 2)) + ug.apply(line.getStroke()).apply(new UChangeBackColor(null)).apply(UTranslate.dy(-15 + 2)) .draw(closing); } line.drawTitleInternal(ug, 0, endingX, 0, true); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java index ca55ebe8d..a3df8c8ab 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java @@ -115,7 +115,7 @@ public class USymbolFolder extends USymbol { shape.setDeltaShadow(3.0); } ug.draw(shape); - ug.apply(new UTranslate(0, htitle)).draw(new ULine(wtitle + marginTitleX3, 0)); + ug.apply(UTranslate.dy(htitle)).draw(ULine.hline(wtitle + marginTitleX3)); } private double getHTitle(Dimension2D dimTitle) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java index adb26d7e2..5577c1ebf 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java @@ -55,8 +55,7 @@ class USymbolFrame extends USymbol { private void drawFrame(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing, double roundCorner) { - final URectangle shape = new URectangle(width, height, roundCorner, roundCorner); - shape.setIgnoreForCompression(true); + final URectangle shape = new URectangle(width, height).rounded(roundCorner).ignoreForCompression(); if (shadowing) { shape.setDeltaShadow(3.0); } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolLabel.java b/src/net/sourceforge/plantuml/graphic/USymbolLabel.java index 5a315acdd..08df00461 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolLabel.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolLabel.java @@ -38,11 +38,8 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; -import net.sourceforge.plantuml.ugraphic.UPath; -import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolNode.java b/src/net/sourceforge/plantuml/graphic/USymbolNode.java index ac04800e0..36d87b778 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolNode.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolNode.java @@ -79,8 +79,8 @@ class USymbolNode extends USymbol { ug.draw(shape); ug.apply(new UTranslate(width - 10, 10)).draw(new ULine(9, -9)); - ug.apply(new UTranslate(0, 10)).draw(new ULine(width - 10, 0)); - ug.apply(new UTranslate(width - 10, 10)).draw(new ULine(0, height - 10)); + ug.apply(UTranslate.dy(10)).draw(ULine.hline(width - 10)); + ug.apply(new UTranslate(width - 10, 10)).draw(ULine.vline(height - 10)); } @@ -104,15 +104,15 @@ class USymbolNode extends USymbol { drawHlineInternal(ug, line); if (line.isDouble()) { - drawHlineInternal(ug.apply(new UTranslate(0, 2)), line); + drawHlineInternal(ug.apply(UTranslate.dy(2)), line); } line.drawTitleInternal(ug, 0, endingX - 10, 0, true); } private void drawHlineInternal(UGraphic ug, UHorizontalLine line) { ug = ug.apply(line.getStroke()).apply(new UChangeBackColor(null)); - ug.draw(new ULine(endingX - 10, 0)); - ug.apply(new UTranslate(endingX - 10, 0)).draw(new ULine(10, -10)); + ug.draw(ULine.hline(endingX - 10)); + ug.apply(UTranslate.dx(endingX - 10)).draw(new ULine(10, -10)); } } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolRect.java b/src/net/sourceforge/plantuml/graphic/USymbolRect.java index 4b72f0a55..aeaa20d22 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolRect.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolRect.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; -import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -61,28 +60,15 @@ class USymbolRect extends USymbol { private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner, double diagonalCorner) { - final Shadowable shape = diagonalCorner > 0 ? getDiagonalShape(width, height, diagonalCorner) : new URectangle( - width, height, roundCorner, roundCorner); + final URectangle rect = new URectangle(width, height); + final Shadowable shape = diagonalCorner > 0 ? rect.diagonalCorner(diagonalCorner) + : rect.rounded(roundCorner); if (shadowing) { shape.setDeltaShadow(3.0); } ug.draw(shape); } - private Shadowable getDiagonalShape(double width, double height, double diagonalCorner) { - final UPath result = new UPath(); - result.moveTo(diagonalCorner, 0); - result.lineTo(width - diagonalCorner, 0); - result.lineTo(width, diagonalCorner); - result.lineTo(width, height - diagonalCorner); - result.lineTo(width - diagonalCorner, height); - result.lineTo(diagonalCorner, height); - result.lineTo(0, height - diagonalCorner); - result.lineTo(0, diagonalCorner); - result.lineTo(diagonalCorner, 0); - return result; - } - private Margin getMargin() { return new Margin(10, 10, 10, 10); } @@ -113,7 +99,8 @@ class USymbolRect extends USymbol { @Override public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java index 00bd65aab..a7665cc90 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java @@ -39,8 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UGraphicStencil; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; abstract class USymbolSimpleAbstract extends USymbol { @@ -73,7 +71,7 @@ abstract class USymbolSimpleAbstract extends USymbol { label.drawU(ug.apply(new UTranslate(labelX, labelY))); final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2; - stereotype.drawU(ug.apply(new UTranslate(stereoX, 0))); + stereotype.drawU(ug.apply(UTranslate.dx(stereoX))); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolStack.java b/src/net/sourceforge/plantuml/graphic/USymbolStack.java index f00bfb434..5221412ab 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolStack.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolStack.java @@ -57,11 +57,11 @@ class USymbolStack extends USymbol { private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { final double border = 15; - final URectangle rect = new URectangle(width - 2 * border, height, roundCorner, roundCorner); + final URectangle rect = new URectangle(width - 2 * border, height).rounded(roundCorner); if (shadowing) { rect.setDeltaShadow(3.0); } - ug.apply(new UChangeColor(null)).apply(new UTranslate(border, 0)).draw(rect); + ug.apply(new UChangeColor(null)).apply(UTranslate.dx(border)).draw(rect); final UPath path = new UPath(); if (roundCorner == 0) { path.moveTo(0, 0); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java index 05817599b..8b07ba919 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java @@ -52,7 +52,7 @@ class USymbolStorage extends USymbol { } private void drawStorage(UGraphic ug, double width, double height, boolean shadowing) { - final URectangle shape = new URectangle(width, height, 70, 70); + final URectangle shape = new URectangle(width, height).rounded(70); if (shadowing) { shape.setDeltaShadow(3.0); } @@ -88,7 +88,8 @@ class USymbolStorage extends USymbol { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java index 0043dac64..37733a465 100644 --- a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java +++ b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java @@ -37,7 +37,7 @@ package net.sourceforge.plantuml.graphic.color; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ColorParser { @@ -56,7 +56,7 @@ public class ColorParser { this.mainType = mainType; } - public Colors getColor(RegexResult arg, IHtmlColorSet set) { + public Colors getColor(RegexResult arg, HColorSet set) { if (mainType == null) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/graphic/color/Colors.java b/src/net/sourceforge/plantuml/graphic/color/Colors.java index 2fd5f1335..fb1ff4768 100644 --- a/src/net/sourceforge/plantuml/graphic/color/Colors.java +++ b/src/net/sourceforge/plantuml/graphic/color/Colors.java @@ -46,14 +46,14 @@ import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class Colors { - private final Map map = new EnumMap(ColorType.class); + private final Map map = new EnumMap(ColorType.class); private LinkStyle lineStyle = null; private Boolean shadowing = null; @@ -80,7 +80,7 @@ public class Colors { private Colors() { } - public Colors(String data, IHtmlColorSet set, ColorType mainType) { + public Colors(String data, HColorSet set, ColorType mainType) { data = StringUtils.goLowerCase(data); for (final StringTokenizer st = new StringTokenizer(data, "#;"); st.hasMoreTokens();) { @@ -97,7 +97,7 @@ public class Colors { this.shadowing = value.equalsIgnoreCase("true"); } else { final ColorType key = ColorType.getType(name); - final HtmlColor color = set.getColorIfValid(value); + final HColor color = set.getColorIfValid(value); map.put(key, color); } } @@ -111,15 +111,15 @@ public class Colors { } } - public HtmlColor getColor(ColorType key) { + public HColor getColor(ColorType key) { if (key == null) { throw new IllegalArgumentException(); } return map.get(key); } - public HtmlColor getColor(ColorType key1, ColorType key2) { - final HtmlColor result = getColor(key1); + public HColor getColor(ColorType key1, ColorType key2) { + final HColor result = getColor(key1); if (result != null) { return result; } @@ -139,7 +139,7 @@ public class Colors { // return result; // } - public Colors add(ColorType type, HtmlColor color) { + public Colors add(ColorType type, HColor color) { if (color == null) { return this; } @@ -214,7 +214,7 @@ public class Colors { if (getColor(colorType) != null) { return this; } - final HtmlColor col = skinParam.getFontHtmlColor(stereotype, param); + final HColor col = skinParam.getFontHtmlColor(stereotype, param); return add(colorType, col); } diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java index 637f77eea..b7f39673f 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java @@ -50,8 +50,6 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; import net.sourceforge.plantuml.svek.GeneralImageBuilder; @@ -63,6 +61,8 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic2; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class CucaDiagramFileMakerHectorB1 implements CucaDiagramFileMaker { @@ -144,7 +144,7 @@ public class CucaDiagramFileMakerHectorB1 implements CucaDiagramFileMaker { final double x = getX(pin); final double y = getY(pin); final UEllipse circle = new UEllipse(6, 6); - ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)) + ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(HColorUtils.BLACK)) .apply(new UTranslate(x - 3, y - 3)).draw(circle); } @@ -155,7 +155,7 @@ public class CucaDiagramFileMakerHectorB1 implements CucaDiagramFileMaker { final double y2 = getY(pinLink.getPin2()); final Rose rose = new Rose(); - final HtmlColor color = rose.getHtmlColor(diagram.getSkinParam(), ColorParam.arrow); + final HColor color = rose.getHtmlColor(diagram.getSkinParam(), ColorParam.arrow); final List b = new ArrayList(); final SmartConnection connection = new SmartConnection(x1, y1, x2, y2, b); connection.draw(ug, color); diff --git a/src/net/sourceforge/plantuml/hector/HectorPath.java b/src/net/sourceforge/plantuml/hector/HectorPath.java index 8cd0a11a1..be12686f4 100644 --- a/src/net/sourceforge/plantuml/hector/HectorPath.java +++ b/src/net/sourceforge/plantuml/hector/HectorPath.java @@ -40,10 +40,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.geom.LineSegmentDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class HectorPath { @@ -62,7 +62,7 @@ public class HectorPath { return segments.toString(); } - public void draw(UGraphic ug, HtmlColor color) { + public void draw(UGraphic ug, HColor color) { ug = ug.apply(new UChangeColor(color)).apply(new UStroke(1.5)); for (LineSegmentDouble seg : segments) { seg.draw(ug); diff --git a/src/net/sourceforge/plantuml/hector/SmartConnection.java b/src/net/sourceforge/plantuml/hector/SmartConnection.java index d90a0032f..953781063 100644 --- a/src/net/sourceforge/plantuml/hector/SmartConnection.java +++ b/src/net/sourceforge/plantuml/hector/SmartConnection.java @@ -39,12 +39,12 @@ import java.awt.geom.Point2D; import java.util.List; import net.sourceforge.plantuml.geom.LineSegmentDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class SmartConnection { @@ -66,11 +66,11 @@ class SmartConnection { this(p1.getX(), p1.getY(), p2.getX(), p2.getY(), b); } - public void draw(UGraphic ug, HtmlColor color) { + public void draw(UGraphic ug, HColor color) { final LineSegmentDouble seg = new LineSegmentDouble(x1, y1, x2, y2); boolean clash = intersect(seg); if (clash) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UStroke(1.0)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UStroke(1.0)); } else { ug = ug.apply(new UChangeColor(color)).apply(new UStroke(1.5)); } @@ -86,7 +86,7 @@ class SmartConnection { return false; } - public void drawEx1(UGraphic ug, HtmlColor color) { + public void drawEx1(UGraphic ug, HColor color) { ug = ug.apply(new UChangeColor(color)).apply(new UStroke(1.5)); final double orthoX = -(y2 - y1); final double orthoY = x2 - x1; diff --git a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java index 63a57fb22..953f9dd21 100644 --- a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java +++ b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java @@ -84,7 +84,7 @@ public class Foo2 extends AbstractTextBlock implements TextBlock { final Dimension2D cell = getMaxCellDimension(stringBounder); for (Layer layer : distribution.getLayers()) { drawLayer(ug, layer, cell.getWidth(), cell.getHeight()); - ug = ug.apply(new UTranslate(0, cell.getHeight())); + ug = ug.apply(UTranslate.dy(cell.getHeight())); } } diff --git a/src/net/sourceforge/plantuml/help/CommandHelpColor.java b/src/net/sourceforge/plantuml/help/CommandHelpColor.java index 2789b4583..16a34e064 100644 --- a/src/net/sourceforge/plantuml/help/CommandHelpColor.java +++ b/src/net/sourceforge/plantuml/help/CommandHelpColor.java @@ -42,7 +42,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandHelpColor extends SingleLineCommand2 { @@ -65,7 +65,7 @@ public class CommandHelpColor extends SingleLineCommand2 { diagram.add("You may improve it on https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help"); diagram.add(" "); diagram.add(" The possible colors are :"); - for (String type : new HtmlColorSetSimple().names()) { + for (String type : HColorSet.instance().names()) { diagram.add("* " + type); } diff --git a/src/net/sourceforge/plantuml/help/Help.java b/src/net/sourceforge/plantuml/help/Help.java index a87545e0d..4a9571420 100644 --- a/src/net/sourceforge/plantuml/help/Help.java +++ b/src/net/sourceforge/plantuml/help/Help.java @@ -52,9 +52,9 @@ import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class Help extends UmlDiagram { diff --git a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java index c5fde0062..99673f703 100644 --- a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java +++ b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java @@ -86,7 +86,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.QuoteUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -108,6 +107,7 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import smetana.core.CString; import smetana.core.JUtils; import smetana.core.JUtilsDebug; diff --git a/src/net/sourceforge/plantuml/jdot/JDotPath.java b/src/net/sourceforge/plantuml/jdot/JDotPath.java index fa35e8daf..ffdc0bec7 100644 --- a/src/net/sourceforge/plantuml/jdot/JDotPath.java +++ b/src/net/sourceforge/plantuml/jdot/JDotPath.java @@ -48,8 +48,6 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -61,6 +59,8 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import smetana.core.Macro; public class JDotPath implements UDrawable { @@ -102,10 +102,10 @@ public class JDotPath implements UDrawable { public void drawU(UGraphic ug) { - HtmlColor color = rose.getHtmlColor(diagram.getSkinParam(), null, getArrowColorParam()); + HColor color = rose.getHtmlColor(diagram.getSkinParam(), null, getArrowColorParam()); if (this.link.getColors() != null) { - final HtmlColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); + final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); if (newColor != null) { color = newColor; } @@ -136,7 +136,7 @@ public class JDotPath implements UDrawable { } private void printDebug(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(HtmlColorUtils.BLUE)); + ug = ug.apply(new UChangeColor(HColorUtils.BLUE)).apply(new UChangeBackColor(HColorUtils.BLUE)); final ST_splines splines = getSplines(edge); final ST_bezier beziers = splines.list.getPtr(); for (int i = 0; i < beziers.size; i++) { @@ -147,7 +147,7 @@ public class JDotPath implements UDrawable { ug.apply(new UTranslate(pt).compose(new UTranslate(-1, -1))).draw(new UEllipse(3, 3)); } if (getLabelRectangleTranslate("label") != null && getLabelURectangle() != null) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(null)); + ug = ug.apply(new UChangeColor(HColorUtils.BLUE)).apply(new UChangeBackColor(null)); ug.apply(getLabelRectangleTranslate("label")).draw(getLabelURectangle()); } diff --git a/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java b/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java index 921b14052..c3e94608c 100644 --- a/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java +++ b/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java @@ -40,12 +40,12 @@ import java.util.Arrays; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GTileLeftRight extends AbstractTextBlock implements GTile { @@ -67,11 +67,11 @@ public class GTileLeftRight extends AbstractTextBlock implements GTile { final Dimension2D dimTotal = calculateDimension(stringBounder); final double deltaH1 = dimTotal.getHeight() - dimLeft.getHeight(); final double deltaH2 = dimTotal.getHeight() - dimRight.getHeight(); - left.drawU(ug.apply(new UTranslate(0, deltaH1 / 2))); + left.drawU(ug.apply(UTranslate.dy(deltaH1 / 2))); final double dx2 = dimLeft.getWidth() + space; right.drawU(ug.apply(new UTranslate(dx2, deltaH2 / 2))); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); final double step = dimLeft.getHeight() / (dimRight.getWestPositions().size() + 1); double ystart = step + deltaH1 / 2; for (Double w2 : dimRight.getWestPositions()) { @@ -89,7 +89,7 @@ public class GTileLeftRight extends AbstractTextBlock implements GTile { path.lineTo(x1 + step, y1); path.lineTo(x2 - step, y2); path.lineTo(x2, y2); - ug.apply(new UTranslate(0, 0)).draw(path); + ug.apply(UTranslate.dy(0)).draw(path); } public GTileGeometry calculateDimension(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/jungle/GTileNode.java b/src/net/sourceforge/plantuml/jungle/GTileNode.java index ada8adbe1..c7278456a 100644 --- a/src/net/sourceforge/plantuml/jungle/GTileNode.java +++ b/src/net/sourceforge/plantuml/jungle/GTileNode.java @@ -49,8 +49,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -59,6 +57,8 @@ import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GTileNode extends AbstractTextBlock implements GTile { @@ -68,14 +68,14 @@ public class GTileNode extends AbstractTextBlock implements GTile { final Display display = node.getDisplay(); final SheetBlock1 sheetBlock1 = getTextBlock(display); - final SymbolContext symbolContext = new SymbolContext(HtmlColorUtils.MY_YELLOW, HtmlColorUtils.BLACK); + final SymbolContext symbolContext = new SymbolContext(HColorUtils.MY_YELLOW, HColorUtils.BLACK); tb = USymbol.RECTANGLE.asSmall(null, sheetBlock1, TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER); } public static SheetBlock1 getTextBlock(final Display display) { final Rose rose = new Rose(); final SkinParam skinParam = SkinParam.create(null); - final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); + final HColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); final UFont fontNote = skinParam.getFont(null, false, FontParam.NOTE); final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); diff --git a/src/net/sourceforge/plantuml/jungle/GTileStack.java b/src/net/sourceforge/plantuml/jungle/GTileStack.java index 19b572f66..3528cf53a 100644 --- a/src/net/sourceforge/plantuml/jungle/GTileStack.java +++ b/src/net/sourceforge/plantuml/jungle/GTileStack.java @@ -61,7 +61,7 @@ public class GTileStack extends AbstractTextBlock implements GTile { for (GTile tile : tiles) { tile.drawU(ug); final Dimension2D dim = tile.calculateDimension(ug.getStringBounder()); - ug = ug.apply(new UTranslate(0, dim.getHeight() + space)); + ug = ug.apply(UTranslate.dy(dim.getHeight() + space)); } } diff --git a/src/net/sourceforge/plantuml/jungle/Needle.java b/src/net/sourceforge/plantuml/jungle/Needle.java index e06417921..308b3bcdc 100644 --- a/src/net/sourceforge/plantuml/jungle/Needle.java +++ b/src/net/sourceforge/plantuml/jungle/Needle.java @@ -38,12 +38,12 @@ package net.sourceforge.plantuml.jungle; import java.util.List; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Needle implements UDrawable { @@ -106,7 +106,7 @@ public class Needle implements UDrawable { final UDrawable n1 = needle0.addChildren(root.getChildren()); return new UDrawable() { public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); n1.drawU(ug); } }; diff --git a/src/net/sourceforge/plantuml/jungle/PSystemTree.java b/src/net/sourceforge/plantuml/jungle/PSystemTree.java index 2ecba4262..aca8e052e 100644 --- a/src/net/sourceforge/plantuml/jungle/PSystemTree.java +++ b/src/net/sourceforge/plantuml/jungle/PSystemTree.java @@ -45,12 +45,12 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawableUtils; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.LimitFinder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemTree extends AbstractPSystem { @@ -65,7 +65,7 @@ public class PSystemTree extends AbstractPSystem { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, null, null, + final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, null, null, 5, 5, null, false); if (rendering == Rendering.NEEDLE) { final UDrawable tmp = Needle.getNeedle(root, 200, 0, 60); diff --git a/src/net/sourceforge/plantuml/logo/PSystemLogo.java b/src/net/sourceforge/plantuml/logo/PSystemLogo.java index d275bf7a4..996d288f9 100644 --- a/src/net/sourceforge/plantuml/logo/PSystemLogo.java +++ b/src/net/sourceforge/plantuml/logo/PSystemLogo.java @@ -49,8 +49,8 @@ import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.png.PngIO; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; public class PSystemLogo extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java b/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java index 389b52486..d68402f8d 100644 --- a/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java +++ b/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java @@ -38,8 +38,8 @@ package net.sourceforge.plantuml.logo; import java.util.HashMap; import java.util.Map; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class TinyJavaLogo { private final LogoScanner scanner = new LogoScanner(); @@ -47,7 +47,7 @@ public class TinyJavaLogo { private final TurtleGraphicsPane turtleGraphicsPane; private final Map dictionary = new HashMap(); - private HtmlColor penColor; + private HColor penColor; public TinyJavaLogo(TurtleGraphicsPane turtleGraphicsPane) { this.turtleGraphicsPane = turtleGraphicsPane; @@ -191,7 +191,7 @@ public class TinyJavaLogo { case LogoToken.SETPC: token = scanner.getToken(); - final HtmlColor newPenColor = new HtmlColorSetSimple().getColorIfValid(token.lexeme); + final HColor newPenColor = HColorSet.instance().getColorIfValid(token.lexeme); if (newPenColor == null) { error("Unrecognized color name"); return; diff --git a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java index 6510bdcf9..9b3ab1069 100644 --- a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java +++ b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java @@ -45,10 +45,6 @@ import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -57,6 +53,9 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class TurtleGraphicsPane { final private double width; @@ -66,9 +65,9 @@ class TurtleGraphicsPane { private double turtleDirection = 90; private boolean penIsDown = true; private boolean showTurtle = true; - private HtmlColor penColor = HtmlColorUtils.BLACK; + private HColor penColor = HColorUtils.BLACK; private List lines = new ArrayList(); - private List colors = new ArrayList(); + private List colors = new ArrayList(); private String message; @@ -121,9 +120,9 @@ class TurtleGraphicsPane { final double angle = -dtor(turtleDirection - 90); poly.rotate(angle); // ug.setAntiAliasing(false); - final IHtmlColorSet htmlColorSet = new HtmlColorSetSimple(); - final HtmlColor turtleColor1 = htmlColorSet.getColorIfValid("OliveDrab"); - final HtmlColor turtleColor2 = htmlColorSet.getColorIfValid("MediumSpringGreen"); + final HColorSet htmlColorSet = HColorSet.instance(); + final HColor turtleColor1 = htmlColorSet.getColorIfValid("OliveDrab"); + final HColor turtleColor2 = htmlColorSet.getColorIfValid("MediumSpringGreen"); ug.apply(new UChangeColor(turtleColor1)).apply(new UChangeBackColor(turtleColor2)).apply(new UTranslate(x, -y)) .draw(poly); @@ -138,7 +137,7 @@ class TurtleGraphicsPane { showTurtle = false; } - public void setPenColor(HtmlColor newPenColor) { + public void setPenColor(HColor newPenColor) { penColor = newPenColor; } @@ -191,7 +190,7 @@ class TurtleGraphicsPane { int n = lines.size(); for (int i = 0; i < n; i++) { - final HtmlColor color = colors.get(i); + final HColor color = colors.get(i); final Rectangle2D.Double r = lines.get(i); final ULine line = new ULine(r.width - r.x, -r.height + r.y); ug.apply(new UChangeColor(color)).apply(new UTranslate(r.x, -r.y)).draw(line); @@ -204,7 +203,7 @@ class TurtleGraphicsPane { new SpriteContainerEmpty()); final Dimension2D dim = text.calculateDimension(ug.getStringBounder()); final double textHeight = dim.getHeight(); - text.drawU(ug.apply(new UTranslate(0, (height - textHeight)))); + text.drawU(ug.apply(UTranslate.dy((height - textHeight)))); } } diff --git a/src/net/sourceforge/plantuml/math/PSystemMath.java b/src/net/sourceforge/plantuml/math/PSystemMath.java index 8419111e7..caed05628 100644 --- a/src/net/sourceforge/plantuml/math/PSystemMath.java +++ b/src/net/sourceforge/plantuml/math/PSystemMath.java @@ -44,9 +44,9 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class PSystemMath extends AbstractPSystem { @@ -110,7 +110,7 @@ public class PSystemMath extends AbstractPSystem { } private Color getColor(final String col) { - final HtmlColor col2 = new HtmlColorSetSimple().getColorIfValid(col); + final HColor col2 = HColorSet.instance().getColorIfValid(col); final Color col3 = new ColorMapperIdentity().getMappedColor(col2); return col3; } diff --git a/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java b/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java index 5c803017a..8078528df 100644 --- a/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java +++ b/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java @@ -54,8 +54,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class ScientificEquationSafe { @@ -126,7 +126,7 @@ public class ScientificEquationSafe { private void printTrace(Exception e) { System.err.println("formula=" + formula); - if (formula != null) { + if (equation != null) { System.err.println("Latex=" + equation.getSource()); } e.printStackTrace(); diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java index 0b10a0527..d92641aba 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandMindMapOrgmode extends SingleLineCommand2 { @@ -66,7 +66,7 @@ public class CommandMindMapOrgmode extends SingleLineCommand2 { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); final String stringColor = arg.get("BACKCOLOR", 0); - HtmlColor backColor = null; + HColor backColor = null; if (stringColor != null) { backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor); } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java index b0df57678..c05a2d646 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java @@ -45,7 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandMindMapOrgmodeMultiline extends CommandMultilines2 { @@ -73,7 +73,7 @@ public class CommandMindMapOrgmodeMultiline extends CommandMultilines2 children = new ArrayList(); private final IdeaShape shape; - private final HtmlColor backColor; + private final HColor backColor; private final StyleBuilder styleBuilder; private final String stereotype; - public Idea(StyleBuilder styleBuilder, HtmlColor backColor, Display label, IdeaShape shape, String stereotype) { + public Idea(StyleBuilder styleBuilder, HColor backColor, Display label, IdeaShape shape, String stereotype) { this(styleBuilder, backColor, 0, null, label, shape, stereotype); } - public Idea createIdea(StyleBuilder styleBuilder, HtmlColor backColor, int newLevel, Display newDisplay, + public Idea createIdea(StyleBuilder styleBuilder, HColor backColor, int newLevel, Display newDisplay, IdeaShape newShape, String stereotype) { final Idea result = new Idea(styleBuilder, backColor, newLevel, this, newDisplay, newShape, stereotype); this.children.add(result); return result; } - private Idea(StyleBuilder styleBuilder, HtmlColor backColor, int level, Idea parent, Display label, + private Idea(StyleBuilder styleBuilder, HColor backColor, int level, Idea parent, Display label, IdeaShape shape, String stereotype) { this.backColor = backColor; this.styleBuilder = styleBuilder; @@ -106,7 +106,7 @@ class Idea { return shape; } - public final HtmlColor getBackColor() { + public final HColor getBackColor() { return backColor; } diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java index 5c12e5456..c6472f20d 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -63,6 +62,7 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.wbs.WBSDiagram; public class MindMapDiagram extends UmlDiagram { @@ -134,7 +134,7 @@ public class MindMapDiagram extends UmlDiagram { throw new UnsupportedOperationException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } }; @@ -175,11 +175,11 @@ public class MindMapDiagram extends UmlDiagram { } } - public CommandExecutionResult addIdea(HtmlColor backColor, int level, Display label, IdeaShape shape) { + public CommandExecutionResult addIdea(HColor backColor, int level, Display label, IdeaShape shape) { return addIdea(backColor, level, label, shape, defaultDirection); } - public CommandExecutionResult addIdea(HtmlColor backColor, int level, Display label, IdeaShape shape, + public CommandExecutionResult addIdea(HColor backColor, int level, Display label, IdeaShape shape, Direction direction) { String stereotype = label.getEndingStereotype(); if (stereotype != null) { @@ -205,7 +205,7 @@ public class MindMapDiagram extends UmlDiagram { private Idea last; private Finger finger; - private void initRoot(StyleBuilder styleBuilder, HtmlColor backColor, Display label, IdeaShape shape, String stereotype) { + private void initRoot(StyleBuilder styleBuilder, HColor backColor, Display label, IdeaShape shape, String stereotype) { root = new Idea(styleBuilder, backColor, label, shape, stereotype); last = root; } @@ -218,7 +218,7 @@ public class MindMapDiagram extends UmlDiagram { return result; } - private CommandExecutionResult add(StyleBuilder styleBuilder, HtmlColor backColor, int level, Display label, + private CommandExecutionResult add(StyleBuilder styleBuilder, HColor backColor, int level, Display label, IdeaShape shape, String stereotype) { if (last == null) { return CommandExecutionResult.error("Check your indentation ?"); diff --git a/src/net/sourceforge/plantuml/nwdiag/DiagElement.java b/src/net/sourceforge/plantuml/nwdiag/DiagElement.java index d140ff2cd..ffc5079cc 100644 --- a/src/net/sourceforge/plantuml/nwdiag/DiagElement.java +++ b/src/net/sourceforge/plantuml/nwdiag/DiagElement.java @@ -39,13 +39,13 @@ import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class DiagElement { @@ -79,7 +79,7 @@ public class DiagElement { private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); } public LinkedElement asTextBlock(final String adress1, final String adress2) { diff --git a/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java b/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java index 419b9ab2c..2845654ba 100644 --- a/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java +++ b/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java @@ -37,14 +37,14 @@ package net.sourceforge.plantuml.nwdiag; import java.util.HashSet; import java.util.Set; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DiagGroup { private final String name; private final Network network; private final Set elements = new HashSet(); - private HtmlColor color; + private HColor color; @Override public String toString() { @@ -71,11 +71,11 @@ public class DiagGroup { return elements.contains(tested.getElement().getName()); } - public final HtmlColor getColor() { + public final HColor getColor() { return color; } - public final void setColor(HtmlColor color) { + public final void setColor(HColor color) { this.color = color; } diff --git a/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java b/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java index d7936f80f..67b481f4b 100644 --- a/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java +++ b/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java @@ -36,18 +36,18 @@ package net.sourceforge.plantuml.nwdiag; import java.util.Collection; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class GridTextBlockDecorated extends GridTextBlockSimple { - public static final HtmlColorSetSimple colors = new HtmlColorSetSimple(); + public static final HColorSet colors = HColorSet.instance(); public static final int NETWORK_THIN = 5; @@ -87,7 +87,7 @@ public class GridTextBlockDecorated extends GridTextBlockSimple { y += lineHeight; } if (size != null) { - HtmlColor color = group.getColor(); + HColor color = group.getColor(); if (color == null) { color = colors.getColorIfValid("#AAA"); } diff --git a/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java b/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java index f0388b63f..1964ea494 100644 --- a/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java +++ b/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java @@ -38,7 +38,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.MinMax; @@ -46,6 +45,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class LinkedElement { @@ -90,7 +90,7 @@ public class LinkedElement { drawCenter(ug, box, xMiddle, yMiddle); - final HtmlColor color = ColorParam.activityBorder.getDefaultValue(); + final HColor color = ColorParam.activityBorder.getDefaultValue(); ug = ug.apply(new UChangeColor(color)); drawHLine(ug, xMiddle, GridTextBlockDecorated.NETWORK_THIN, y1); if (ad2 != null) { @@ -110,7 +110,7 @@ public class LinkedElement { } private void drawHLine(UGraphic ug, double x, double y1, double y2) { - final ULine line = new ULine(0, y2 - y1); + final ULine line = ULine.vline(y2 - y1); ug.apply(new UTranslate(x, y1)).draw(line); } diff --git a/src/net/sourceforge/plantuml/nwdiag/Network.java b/src/net/sourceforge/plantuml/nwdiag/Network.java index 46097c328..bc430f197 100644 --- a/src/net/sourceforge/plantuml/nwdiag/Network.java +++ b/src/net/sourceforge/plantuml/nwdiag/Network.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.nwdiag; import java.util.LinkedHashMap; import java.util.Map; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Network { private final String name; private final Map localElements = new LinkedHashMap(); - private HtmlColor color; + private HColor color; private String ownAdress; @@ -92,11 +92,11 @@ public class Network { return name; } - public final HtmlColor getColor() { + public final HColor getColor() { return color; } - public final void setColor(HtmlColor color) { + public final void setColor(HColor color) { this.color = color; } diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java index 745589350..e23decd1a 100644 --- a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java +++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java @@ -57,12 +57,9 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -70,6 +67,9 @@ import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class NwDiagram extends UmlDiagram { @@ -204,7 +204,7 @@ public class NwDiagram extends UmlDiagram { private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); } private void drawMe(UGraphic ug) { @@ -271,7 +271,7 @@ public class NwDiagram extends UmlDiagram { currentNetwork().setOwnAdress(value); } if ("color".equalsIgnoreCase(property)) { - final HtmlColor color = GridTextBlockDecorated.colors.getColorIfValid(value); + final HColor color = GridTextBlockDecorated.colors.getColorIfValid(value); if (currentGroup != null) { currentGroup.setColor(color); } else if (currentNetwork() != null) { diff --git a/src/net/sourceforge/plantuml/openiconic/OpenIcon.java b/src/net/sourceforge/plantuml/openiconic/OpenIcon.java index f0ffd74ad..8c65b8a57 100644 --- a/src/net/sourceforge/plantuml/openiconic/OpenIcon.java +++ b/src/net/sourceforge/plantuml/openiconic/OpenIcon.java @@ -47,12 +47,12 @@ import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.openiconic.data.DummyIcon; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class OpenIcon { @@ -132,7 +132,7 @@ public class OpenIcon { return s.substring(x1 + 1, x2); } - public TextBlock asTextBlock(final HtmlColor color, final double factor) { + public TextBlock asTextBlock(final HColor color, final double factor) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { svgPath.drawMe(ug.apply(new UChangeColor(color)), factor); diff --git a/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java b/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java index a1d49d590..6ed55cd6c 100644 --- a/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java +++ b/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java @@ -48,14 +48,14 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.donors.PSystemDonors; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockHorizontal; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.openiconic.data.DummyIcon; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemListOpenIconic extends AbstractPSystem { @@ -63,7 +63,7 @@ public class PSystemListOpenIconic extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final UDrawable result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, fileFormat.isWithMetadata() ? getMetadata() : null, null, 0, 0, null, false); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); diff --git a/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java b/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java index a45a88176..a2dadef38 100644 --- a/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java +++ b/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java @@ -42,9 +42,9 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemOpenIconic extends AbstractPSystem { @@ -64,7 +64,7 @@ public class PSystemOpenIconic extends AbstractPSystem { final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 5, 5, null, false); - imageBuilder.setUDrawable(icon.asTextBlock(HtmlColorUtils.BLACK, factor)); + imageBuilder.setUDrawable(icon.asTextBlock(HColorUtils.BLACK, factor)); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); // UGraphic2 ug = fileFormat.createUGraphic(dim); diff --git a/src/net/sourceforge/plantuml/oregon/PSystemOregon.java b/src/net/sourceforge/plantuml/oregon/PSystemOregon.java index 754019716..292adb510 100644 --- a/src/net/sourceforge/plantuml/oregon/PSystemOregon.java +++ b/src/net/sourceforge/plantuml/oregon/PSystemOregon.java @@ -47,8 +47,8 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemOregon extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/png/PngTitler.java b/src/net/sourceforge/plantuml/png/PngTitler.java index 54ef49791..1f946ea76 100644 --- a/src/net/sourceforge/plantuml/png/PngTitler.java +++ b/src/net/sourceforge/plantuml/png/PngTitler.java @@ -45,28 +45,28 @@ import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class PngTitler { - private final HtmlColor textColor; - private final HtmlColor hyperlinkColor; + private final HColor textColor; + private final HColor hyperlinkColor; private final DisplaySection text; private final int fontSize; private final String fontFamily; private final boolean useUnderlineForHyperlink; private final Style style; - private final IHtmlColorSet set; + private final HColorSet set; private final ISkinSimple spriteContainer; - public PngTitler(HtmlColor textColor, DisplaySection text, int fontSize, String fontFamily, - HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, Style style, IHtmlColorSet set, + public PngTitler(HColor textColor, DisplaySection text, int fontSize, String fontFamily, + HColor hyperlinkColor, boolean useUnderlineForHyperlink, Style style, HColorSet set, ISkinSimple spriteContainer) { this.style = style; this.set = set; diff --git a/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java b/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java index 4230c5045..546a6769a 100644 --- a/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java +++ b/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java @@ -41,10 +41,10 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.IEntity; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; abstract class AbstractEntityImage2 implements IEntityImageBlock { @@ -71,11 +71,11 @@ abstract class AbstractEntityImage2 implements IEntityImageBlock { return skinParam.getFont(null, false, fontParam); } - protected HtmlColor getFontColor(FontParam fontParam) { + protected HColor getFontColor(FontParam fontParam) { return skinParam.getFontHtmlColor(null, fontParam); } - protected final HtmlColor getColor(ColorParam colorParam) { + protected final HColor getColor(ColorParam colorParam) { return rose.getHtmlColor(skinParam, colorParam); } diff --git a/src/net/sourceforge/plantuml/posimo/Frame.java b/src/net/sourceforge/plantuml/posimo/Frame.java index 4ad680a70..6c9a7f6ca 100644 --- a/src/net/sourceforge/plantuml/posimo/Frame.java +++ b/src/net/sourceforge/plantuml/posimo/Frame.java @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.Area; @@ -59,6 +58,7 @@ import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Frame implements Component { @@ -82,7 +82,7 @@ public class Frame implements Component { public void drawU(UGraphic ug, Area area, Context2D context) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - final HtmlColor lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder); + final HColor lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder); ug = ug.apply(new UChangeColor(lineColor)); ug = ug.apply(new UChangeBackColor(null)); ug.apply(new UStroke(1.4)).draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight())); @@ -120,7 +120,7 @@ public class Frame implements Component { private TextBlock createTextBloc() { final UFont font = skinParam.getFont(null, false, FontParam.PACKAGE); - final HtmlColor textColor = skinParam.getFontHtmlColor(null, FontParam.PACKAGE); + final HColor textColor = skinParam.getFontHtmlColor(null, FontParam.PACKAGE); // final TextBlock bloc = Display.create(name).create(new FontConfiguration(font, textColor, // skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, new // SpriteContainerEmpty()); diff --git a/src/net/sourceforge/plantuml/postit/PostIt.java b/src/net/sourceforge/plantuml/postit/PostIt.java index e1abd32fd..1f3e81b69 100644 --- a/src/net/sourceforge/plantuml/postit/PostIt.java +++ b/src/net/sourceforge/plantuml/postit/PostIt.java @@ -44,9 +44,6 @@ import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.Area; @@ -56,6 +53,9 @@ import net.sourceforge.plantuml.skin.rose.ComponentRoseNote; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PostIt { @@ -110,12 +110,12 @@ public class PostIt { } private Component getComponent() { - final HtmlColor noteBackgroundColor = new HtmlColorSetSimple().getColorIfValid("#FBFB77"); - final HtmlColor borderColor = HtmlColorUtils.MY_RED; + final HColor noteBackgroundColor = HColorSet.instance().getColorIfValid("#FBFB77"); + final HColor borderColor = HColorUtils.MY_RED; final SkinParam param = SkinParam.noShadowing(null); final UFont fontNote = param.getFont(null, false, FontParam.NOTE); - final FontConfiguration font2 = fontNote.toFont2(HtmlColorUtils.BLACK, true, HtmlColorUtils.BLUE, 8); + final FontConfiguration font2 = fontNote.toFont2(HColorUtils.BLACK, true, HColorUtils.BLUE, 8); final ComponentRoseNote note = new ComponentRoseNote( null, new SymbolContext(noteBackgroundColor, borderColor).withStroke(new UStroke()), font2, text, 0, 0, new SpriteContainerEmpty(), 0, HorizontalAlignment.LEFT); diff --git a/src/net/sourceforge/plantuml/postit/PostItDiagram.java b/src/net/sourceforge/plantuml/postit/PostItDiagram.java index 7c047fd64..fcfc9e343 100644 --- a/src/net/sourceforge/plantuml/postit/PostItDiagram.java +++ b/src/net/sourceforge/plantuml/postit/PostItDiagram.java @@ -53,8 +53,8 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.png.PngIO; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; diff --git a/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java b/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java index 1d71937bb..c85ebc784 100644 --- a/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java +++ b/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java @@ -35,9 +35,7 @@ */ package net.sourceforge.plantuml.preproc; -import java.util.Set; - public interface ReadLineNumbered extends ReadLine { - public Set getFilesUsed(); + // public Set getFilesUsedTOBEREMOVED(); } diff --git a/src/net/sourceforge/plantuml/preproc2/Preprocessor.java b/src/net/sourceforge/plantuml/preproc2/Preprocessor.java index cc8b30a34..a81ff1c5f 100644 --- a/src/net/sourceforge/plantuml/preproc2/Preprocessor.java +++ b/src/net/sourceforge/plantuml/preproc2/Preprocessor.java @@ -65,9 +65,9 @@ public class Preprocessor implements ReadLineNumbered { this.source.close(); } - public Set getFilesUsed() { - // System.err.println("************************** WARNING **************************"); - return Collections.emptySet(); - // return Collections.unmodifiableSet(include.getFilesUsedGlobal()); - } +// public Set getFilesUsedTOBEREMOVED() { +// // System.err.println("************************** WARNING **************************"); +// return Collections.emptySet(); +// // return Collections.unmodifiableSet(include.getFilesUsedGlobal()); +// } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/project/ConstantPlan.java b/src/net/sourceforge/plantuml/project/ConstantPlan.java index 0703b2efb..2e7326264 100644 --- a/src/net/sourceforge/plantuml/project/ConstantPlan.java +++ b/src/net/sourceforge/plantuml/project/ConstantPlan.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; public class ConstantPlan implements LoadPlanable { diff --git a/src/net/sourceforge/plantuml/project/DaysAsDates.java b/src/net/sourceforge/plantuml/project/DaysAsDates.java index 612b68c1e..3828f377d 100644 --- a/src/net/sourceforge/plantuml/project/DaysAsDates.java +++ b/src/net/sourceforge/plantuml/project/DaysAsDates.java @@ -39,20 +39,21 @@ import java.util.Iterator; import net.sourceforge.plantuml.project.lang.Complement; import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Day; -public class DaysAsDates implements Subject, Complement, Iterable { +public class DaysAsDates implements Subject, Complement, Iterable { - private final DayAsDate date1; - private final DayAsDate date2; + private final Day date1; + private final Day date2; - public DaysAsDates(DayAsDate date1, DayAsDate date2) { + public DaysAsDates(Day date1, Day date2) { this.date1 = date1; this.date2 = date2; } - public DaysAsDates(GanttDiagram gantt, DayAsDate date1, int count) { + public DaysAsDates(GanttDiagram gantt, Day date1, int count) { this.date1 = date1; - DayAsDate tmp = date1; + Day tmp = date1; while (count > 0) { if (gantt.isOpen(tmp)) { count--; @@ -62,11 +63,11 @@ public class DaysAsDates implements Subject, Complement, Iterable { this.date2 = tmp; } - class MyIterator implements Iterator { + class MyIterator implements Iterator { - private DayAsDate current; + private Day current; - public MyIterator(DayAsDate current) { + public MyIterator(Day current) { this.current = current; } @@ -74,8 +75,8 @@ public class DaysAsDates implements Subject, Complement, Iterable { return current.compareTo(date2) <= 0; } - public DayAsDate next() { - final DayAsDate result = current; + public Day next() { + final Day result = current; current = current.next(); return result; } @@ -86,7 +87,7 @@ public class DaysAsDates implements Subject, Complement, Iterable { } - public Iterator iterator() { + public Iterator iterator() { return new MyIterator(date1); } diff --git a/src/net/sourceforge/plantuml/project/GanttArrow.java b/src/net/sourceforge/plantuml/project/GanttArrow.java index e5390b1c3..a2654d9b7 100644 --- a/src/net/sourceforge/plantuml/project/GanttArrow.java +++ b/src/net/sourceforge/plantuml/project/GanttArrow.java @@ -36,12 +36,10 @@ package net.sourceforge.plantuml.project; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.core.TaskAttribute; import net.sourceforge.plantuml.project.core.TaskInstant; -import net.sourceforge.plantuml.project.draw.TaskDraw; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -49,6 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GanttArrow implements UDrawable { @@ -81,11 +80,11 @@ public class GanttArrow implements UDrawable { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.RED_DARK)).apply(new UChangeColor(HtmlColorUtils.RED_DARK)) + ug = ug.apply(new UChangeBackColor(HColorUtils.RED_DARK)).apply(new UChangeColor(HColorUtils.RED_DARK)) .apply(new UStroke(1.5)); - final TaskDraw draw1 = ((Task) source.getMoment()).getTaskDraw(); - final TaskDraw draw2 = ((Task) dest.getMoment()).getTaskDraw(); + final Task draw1 = (Task) source.getMoment(); + final Task draw2 = (Task) dest.getMoment(); double x1 = getX(source.withDelta(0), atStart); double y1 = draw1.getY(atStart); diff --git a/src/net/sourceforge/plantuml/project/GanttConstraint.java b/src/net/sourceforge/plantuml/project/GanttConstraint.java index 19c1566a0..5b094221b 100644 --- a/src/net/sourceforge/plantuml/project/GanttConstraint.java +++ b/src/net/sourceforge/plantuml/project/GanttConstraint.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.project; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.project.core.TaskInstant; import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScale; public class GanttConstraint implements Complement { @@ -58,4 +59,24 @@ public class GanttConstraint implements Complement { public UDrawable getUDrawable(final TimeScale timeScale) { return new GanttArrow(timeScale, source, dest); } + + public boolean isHidden(Wink min, Wink max) { + if (isHidden(source.getInstantPrecise(), min, max)) { + return true; + } + if (isHidden(dest.getInstantPrecise(), min, max)) { + return true; + } + return false; + } + + private boolean isHidden(Wink now, Wink min, Wink max) { + if (now.compareTo(min) < 0) { + return true; + } + if (now.compareTo(max) > 0) { + return true; + } + return false; + } } diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index 6c6a66516..adc235108 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -60,10 +60,6 @@ import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -77,49 +73,57 @@ import net.sourceforge.plantuml.project.core.TaskCode; import net.sourceforge.plantuml.project.core.TaskImpl; import net.sourceforge.plantuml.project.core.TaskInstant; import net.sourceforge.plantuml.project.core.TaskSeparator; -import net.sourceforge.plantuml.project.core.Wink; import net.sourceforge.plantuml.project.draw.ResourceDraw; import net.sourceforge.plantuml.project.draw.TaskDraw; +import net.sourceforge.plantuml.project.draw.TaskDrawDiamond; import net.sourceforge.plantuml.project.draw.TaskDrawRegular; import net.sourceforge.plantuml.project.draw.TaskDrawSeparator; import net.sourceforge.plantuml.project.draw.TimeHeader; import net.sourceforge.plantuml.project.draw.TimeHeaderDaily; +import net.sourceforge.plantuml.project.draw.TimeHeaderMonthly; import net.sourceforge.plantuml.project.draw.TimeHeaderSimple; import net.sourceforge.plantuml.project.draw.TimeHeaderWeekly; import net.sourceforge.plantuml.project.lang.ComplementColors; import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GanttDiagram extends TitledDiagram implements Subject { private final Map tasks = new LinkedHashMap(); private final Map byShortName = new HashMap(); private final List constraints = new ArrayList(); - private final IHtmlColorSet colorSet = new HtmlColorSetSimple(); + private final HColorSet colorSet = HColorSet.instance(); private final Collection closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); - private final Collection closedDayAsDate = new HashSet(); - private final Collection openedDayAsDate = new HashSet(); + private final Collection closedDayAsDate = new HashSet(); + private final Collection openedDayAsDate = new HashSet(); private final Map resources = new LinkedHashMap(); - private final Map colorDays = new HashMap(); - private final Map nameDays = new HashMap(); + private final Map colorDays = new HashMap(); + private final Map nameDays = new HashMap(); private PrintScale printScale = PrintScale.DAILY; - private DayAsDate today; + private Day today; private GCalendar calendar; private double totalHeight; private Wink min = new Wink(0); private Wink max; - private DayAsDate printStart; - private DayAsDate printEnd; + private Day printStart; + private Day printEnd; public DiagramDescription getDescription() { return new DiagramDescription("(Project)"); @@ -176,6 +180,19 @@ public class GanttDiagram extends TitledDiagram implements Subject { this.printScale = printScale; } + private boolean isHidden(Task task) { + if (printStart == null) { + return false; + } + if (task.getEnd().compareTo(min) < 0) { + return true; + } + if (task.getStart().compareTo(max) > 0) { + return true; + } + return false; + } + private TextBlockBackcolored getTextBlock() { if (printStart == null) { initMinMax(); @@ -188,7 +205,10 @@ public class GanttDiagram extends TitledDiagram implements Subject { timeHeader = new TimeHeaderSimple(min, max); } else if (printScale == PrintScale.WEEKLY) { timeHeader = new TimeHeaderWeekly(calendar, min, max, getDefaultPlan(), colorDays, nameDays); + } else if (printScale == PrintScale.MONTHLY) { + timeHeader = new TimeHeaderMonthly(calendar, min, max, getDefaultPlan(), colorDays, nameDays); } else { +// timeHeader = new TimeHeaderDaily(calendar, min, max, getDefaultPlan(), colorDays, nameDays, null, null); timeHeader = new TimeHeaderDaily(calendar, min, max, getDefaultPlan(), colorDays, nameDays, printStart, printEnd); } @@ -200,7 +220,8 @@ public class GanttDiagram extends TitledDiagram implements Subject { drawConstraints(ug, timeHeader.getTimeScale()); drawTasksRect(ug); drawTasksTitle(ug); - drawResources(ug); + if (printStart == null) + drawResources(ug); } public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { @@ -217,7 +238,7 @@ public class GanttDiagram extends TitledDiagram implements Subject { throw new UnsupportedOperationException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } }; @@ -225,22 +246,28 @@ public class GanttDiagram extends TitledDiagram implements Subject { private void drawTasksRect(UGraphic ug) { for (Task task : tasks.values()) { - final TaskDraw draw = task.getTaskDraw(); - final UTranslate move = new UTranslate(0, draw.getY()); + final TaskDraw draw = draws.get(task); + final UTranslate move = UTranslate.dy(draw.getY()); draw.drawU(ug.apply(move)); } } private void drawConstraints(final UGraphic ug, TimeScale timeScale) { for (GanttConstraint constraint : constraints) { + if (printStart != null && constraint.isHidden(min, max)) { + continue; + } constraint.getUDrawable(timeScale).drawU(ug); } } private void drawTasksTitle(final UGraphic ug1) { for (Task task : tasks.values()) { - final TaskDraw draw = task.getTaskDraw(); - final UTranslate move = new UTranslate(0, draw.getY()); + if (isHidden(task)) { + continue; + } + final TaskDraw draw = draws.get(task); + final UTranslate move = UTranslate.dy(draw.getY()); draw.drawTitle(ug1.apply(move)); } } @@ -248,7 +275,7 @@ public class GanttDiagram extends TitledDiagram implements Subject { private void drawResources(UGraphic ug) { for (Resource res : resources.values()) { final ResourceDraw draw = res.getResourceDraw(); - final UTranslate move = new UTranslate(0, draw.getY()); + final UTranslate move = UTranslate.dy(draw.getY()); draw.drawU(ug.apply(move)); } } @@ -259,7 +286,7 @@ public class GanttDiagram extends TitledDiagram implements Subject { if (calendar == null) { return 100; } - final DayAsDate day = calendar.toDayAsDate((Wink) instant); + final Day day = calendar.toDayAsDate((Wink) instant); if (isClosed(day)) { return 0; } @@ -268,7 +295,7 @@ public class GanttDiagram extends TitledDiagram implements Subject { }; } - private boolean isClosed(final DayAsDate day) { + private boolean isClosed(final Day day) { if (openedDayAsDate.contains(day)) { return false; } @@ -280,26 +307,40 @@ public class GanttDiagram extends TitledDiagram implements Subject { closedDayOfWeek.add(day); } - public void closeDayAsDate(DayAsDate day) { + public void closeDayAsDate(Day day) { closedDayAsDate.add(day); } - public void openDayAsDate(DayAsDate day) { + public void openDayAsDate(Day day) { openedDayAsDate.add(day); } + private final Map draws = new LinkedHashMap(); + private void initTaskAndResourceDraws(TimeScale timeScale, double headerHeight) { double y = headerHeight; + for (Task task : tasks.values()) { + task.setY(y); + y += task.getHeight(); + + } for (Task task : tasks.values()) { final TaskDraw draw; if (task instanceof TaskSeparator) { - draw = new TaskDrawSeparator((TaskSeparator) task, timeScale, y, min, max); + draw = new TaskDrawSeparator(((TaskSeparator) task).getName(), timeScale, task.getY(), min, max); } else { - draw = new TaskDrawRegular((TaskImpl) task, timeScale, y); + final TaskImpl tmp = (TaskImpl) task; + if (tmp.isDiamond()) { + draw = new TaskDrawDiamond(timeScale, task.getY(), tmp.getPrettyDisplay(), getStart(tmp)); + } else { + final boolean oddStart = printStart != null && min.compareTo(getStart(tmp)) == 0; + final boolean oddEnd = printStart != null && max.compareTo(getEnd(tmp)) == 0; + draw = new TaskDrawRegular(timeScale, task.getY(), tmp.getPrettyDisplay(), getStart(tmp), + getEnd(tmp), oddStart, oddEnd); + } + draw.setColorsAndCompletion(tmp.getColors(), tmp.getCompletion(), tmp.getUrl()); } - task.setTaskDraw(draw); - y += draw.getHeight(); - + draws.put(task, draw); } for (Resource res : resources.values()) { final ResourceDraw draw = new ResourceDraw(this, res, timeScale, y, min, max); @@ -310,6 +351,20 @@ public class GanttDiagram extends TitledDiagram implements Subject { this.totalHeight = y; } + private Wink getStart(final TaskImpl tmp) { + if (printStart == null) { + return tmp.getStart(); + } + return Wink.max(min, tmp.getStart()); + } + + private Wink getEnd(final TaskImpl tmp) { + if (printStart == null) { + return tmp.getEnd(); + } + return Wink.min(max, tmp.getEnd()); + } + private void initMinMax() { if (tasks.size() == 0) { max = min.increment(); @@ -330,13 +385,13 @@ public class GanttDiagram extends TitledDiagram implements Subject { } } if (calendar != null) { - for (DayAsDate d : colorDays.keySet()) { + for (Day d : colorDays.keySet()) { final Wink instant = calendar.fromDayAsDate(d); if (instant.compareTo(max) > 0) { max = instant; } } - for (DayAsDate d : nameDays.keySet()) { + for (Day d : nameDays.keySet()) { final Wink instant = calendar.fromDayAsDate(d); if (instant.compareTo(max) > 0) { max = instant; @@ -345,14 +400,14 @@ public class GanttDiagram extends TitledDiagram implements Subject { } } - public DayAsDate getThenDate() { - DayAsDate result = getStartingDate(); - for (DayAsDate d : colorDays.keySet()) { + public Day getThenDate() { + Day result = getStartingDate(); + for (Day d : colorDays.keySet()) { if (d.compareTo(result) > 0) { result = d; } } - for (DayAsDate d : nameDays.keySet()) { + for (Day d : nameDays.keySet()) { if (d.compareTo(result) > 0) { result = d; } @@ -428,22 +483,22 @@ public class GanttDiagram extends TitledDiagram implements Subject { constraints.add(constraint); } - public IHtmlColorSet getIHtmlColorSet() { + public HColorSet getIHtmlColorSet() { return colorSet; } - public void setStartingDate(DayAsDate start) { + public void setStartingDate(Day start) { this.calendar = new GCalendar(start); } - public DayAsDate getStartingDate() { + public Day getStartingDate() { if (this.calendar == null) { return null; } return this.calendar.getStartingDate(); } - public DayAsDate getStartingDate(int nday) { + public Day getStartingDate(int nday) { if (this.calendar == null) { return null; } @@ -454,11 +509,11 @@ public class GanttDiagram extends TitledDiagram implements Subject { return 7 - closedDayOfWeek.size(); } - public Wink convert(DayAsDate day) { + public Wink convert(Day day) { return calendar.fromDayAsDate(day); } - public boolean isOpen(DayAsDate day) { + public boolean isOpen(Day day) { return getDefaultPlan().getLoadAt(convert(day)) > 0; } @@ -500,9 +555,9 @@ public class GanttDiagram extends TitledDiagram implements Subject { public Moment getExistingMoment(String id) { Moment result = getExistingTask(id); if (result == null) { - DayAsDate start = null; - DayAsDate end = null; - for (Map.Entry ent : nameDays.entrySet()) { + Day start = null; + Day end = null; + for (Map.Entry ent : nameDays.entrySet()) { if (ent.getValue().equalsIgnoreCase(id) == false) { continue; } @@ -516,7 +571,7 @@ public class GanttDiagram extends TitledDiagram implements Subject { return result; } - private DayAsDate min(DayAsDate d1, DayAsDate d2) { + private Day min(Day d1, Day d2) { if (d1 == null) { return d2; } @@ -526,7 +581,7 @@ public class GanttDiagram extends TitledDiagram implements Subject { return d1; } - private DayAsDate max(DayAsDate d1, DayAsDate d2) { + private Day max(Day d1, Day d2) { if (d1 == null) { return d2; } @@ -536,32 +591,32 @@ public class GanttDiagram extends TitledDiagram implements Subject { return d1; } - public void colorDay(DayAsDate day, HtmlColor color) { + public void colorDay(Day day, HColor color) { colorDays.put(day, color); } - public void nameDay(DayAsDate day, String name) { + public void nameDay(Day day, String name) { nameDays.put(day, name); } public void setTodayColors(ComplementColors colors) { if (today == null) { - this.today = DayAsDate.today(); + this.today = Day.today(); } colorDay(today, colors.getCenter()); } - public CommandExecutionResult setToday(DayAsDate date) { + public CommandExecutionResult setToday(Day date) { this.today = date; return CommandExecutionResult.ok(); } public CommandExecutionResult deleteTask(Task task) { - task.setColors(new ComplementColors(HtmlColorUtils.WHITE, HtmlColorUtils.BLACK)); + task.setColors(new ComplementColors(HColorUtils.WHITE, HColorUtils.BLACK)); return CommandExecutionResult.ok(); } - public void setPrintInterval(DayAsDate start, DayAsDate end) { + public void setPrintInterval(Day start, Day end) { this.printStart = start; this.printEnd = end; } diff --git a/src/net/sourceforge/plantuml/project/LoadPlanable.java b/src/net/sourceforge/plantuml/project/LoadPlanable.java index 15a909c7c..64d004759 100644 --- a/src/net/sourceforge/plantuml/project/LoadPlanable.java +++ b/src/net/sourceforge/plantuml/project/LoadPlanable.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; public interface LoadPlanable { diff --git a/src/net/sourceforge/plantuml/project/PlanUtils.java b/src/net/sourceforge/plantuml/project/PlanUtils.java index 0d1ce7b18..9ad264ffa 100644 --- a/src/net/sourceforge/plantuml/project/PlanUtils.java +++ b/src/net/sourceforge/plantuml/project/PlanUtils.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; public class PlanUtils { diff --git a/src/net/sourceforge/plantuml/project/Solver3.java b/src/net/sourceforge/plantuml/project/Solver3.java index 976ab40bd..530bf0ef7 100644 --- a/src/net/sourceforge/plantuml/project/Solver3.java +++ b/src/net/sourceforge/plantuml/project/Solver3.java @@ -41,7 +41,7 @@ import java.util.Map; import java.util.Map.Entry; import net.sourceforge.plantuml.project.core.TaskAttribute; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; public class Solver3 { diff --git a/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java b/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java index ed436bbc1..ceca8be26 100644 --- a/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java +++ b/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java @@ -41,14 +41,10 @@ import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; -import net.sourceforge.plantuml.project.Failable; import net.sourceforge.plantuml.project.GanttDiagram; -import net.sourceforge.plantuml.project.core.PrintScale; -import net.sourceforge.plantuml.project.lang.Complement; import net.sourceforge.plantuml.project.lang.ComplementDate; +import net.sourceforge.plantuml.project.time.Day; public class CommandPrintBetween extends SingleLineCommand2 { @@ -75,8 +71,8 @@ public class CommandPrintBetween extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(GanttDiagram diagram, LineLocation location, RegexResult arg) { - final DayAsDate start = (DayAsDate) pattern.getComplement(diagram, arg, "START").get(); - final DayAsDate end = (DayAsDate) pattern.getComplement(diagram, arg, "END").get(); + final Day start = (Day) pattern.getComplement(diagram, arg, "START").get(); + final Day end = (Day) pattern.getComplement(diagram, arg, "END").get(); diagram.setPrintInterval(start, end); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java b/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java index 64c09ceda..428088af5 100644 --- a/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java +++ b/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java @@ -57,6 +57,7 @@ public class CommandPrintScale extends SingleLineCommand2 { new RegexLeaf("printscale"), // RegexLeaf.spaceOneOrMore(), // new RegexOr("SCALE", // + new RegexLeaf("monthly"), // new RegexLeaf("daily"), // new RegexLeaf("weekly")), // RegexLeaf.end()); // diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerRobust.java b/src/net/sourceforge/plantuml/project/core/AbstractTask.java similarity index 66% rename from src/net/sourceforge/plantuml/timingdiagram/PlayerRobust.java rename to src/net/sourceforge/plantuml/project/core/AbstractTask.java index 1e864b9a3..5c8ebe566 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerRobust.java +++ b/src/net/sourceforge/plantuml/project/core/AbstractTask.java @@ -30,22 +30,44 @@ * * * Original Author: Arnaud Roques + * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.project.core; -import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.Direction; -public class PlayerRobust extends AbstractPlayer { +public abstract class AbstractTask implements Task { - protected TimeDrawing buildDrawing() { - final TimeDrawing result; - result = new Histogram(ruler, skinParam, statesLabel.values()); - return result; + public static final double HEIGHT = 16; + + public double getHeight() { + return HEIGHT; } - public PlayerRobust(TitleStrategy titleStrategy, String full, ISkinParam skinParam, TimingRuler ruler) { - super(titleStrategy, full, skinParam, ruler); + protected final TaskCode code; + private double y; + + protected AbstractTask(TaskCode code) { + this.code = code; + } + + public final double getY() { + return y; + } + + public final void setY(double y) { + this.y = y; + } + + public double getY(Direction direction) { + if (direction == Direction.UP) { + return y; + } + if (direction == Direction.DOWN) { + return y + getHeight(); + } + return y + getHeight() / 2; } } diff --git a/src/net/sourceforge/plantuml/project/core/Moment.java b/src/net/sourceforge/plantuml/project/core/Moment.java index cea85f99a..47ec59be4 100644 --- a/src/net/sourceforge/plantuml/project/core/Moment.java +++ b/src/net/sourceforge/plantuml/project/core/Moment.java @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.project.core; +import net.sourceforge.plantuml.project.time.Wink; + public interface Moment { public Wink getStart(); diff --git a/src/net/sourceforge/plantuml/project/core/MomentImpl.java b/src/net/sourceforge/plantuml/project/core/MomentImpl.java index 410d3059b..8fe2d00fa 100644 --- a/src/net/sourceforge/plantuml/project/core/MomentImpl.java +++ b/src/net/sourceforge/plantuml/project/core/MomentImpl.java @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.project.core; +import net.sourceforge.plantuml.project.time.Wink; + public class MomentImpl implements Moment { private final Wink start; diff --git a/src/net/sourceforge/plantuml/project/core/PrintScale.java b/src/net/sourceforge/plantuml/project/core/PrintScale.java index ecde6640c..5dfe1b50b 100644 --- a/src/net/sourceforge/plantuml/project/core/PrintScale.java +++ b/src/net/sourceforge/plantuml/project/core/PrintScale.java @@ -36,12 +36,25 @@ package net.sourceforge.plantuml.project.core; public enum PrintScale { - DAILY, WEEKLY; + DAILY(1), WEEKLY(4), MONTHLY(15); + + private final int compress; + + private PrintScale(int compress) { + this.compress = compress; + } + + public int getCompress() { + return compress; + } static public PrintScale fromString(String value) { if (value.startsWith("w")) { return WEEKLY; } + if (value.startsWith("m")) { + return MONTHLY; + } return DAILY; } } diff --git a/src/net/sourceforge/plantuml/project/core/Resource.java b/src/net/sourceforge/plantuml/project/core/Resource.java index a5cb17364..b169728a0 100644 --- a/src/net/sourceforge/plantuml/project/core/Resource.java +++ b/src/net/sourceforge/plantuml/project/core/Resource.java @@ -40,12 +40,13 @@ import java.util.EnumSet; import java.util.Set; import java.util.TreeSet; -import net.sourceforge.plantuml.project.DayAsDate; -import net.sourceforge.plantuml.project.DayOfWeek; -import net.sourceforge.plantuml.project.GCalendar; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.draw.ResourceDraw; import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; public class Resource implements Subject { @@ -95,7 +96,7 @@ public class Resource implements Subject { return false; } if (closedDayOfWeek.size() > 0 && calendar != null) { - final DayAsDate d = calendar.toDayAsDate((Wink) instant); + final Day d = calendar.toDayAsDate((Wink) instant); if (closedDayOfWeek.contains(d.getDayOfWeek())) { return true; } diff --git a/src/net/sourceforge/plantuml/project/core/Task.java b/src/net/sourceforge/plantuml/project/core/Task.java index fde1371f3..8575ea403 100644 --- a/src/net/sourceforge/plantuml/project/core/Task.java +++ b/src/net/sourceforge/plantuml/project/core/Task.java @@ -35,11 +35,12 @@ */ package net.sourceforge.plantuml.project.core; +import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.project.Load; -import net.sourceforge.plantuml.project.draw.TaskDraw; import net.sourceforge.plantuml.project.lang.ComplementColors; import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Wink; public interface Task extends Subject, Moment { @@ -57,21 +58,24 @@ public interface Task extends Subject, Moment { public void setEnd(Wink end); - public void setTaskDraw(TaskDraw taskDraw); - - public TaskDraw getTaskDraw(); - public void setColors(ComplementColors colors); public void addResource(Resource resource, int percentage); public void setDiamond(boolean diamond); - + public boolean isDiamond(); public void setCompletion(int completion); public void setUrl(Url url); + public double getHeight(); + + public double getY(); + + public void setY(double y); + + public double getY(Direction direction); } diff --git a/src/net/sourceforge/plantuml/project/core/TaskImpl.java b/src/net/sourceforge/plantuml/project/core/TaskImpl.java index 2a3a15a1d..b0c6126c9 100644 --- a/src/net/sourceforge/plantuml/project/core/TaskImpl.java +++ b/src/net/sourceforge/plantuml/project/core/TaskImpl.java @@ -44,19 +44,17 @@ import net.sourceforge.plantuml.project.Load; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.PlanUtils; import net.sourceforge.plantuml.project.Solver3; -import net.sourceforge.plantuml.project.draw.TaskDraw; import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; -public class TaskImpl implements Task, LoadPlanable { +public class TaskImpl extends AbstractTask implements Task, LoadPlanable { - private final TaskCode code; private final Solver3 solver; private final Map resources2 = new LinkedHashMap(); private final LoadPlanable defaultPlan; private boolean diamond; - + private Url url; - private TaskDraw taskDraw; private ComplementColors colors; public void setUrl(Url url) { @@ -64,7 +62,7 @@ public class TaskImpl implements Task, LoadPlanable { } public TaskImpl(TaskCode code, LoadPlanable defaultPlan) { - this.code = code; + super(code); this.defaultPlan = defaultPlan; this.solver = new Solver3(this); setStart(new Wink(0)); @@ -182,16 +180,6 @@ public class TaskImpl implements Task, LoadPlanable { solver.setData(TaskAttribute.END, end); } - - public void setTaskDraw(TaskDraw taskDraw) { - taskDraw.setColorsAndCompletion(colors, completion, url); - this.taskDraw = taskDraw; - } - - public TaskDraw getTaskDraw() { - return taskDraw; - } - public void setColors(ComplementColors colors) { this.colors = colors; } @@ -214,4 +202,16 @@ public class TaskImpl implements Task, LoadPlanable { this.completion = completion; } + public final Url getUrl() { + return url; + } + + public final ComplementColors getColors() { + return colors; + } + + public final int getCompletion() { + return completion; + } + } diff --git a/src/net/sourceforge/plantuml/project/core/TaskInstant.java b/src/net/sourceforge/plantuml/project/core/TaskInstant.java index 3d4d72e1e..78b1a2e55 100644 --- a/src/net/sourceforge/plantuml/project/core/TaskInstant.java +++ b/src/net/sourceforge/plantuml/project/core/TaskInstant.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.project.core; import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.time.Wink; public class TaskInstant implements Complement { diff --git a/src/net/sourceforge/plantuml/project/core/TaskSeparator.java b/src/net/sourceforge/plantuml/project/core/TaskSeparator.java index 3f722b5ac..a5ff90ce8 100644 --- a/src/net/sourceforge/plantuml/project/core/TaskSeparator.java +++ b/src/net/sourceforge/plantuml/project/core/TaskSeparator.java @@ -37,18 +37,15 @@ package net.sourceforge.plantuml.project.core; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.project.Load; -import net.sourceforge.plantuml.project.draw.TaskDraw; import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; -public class TaskSeparator implements Task { - // public static final double SPACE = 15; +public class TaskSeparator extends AbstractTask implements Task { - private final TaskCode code; private final String comment; - private TaskDraw taskDraw; public TaskSeparator(String comment, int id) { - this.code = new TaskCode("##" + id); + super(new TaskCode("##" + id)); this.comment = comment; } @@ -70,15 +67,6 @@ public class TaskSeparator implements Task { public void setEnd(Wink end) { throw new UnsupportedOperationException(); - - } - - public void setTaskDraw(TaskDraw taskDraw) { - this.taskDraw = taskDraw; - } - - public TaskDraw getTaskDraw() { - return taskDraw; } public void setColors(ComplementColors colors) { diff --git a/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java b/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java new file mode 100644 index 000000000..3302dca9e --- /dev/null +++ b/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java @@ -0,0 +1,73 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.project.draw; + +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.project.core.AbstractTask; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; + +public abstract class AbstractTaskDraw implements TaskDraw { + + protected final TimeScale timeScale; + protected final double y; + protected final String prettyDisplay; + protected final Wink start; + + protected final double margin = 2; + + public AbstractTaskDraw(TimeScale timeScale, double y, String prettyDisplay, Wink start) { + this.y = y; + this.start = start; + this.prettyDisplay = prettyDisplay; + this.timeScale = timeScale; + } + + abstract protected FontConfiguration getFontConfiguration(); + + final protected double getShapeHeight() { + return getHeight() - 2 * margin; + } + + final public double getHeight() { + return AbstractTask.HEIGHT; + } + + final public double getY() { + return y; + } + +} diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerConcise.java b/src/net/sourceforge/plantuml/project/draw/PathUtils.java similarity index 58% rename from src/net/sourceforge/plantuml/timingdiagram/PlayerConcise.java rename to src/net/sourceforge/plantuml/project/draw/PathUtils.java index adcb4722a..a3a7b20d9 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerConcise.java +++ b/src/net/sourceforge/plantuml/project/draw/PathUtils.java @@ -30,22 +30,39 @@ * * * Original Author: Arnaud Roques + * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.project.draw; -import net.sourceforge.plantuml.ISkinParam; +import java.awt.geom.Point2D; -public class PlayerConcise extends AbstractPlayer { +import net.sourceforge.plantuml.ugraphic.UPath; - protected TimeDrawing buildDrawing() { - final TimeDrawing result; - result = new Ribbon(ruler, skinParam, notes); +public class PathUtils { + + private final static double round = 4; + + public static UPath UtoRight(double width, double height) { + final UPath result = new UPath(); + result.moveTo(0, 0); + result.lineTo(width - round, 0); + result.arcTo(new Point2D.Double(width, round), round, 0, 1); + result.lineTo(width, height - round); + result.arcTo(new Point2D.Double(width - round, height), round, 0, 1); + result.lineTo(0, height); return result; } - public PlayerConcise(TitleStrategy titleStrategy, String full, ISkinParam skinParam, TimingRuler ruler) { - super(titleStrategy, full, skinParam, ruler); + public static UPath UtoLeft(double width, double height) { + final UPath result = new UPath(); + result.moveTo(width, height); + result.lineTo(round, height); + result.arcTo(new Point2D.Double(0, height - round), round, 0, 1); + result.lineTo(0, round); + result.arcTo(new Point2D.Double(round, 0), round, 0, 1); + result.lineTo(width, 0); + return result; } } diff --git a/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java b/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java index e95c35054..b1464637f 100644 --- a/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java +++ b/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java @@ -39,19 +39,19 @@ import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.core.Resource; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ResourceDraw implements UDrawable { @@ -75,14 +75,14 @@ public class ResourceDraw implements UDrawable { final TextBlock title = Display.getWithNewlines(res.getName()).create(getFontConfiguration(13), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); title.drawU(ug); - final ULine line = new ULine(timeScale.getEndingPosition(max) - timeScale.getStartingPosition(min), 0); - ug.apply(new UChangeColor(HtmlColorUtils.BLACK)) - .apply(new UTranslate(0, title.calculateDimension(ug.getStringBounder()).getHeight())).draw(line); + final ULine line = ULine.hline(timeScale.getEndingPosition(max) - timeScale.getStartingPosition(min)); + ug.apply(new UChangeColor(HColorUtils.BLACK)) + .apply(UTranslate.dy(title.calculateDimension(ug.getStringBounder()).getHeight())).draw(line); for (Wink i = min; i.compareTo(max) <= 0; i = i.increment()) { final int load = gantt.getLoadForResource(res, i); if (load > 0) { - final FontConfiguration fontConfiguration = getFontConfiguration(9, load > 100 ? HtmlColorUtils.RED - : HtmlColorUtils.BLACK); + final FontConfiguration fontConfiguration = getFontConfiguration(9, load > 100 ? HColorUtils.RED + : HColorUtils.BLACK); final TextBlock value = Display.getWithNewlines("" + load).create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final double start = (timeScale.getStartingPosition(i) + timeScale.getEndingPosition(i)) / 2 @@ -95,10 +95,10 @@ public class ResourceDraw implements UDrawable { } private FontConfiguration getFontConfiguration(int size) { - return getFontConfiguration(size, HtmlColorUtils.BLACK); + return getFontConfiguration(size, HColorUtils.BLACK); } - private FontConfiguration getFontConfiguration(int size, HtmlColor color) { + private FontConfiguration getFontConfiguration(int size, HColor color) { final UFont font = UFont.serif(size); return new FontConfiguration(font, color, color, false); } diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDraw.java b/src/net/sourceforge/plantuml/project/draw/TaskDraw.java index 814c33b9d..b5e844b95 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDraw.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDraw.java @@ -35,7 +35,6 @@ */ package net.sourceforge.plantuml.project.draw; -import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.project.lang.ComplementColors; @@ -47,8 +46,6 @@ public interface TaskDraw extends UDrawable { public double getY(); - public double getY(Direction direction); - public void drawTitle(UGraphic ug); public double getHeight(); diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java new file mode 100644 index 000000000..db6a2a114 --- /dev/null +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java @@ -0,0 +1,110 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.project.draw; + +import net.sourceforge.plantuml.SpriteContainerEmpty; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; +import net.sourceforge.plantuml.ugraphic.UChangeBackColor; +import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UPolygon; +import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TaskDrawDiamond extends AbstractTaskDraw { + + private ComplementColors colors; + + public TaskDrawDiamond(TimeScale timeScale, double y, String prettyDisplay, Wink start) { + super(timeScale, y, prettyDisplay, start); + } + + @Override + protected FontConfiguration getFontConfiguration() { + final UFont font = UFont.serif(11); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + } + + final public void drawTitle(UGraphic ug) { + final TextBlock title = Display.getWithNewlines(prettyDisplay).create(getFontConfiguration(), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final double titleHeight = title.calculateDimension(ug.getStringBounder()).getHeight(); + final double h = (margin + getShapeHeight() - titleHeight) / 2; + final double endingPosition = timeScale.getStartingPosition(start) + getHeight(); + title.drawU(ug.apply(new UTranslate(endingPosition, h))); + } + + public void drawU(UGraphic ug1) { + final double startPos = timeScale.getStartingPosition(start); + ug1 = applyColors(ug1); + UGraphic ug2 = ug1.apply(new UTranslate(startPos + margin, margin)); + drawShape(ug2); + } + + private UGraphic applyColors(UGraphic ug) { + if (colors != null && colors.isOk()) { + return colors.apply(ug); + } + return ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UChangeBackColor(HColorUtils.BLACK)); + } + + private void drawShape(UGraphic ug) { + ug.draw(getDiamond()); + } + + private UShape getDiamond() { + final double h = getHeight() - 2 * margin; + final UPolygon result = new UPolygon(); + result.addPoint(h / 2, 0); + result.addPoint(h, h / 2); + result.addPoint(h / 2, h); + result.addPoint(0, h / 2); + return result; + } + + public void setColorsAndCompletion(ComplementColors colors, int completion, Url url) { + this.colors = colors; + } +} diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java index d3e606365..b871c1fea 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java @@ -35,71 +35,66 @@ */ package net.sourceforge.plantuml.project.draw; -import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.project.core.TaskImpl; -import net.sourceforge.plantuml.project.core.Wink; import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; -import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; -public class TaskDrawRegular implements TaskDraw { +public class TaskDrawRegular extends AbstractTaskDraw { + + private static final HColor defaultColor = HColorSet.instance().getColorIfValid("GreenYellow"); - // private static final HtmlColor defaultColor = HtmlColorUtils.COL_84BE84; - private static final HtmlColor defaultColor = new HtmlColorSetSimple().getColorIfValid("GreenYellow"); - private final TaskImpl task; - private final TimeScale timeScale; - private final double y; private ComplementColors colors; private int completion = 100; private Url url; + private final Wink end; + private final boolean oddStart; + private final boolean oddEnd; private final double margin = 2; - public TaskDrawRegular(TaskImpl task, TimeScale timeScale, double y) { - this.y = y; - this.task = task; - this.timeScale = timeScale; + public TaskDrawRegular(TimeScale timeScale, double y, String prettyDisplay, Wink start, Wink end, boolean oddStart, + boolean oddEnd) { + super(timeScale, y, prettyDisplay, start); + this.end = end; + this.oddStart = oddStart; + this.oddEnd = oddEnd; + } public void drawTitle(UGraphic ug) { - final TextBlock title = Display.getWithNewlines(task.getPrettyDisplay()).create(getFontConfiguration(), + final TextBlock title = Display.getWithNewlines(prettyDisplay).create(getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final double titleHeight = title.calculateDimension(ug.getStringBounder()).getHeight(); final double h = (margin + getShapeHeight() - titleHeight) / 2; - final double endingPosition; - if (isDiamond()) { - endingPosition = timeScale.getStartingPosition(task.getStart()) + getHeight(); - } else { - endingPosition = timeScale.getEndingPosition(task.getStart()); - } + final double endingPosition = timeScale.getEndingPosition(start); title.drawU(ug.apply(new UTranslate(endingPosition, h))); } - private FontConfiguration getFontConfiguration() { + @Override + protected FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); } public void drawU(UGraphic ug1) { - final double start = timeScale.getStartingPosition(task.getStart()); + final double startPos = timeScale.getStartingPosition(start); ug1 = applyColors(ug1); - UGraphic ug2 = ug1.apply(new UTranslate(start + margin, margin)); + UGraphic ug2 = ug1.apply(new UTranslate(startPos + margin, margin)); drawShape(ug2); } @@ -107,91 +102,48 @@ public class TaskDrawRegular implements TaskDraw { if (colors != null && colors.isOk()) { return colors.apply(ug); } - if (isDiamond()) { - return ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)); - } - return ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(defaultColor)); + return ug.apply(new UChangeColor(HColorUtils.BLUE)).apply(new UChangeBackColor(defaultColor)); } private void drawShape(UGraphic ug) { - if (isDiamond()) { - ug.draw(getDiamond()); - return; - } - final Wink instantStart = task.getStart(); - final Wink instantEnd = task.getEnd(); - final double start = timeScale.getStartingPosition(instantStart); - final double end = timeScale.getEndingPosition(instantEnd); + final double startPos = timeScale.getStartingPosition(start); + final double endPos = timeScale.getEndingPosition(end); - final double fullLength = end - start - 2 * margin; + final double fullLength = endPos - startPos - 2 * margin; if (fullLength < 10) { return; } if (url != null) { ug.startUrl(url); } - final URectangle full = new URectangle(fullLength, getShapeHeight(), 8, 8); + if (oddStart && !oddEnd) { + ug.draw(PathUtils.UtoRight(fullLength, getShapeHeight())); + return; + } + if (!oddStart && oddEnd) { + ug.draw(PathUtils.UtoLeft(fullLength, getShapeHeight())); + return; + } + final URectangle full = new URectangle(fullLength, getShapeHeight()).rounded(8); if (completion == 100) { ug.draw(full); } else { final double partialLength = fullLength * completion / 100.; - ug.apply(new UChangeColor(HtmlColorUtils.WHITE)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)) + ug.apply(new UChangeColor(HColorUtils.WHITE)).apply(new UChangeBackColor(HColorUtils.WHITE)) .draw(full); if (partialLength > 2) { - final URectangle partial = new URectangle(partialLength, getShapeHeight(), 8, 8); + final URectangle partial = new URectangle(partialLength, getShapeHeight()).rounded(8); ug.apply(new UChangeColor(null)).draw(partial); } if (partialLength > 10 && partialLength < fullLength - 10) { final URectangle patch = new URectangle(8, getShapeHeight()); - ug.apply(new UChangeColor(null)).apply(new UTranslate(partialLength - 8, 0)).draw(patch); + ug.apply(new UChangeColor(null)).apply(UTranslate.dx(partialLength - 8)).draw(patch); } ug.apply(new UChangeBackColor(null)).draw(full); } if (url != null) { ug.closeAction(); } - - } - - private double getShapeHeight() { - return getHeight() - 2 * margin; - } - - private boolean isDiamond() { - if (task.isDiamond()) { - final Wink instantStart = task.getStart(); - final Wink instantEnd = task.getEnd(); - return instantStart.compareTo(instantEnd) == 0; - } - return false; - } - - private UShape getDiamond() { - final double h = getHeight() - 2 * margin; - final UPolygon result = new UPolygon(); - result.addPoint(h / 2, 0); - result.addPoint(h, h / 2); - result.addPoint(h / 2, h); - result.addPoint(0, h / 2); - return result; - } - - public double getHeight() { - return 16; - } - - public double getY() { - return y; - } - - public double getY(Direction direction) { - if (direction == Direction.UP) { - return y; - } - if (direction == Direction.DOWN) { - return y + getHeight(); - } - return y + getHeight() / 2; } public void setColorsAndCompletion(ComplementColors colors, int completion, Url url) { diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java index 6e88d95f3..d510383bf 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java @@ -35,24 +35,23 @@ */ package net.sourceforge.plantuml.project.draw; -import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.project.core.TaskSeparator; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.core.AbstractTask; import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TaskDrawSeparator implements TaskDraw { @@ -62,8 +61,8 @@ public class TaskDrawSeparator implements TaskDraw { private final Wink max; private final String name; - public TaskDrawSeparator(TaskSeparator task, TimeScale timeScale, double y, Wink min, Wink max) { - this.name = task.getName(); + public TaskDrawSeparator(String name, TimeScale timeScale, double y, Wink min, Wink max) { + this.name = name; this.y = y; this.timeScale = timeScale; this.min = min; @@ -71,7 +70,7 @@ public class TaskDrawSeparator implements TaskDraw { } public void drawTitle(UGraphic ug) { - getTitle().drawU(ug.apply(new UTranslate(MARGIN1, 0))); + getTitle().drawU(ug.apply(UTranslate.dx(MARGIN1))); } private TextBlock getTitle() { @@ -84,7 +83,7 @@ public class TaskDrawSeparator implements TaskDraw { private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); } private final static double MARGIN1 = 10; @@ -95,38 +94,28 @@ public class TaskDrawSeparator implements TaskDraw { final double start = timeScale.getStartingPosition(min) + widthTitle; final double end = timeScale.getEndingPosition(max); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); - ug = ug.apply(new UTranslate(0, getHeight() / 2)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); + ug = ug.apply(UTranslate.dy(getHeight() / 2)); if (widthTitle == 0) { - final ULine line = new ULine(end - start, 0); + final ULine line = ULine.hline(end - start); ug.draw(line); } else { - final ULine line1 = new ULine(MARGIN1 - MARGIN2, 0); - final ULine line2 = new ULine(end - start - MARGIN1 - MARGIN2, 0); + final ULine line1 = ULine.hline(MARGIN1 - MARGIN2); + final ULine line2 = ULine.hline(end - start - MARGIN1 - MARGIN2); ug.draw(line1); - ug.apply(new UTranslate(widthTitle + MARGIN1 + MARGIN2, 0)).draw(line2); + ug.apply(UTranslate.dx(widthTitle + MARGIN1 + MARGIN2)).draw(line2); } } public double getHeight() { - return 16; + return AbstractTask.HEIGHT; } public double getY() { return y; } - public double getY(Direction direction) { - if (direction == Direction.UP) { - return y; - } - if (direction == Direction.DOWN) { - return y + getHeight(); - } - return y + getHeight() / 2; - } - public void setColorsAndCompletion(ComplementColors colors, int completion, Url url) { } diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java index 982f9c82d..c7584d1f9 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java @@ -39,18 +39,21 @@ import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; -import sun.security.x509.AVA; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public abstract class TimeHeader { + + protected static final int Y_POS_ROW16 = 16; + protected static final int Y_POS_ROW28 = 28; + private final TimeScale timeScale; protected final Wink min; @@ -69,8 +72,8 @@ public abstract class TimeHeader { protected final void drawHline(UGraphic ug, double y) { final double xmin = getTimeScale().getStartingPosition(min); final double xmax = getTimeScale().getEndingPosition(max); - final ULine hline = new ULine(xmax - xmin, 0); - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(0, y)).draw(hline); + final ULine hline = ULine.hline(xmax - xmin); + ug.apply(new UChangeColor(HColorUtils.LIGHT_GRAY)).apply(UTranslate.dy(y)).draw(hline); } final protected FontConfiguration getFontConfiguration(int size, boolean bold) { @@ -78,7 +81,7 @@ public abstract class TimeHeader { if (bold) { font = font.bold(); } - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); } public final TimeScale getTimeScale() { @@ -94,7 +97,7 @@ public abstract class TimeHeader { final double width = text.calculateDimension(ug.getStringBounder()).getWidth(); final double available = end - start; final double diff = Math.max(0, available - width); - text.drawU(ug.apply(new UTranslate(start + diff / 2, 0))); + text.drawU(ug.apply(UTranslate.dx(start + diff / 2))); } protected final void printCentered(UGraphic ug, double start, double end, TextBlock... texts) { @@ -104,7 +107,7 @@ public abstract class TimeHeader { final double width = text.calculateDimension(ug.getStringBounder()).getWidth(); if (i == 0 || width <= available) { final double diff = Math.max(0, available - width); - text.drawU(ug.apply(new UTranslate(start + diff / 2, 0))); + text.drawU(ug.apply(UTranslate.dx(start + diff / 2))); return; } } diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java index a0a819fef..177407ceb 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java @@ -37,16 +37,12 @@ package net.sourceforge.plantuml.project.draw; import java.util.Map; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.project.DayAsDate; -import net.sourceforge.plantuml.project.DayOfWeek; -import net.sourceforge.plantuml.project.GCalendar; import net.sourceforge.plantuml.project.LoadPlanable; -import net.sourceforge.plantuml.project.core.Month; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.MonthYear; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScaleDaily; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -54,26 +50,25 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimeHeaderDaily extends TimeHeader { - private static final int Y_POS_WEEKDAY = 16; - private static final int Y_POS_NUMDAY = 28; - private double getTimeHeaderHeight() { - return Y_POS_NUMDAY + 13; + return Y_POS_ROW28 + 13; } - private final HtmlColor veryLightGray = new HtmlColorSetSimple().getColorIfValid("#E0E8E8"); + private final HColor veryLightGray = HColorSet.instance().getColorIfValid("#E0E8E8"); private final GCalendar calendar; private final LoadPlanable defaultPlan; - private final Map colorDays; - private final Map nameDays; + private final Map colorDays; + private final Map nameDays; public TimeHeaderDaily(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, - Map colorDays, Map nameDays, DayAsDate printStart, - DayAsDate printEnd) { + Map colorDays, Map nameDays, Day printStart, Day printEnd) { super(min, max, new TimeScaleDaily(calendar, printStart)); this.calendar = calendar; this.defaultPlan = defaultPlan; @@ -90,74 +85,104 @@ public class TimeHeaderDaily extends TimeHeader { } private void drawCalendar(final UGraphic ug, double totalHeight) { - Month lastMonth = null; - double lastChangeMonth = -1; - Wink wink = min; - while (wink.compareTo(max) <= 0) { - final DayAsDate day = calendar.toDayAsDate(wink); - final DayOfWeek dayOfWeek = day.getDayOfWeek(); - final boolean isWorkingDay = defaultPlan.getLoadAt(wink) > 0; - final String d1 = "" + day.getDayOfMonth(); - final TextBlock num = getTextBlock(d1, 10, false); - final double x1 = getTimeScale().getStartingPosition(wink); - final double x2 = getTimeScale().getEndingPosition(wink); - double startingY = getFullHeaderHeight(); - if (wink.compareTo(max.increment()) < 0) { - final TextBlock weekDay = getTextBlock(dayOfWeek.shortName(), 10, false); - - final URectangle rect = new URectangle(x2 - x1 - 1, totalHeight - getFullHeaderHeight()); - if (isWorkingDay) { - final HtmlColor back = colorDays.get(day); - if (back != null) { - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(back)) - .apply(new UTranslate(x1 + 1, getFullHeaderHeight())).draw(rect); - } - printCentered(ug.apply(new UTranslate(0, Y_POS_WEEKDAY)), weekDay, x1, x2); - printCentered(ug.apply(new UTranslate(0, Y_POS_NUMDAY)), num, x1, x2); - } else { - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(veryLightGray)) - .apply(new UTranslate(x1 + 1, getFullHeaderHeight())).draw(rect); - } - if (lastMonth != day.getMonth()) { - startingY = 0; - if (lastMonth != null) { - printMonth(ug, lastMonth, day.getYear(), lastChangeMonth, x1); - } - lastChangeMonth = x1; - lastMonth = day.getMonth(); - } - } - drawVbar(ug, x1, startingY, totalHeight); - wink = wink.increment(); - } - final DayAsDate day = calendar.toDayAsDate(max); - final double x1 = getTimeScale().getStartingPosition(wink); - drawVbar(ug, x1, Y_POS_WEEKDAY, totalHeight); - if (x1 > lastChangeMonth) { - printMonth(ug, lastMonth, day.getYear(), lastChangeMonth, x1); - } - + drawTexts(ug, totalHeight); + drawMonths(ug); + drawNonWorking(ug, totalHeight); + drawVBars(ug, totalHeight); + drawVbar(ug, getTimeScale().getStartingPosition(max.increment()), Y_POS_ROW16, totalHeight); printNamedDays(ug); } - private void printMonth(UGraphic ug, Month lastMonth, int year, double start, double end) { - final TextBlock tiny = getTextBlock(lastMonth.shortName(), 12, true); - final TextBlock small = getTextBlock(lastMonth.niceName(), 12, true); - final TextBlock big = getTextBlock(lastMonth.niceName() + " " + year, 12, true); + private void drawTexts(final UGraphic ug, double totalHeight) { + final double height = totalHeight - getFullHeaderHeight(); + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + final double x1 = getTimeScale().getStartingPosition(wink); + final double x2 = getTimeScale().getEndingPosition(wink); + final Day day = calendar.toDayAsDate(wink); + if (defaultPlan.getLoadAt(wink) > 0) { + final HColor back = colorDays.get(day); + if (back != null) { + drawRectangle(ug.apply(new UChangeBackColor(back)), height, x1, x2); + } + printCentered(ug.apply(UTranslate.dy(Y_POS_ROW16)), + getTextBlock(day.getDayOfWeek().shortName(), 10, false), x1, x2); + printCentered(ug.apply(UTranslate.dy(Y_POS_ROW28)), getTextBlock("" + day.getDayOfMonth(), 10, false), + x1, x2); + } + } + } + + private void drawMonths(final UGraphic ug) { + MonthYear last = null; + double lastChangeMonth = -1; + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + final double x1 = getTimeScale().getStartingPosition(wink); + final Day day = calendar.toDayAsDate(wink); + if (day.monthYear().equals(last) == false) { + if (last != null) { + printMonth(ug, last, lastChangeMonth, x1); + } + lastChangeMonth = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChangeMonth) { + printMonth(ug, last, lastChangeMonth, x1); + } + } + + private void drawNonWorking(final UGraphic ug, double totalHeight) { + final double height = totalHeight - getFullHeaderHeight(); + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + final double x1 = getTimeScale().getStartingPosition(wink); + final double x2 = getTimeScale().getEndingPosition(wink); + if (defaultPlan.getLoadAt(wink) == 0) { + drawRectangle(ug.apply(new UChangeBackColor(veryLightGray)), height, x1, x2); + } + } + } + + private void drawRectangle(UGraphic ug, double height, double x1, double x2) { + if (height == 0) { + return; + } + ug = ug.apply(new UChangeColor(null)); + ug = ug.apply(new UTranslate(x1 + 1, getFullHeaderHeight())); + ug.draw(new URectangle(x2 - x1 - 1, height)); + } + + private void drawVBars(final UGraphic ug, double totalHeight) { + MonthYear last = null; + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + double startingY = getFullHeaderHeight(); + final Day day = calendar.toDayAsDate(wink); + if (day.monthYear().equals(last) == false) { + startingY = 0; + last = day.monthYear(); + } + drawVbar(ug, getTimeScale().getStartingPosition(wink), startingY, totalHeight); + } + } + + private void printMonth(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock tiny = getTextBlock(monthYear.shortName(), 12, true); + final TextBlock small = getTextBlock(monthYear.longName(), 12, true); + final TextBlock big = getTextBlock(monthYear.longNameYYYY(), 12, true); printCentered(ug, start, end, tiny, small, big); } private void drawVbar(UGraphic ug, double x, double y1, double y2) { - final ULine vbar = new ULine(0, y2 - y1); - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x, y1)).draw(vbar); + final ULine vbar = ULine.vline(y2 - y1); + ug.apply(new UChangeColor(HColorUtils.LIGHT_GRAY)).apply(new UTranslate(x, y1)).draw(vbar); } private void printNamedDays(final UGraphic ug) { if (nameDays.size() > 0) { String last = null; for (Wink wink = min; wink.compareTo(max.increment()) <= 0; wink = wink.increment()) { - final DayAsDate tmpday = calendar.toDayAsDate(wink); + final Day tmpday = calendar.toDayAsDate(wink); final String name = nameDays.get(tmpday); if (name != null && name.equals(last) == false) { final double x1 = getTimeScale().getStartingPosition(wink); @@ -166,7 +191,7 @@ public class TimeHeaderDaily extends TimeHeader { final double h = label.calculateDimension(ug.getStringBounder()).getHeight(); double y1 = getTimeHeaderHeight(); double y2 = getFullHeaderHeight(); - label.drawU(ug.apply(new UTranslate(x1, Y_POS_NUMDAY + 11))); + label.drawU(ug.apply(new UTranslate(x1, Y_POS_ROW28 + 11))); } last = name; } diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java new file mode 100644 index 000000000..8cbd7b7e6 --- /dev/null +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java @@ -0,0 +1,150 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.project.draw; + +import java.util.Map; + +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.project.LoadPlanable; +import net.sourceforge.plantuml.project.core.PrintScale; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.MonthYear; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScaleCompressed; +import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TimeHeaderMonthly extends TimeHeader { + + private double getTimeHeaderHeight() { + return Y_POS_ROW16 + 13; + } + + private final GCalendar calendar; + + public TimeHeaderMonthly(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, + Map colorDays, Map nameDays) { + super(min, max, new TimeScaleCompressed(calendar, PrintScale.MONTHLY.getCompress())); + this.calendar = calendar; + } + + @Override + public void drawTimeHeader(final UGraphic ug, double totalHeight) { + drawCalendar(ug, totalHeight); + drawHline(ug, 0); + drawHline(ug, Y_POS_ROW16); + drawHline(ug, getFullHeaderHeight()); + + } + + private void drawCalendar(final UGraphic ug, double totalHeight) { + drawYears(ug); + drawMonths(ug); + } + + private void drawYears(final UGraphic ug) { + MonthYear last = null; + double lastChange = -1; + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + final double x1 = getTimeScale().getStartingPosition(wink); + if (last == null || day.monthYear().year() != last.year()) { + drawVbar(ug, x1, 0, Y_POS_ROW16); + if (last != null) { + printYear(ug, last, lastChange, x1); + } + lastChange = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChange) { + printYear(ug, last, lastChange, x1); + } + } + + private void drawMonths(final UGraphic ug) { + MonthYear last = null; + double lastChange = -1; + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + final double x1 = getTimeScale().getStartingPosition(wink); + if (day.monthYear().equals(last) == false) { + drawVbar(ug, x1, Y_POS_ROW16, Y_POS_ROW28); + if (last != null) { + printMonth(ug.apply(UTranslate.dy(Y_POS_ROW16)), last, lastChange, x1); + } + lastChange = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChange) { + printMonth(ug.apply(UTranslate.dy(Y_POS_ROW16)), last, lastChange, x1); + } + } + + private void printYear(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock small = getTextBlock("" + monthYear.year(), 12, true); + printCentered(ug, start, end, small); + } + + private void printMonth(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock small = getTextBlock(monthYear.shortName(), 10, false); + final TextBlock big = getTextBlock(monthYear.longName(), 10, false); + printCentered(ug, start, end, small, big); + } + + private void drawVbar(UGraphic ug, double x, double y1, double y2) { + final ULine vbar = ULine.vline(y2 - y1); + ug.apply(new UChangeColor(HColorUtils.LIGHT_GRAY)).apply(new UTranslate(x, y1)).draw(vbar); + } + + private void printLeft(UGraphic ug, TextBlock text, double start) { + text.drawU(ug.apply(UTranslate.dx(start))); + } + + @Override + public double getFullHeaderHeight() { + return getTimeHeaderHeight(); + } + +} diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java index 2d07d261d..d0e49a8f2 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java @@ -38,49 +38,18 @@ package net.sourceforge.plantuml.project.draw; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.project.timescale.TimeScaleWink; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimeHeaderSimple extends TimeHeader { - public TimeHeaderSimple(Wink min, Wink max) { - super(min, max, new TimeScaleWink()); - } - - @Override - public void drawTimeHeader(final UGraphic ug, double totalHeight) { - final double xmin = getTimeScale().getStartingPosition(min); - final double xmax = getTimeScale().getEndingPosition(max); - drawSimpleDayCounter(ug, getTimeScale(), totalHeight); - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).draw(new ULine(xmax - xmin, 0)); - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(0, getFullHeaderHeight() - 3)) - .draw(new ULine(xmax - xmin, 0)); - - } - - private void drawSimpleDayCounter(final UGraphic ug, TimeScale timeScale, double totalHeight) { - final ULine vbar = new ULine(0, totalHeight); - for (Wink i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) { - final TextBlock num = Display.getWithNewlines(i.toShortString()).create(getFontConfiguration(10, false), - HorizontalAlignment.LEFT, new SpriteContainerEmpty()); - final double x1 = timeScale.getStartingPosition(i); - final double x2 = timeScale.getEndingPosition(i); - final double width = num.calculateDimension(ug.getStringBounder()).getWidth(); - final double delta = (x2 - x1) - width; - if (i.compareTo(max.increment()) < 0) { - num.drawU(ug.apply(new UTranslate(x1 + delta / 2, 0))); - } - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x1, 0)).draw(vbar); - } - } - @Override public double getFullHeaderHeight() { return getTimeHeaderHeight() + getHeaderNameDayHeight(); @@ -94,4 +63,35 @@ public class TimeHeaderSimple extends TimeHeader { return 0; } + public TimeHeaderSimple(Wink min, Wink max) { + super(min, max, new TimeScaleWink()); + } + + @Override + public void drawTimeHeader(final UGraphic ug, double totalHeight) { + final double xmin = getTimeScale().getStartingPosition(min); + final double xmax = getTimeScale().getEndingPosition(max); + drawSimpleDayCounter(ug, getTimeScale(), totalHeight); + ug.apply(new UChangeColor(HColorUtils.LIGHT_GRAY)).draw(ULine.hline(xmax - xmin)); + ug.apply(new UChangeColor(HColorUtils.LIGHT_GRAY)).apply(UTranslate.dy(getFullHeaderHeight() - 3)) + .draw(ULine.hline(xmax - xmin)); + + } + + private void drawSimpleDayCounter(final UGraphic ug, TimeScale timeScale, double totalHeight) { + final ULine vbar = ULine.vline(totalHeight); + for (Wink i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) { + final TextBlock num = Display.getWithNewlines(i.toShortString()).create(getFontConfiguration(10, false), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final double x1 = timeScale.getStartingPosition(i); + final double x2 = timeScale.getEndingPosition(i); + final double width = num.calculateDimension(ug.getStringBounder()).getWidth(); + final double delta = (x2 - x1) - width; + if (i.compareTo(max.increment()) < 0) { + num.drawU(ug.apply(UTranslate.dx(x1 + delta / 2))); + } + ug.apply(new UChangeColor(HColorUtils.LIGHT_GRAY)).apply(UTranslate.dx(x1)).draw(vbar); + } + } + } diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java index d6433515c..5a5837c39 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java @@ -37,152 +37,108 @@ package net.sourceforge.plantuml.project.draw; import java.util.Map; -import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.project.DayAsDate; -import net.sourceforge.plantuml.project.DayOfWeek; -import net.sourceforge.plantuml.project.GCalendar; import net.sourceforge.plantuml.project.LoadPlanable; -import net.sourceforge.plantuml.project.core.Month; -import net.sourceforge.plantuml.project.core.Wink; -import net.sourceforge.plantuml.project.timescale.TimeScaleWeekly; +import net.sourceforge.plantuml.project.core.PrintScale; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.MonthYear; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScaleCompressed; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimeHeaderWeekly extends TimeHeader { - private static final int Y_POS_NUMDAY = 16; - private double getTimeHeaderHeight() { - return Y_POS_NUMDAY + 13; + return Y_POS_ROW16 + 13; } - private final HtmlColor veryLightGray = new HtmlColorSetSimple().getColorIfValid("#E0E8E8"); - private final GCalendar calendar; - private final LoadPlanable defaultPlan; - private final Map colorDays; - private final Map nameDays; public TimeHeaderWeekly(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, - Map colorDays, Map nameDays) { - super(min, max, new TimeScaleWeekly(calendar)); + Map colorDays, Map nameDays) { + super(min, max, new TimeScaleCompressed(calendar, PrintScale.WEEKLY.getCompress())); this.calendar = calendar; - this.defaultPlan = defaultPlan; - this.colorDays = colorDays; - this.nameDays = nameDays; } @Override public void drawTimeHeader(final UGraphic ug, double totalHeight) { drawCalendar(ug, totalHeight); drawHline(ug, 0); - drawHline(ug, Y_POS_NUMDAY); + drawHline(ug, Y_POS_ROW16); drawHline(ug, getFullHeaderHeight()); } private void drawCalendar(final UGraphic ug, double totalHeight) { - Month lastMonth = null; - double lastChangeMonth = -1; - Wink wink = min; - while (wink.compareTo(max) <= 0) { - final DayAsDate day = calendar.toDayAsDate(wink); - final DayOfWeek dayOfWeek = day.getDayOfWeek(); - final String d1 = "" + day.getDayOfMonth(); - final TextBlock num = getTextBlock(d1, 10, false); - final double x1 = getTimeScale().getStartingPosition(wink); - final double x2 = getTimeScale().getEndingPosition(wink); - double startingY = getFullHeaderHeight(); - if (wink.compareTo(max.increment()) < 0) { - if (dayOfWeek == DayOfWeek.MONDAY) { - printLeft(ug.apply(new UTranslate(0, Y_POS_NUMDAY)), num, x1 + 5); - } - if (lastMonth != day.getMonth()) { - startingY = Y_POS_NUMDAY; - drawVbar(ug, x1, 0, Y_POS_NUMDAY); - if (lastMonth != null) { - printMonth(ug, lastMonth, day.getYear(), lastChangeMonth, x1); - } - lastChangeMonth = x1; - lastMonth = day.getMonth(); - } - } - if (dayOfWeek == DayOfWeek.MONDAY) { - drawVbar(ug, x1, Y_POS_NUMDAY, totalHeight); - } - wink = wink.increment(); - } - final DayAsDate day = calendar.toDayAsDate(wink); - final double x1 = getTimeScale().getStartingPosition(wink); - if (x1 > lastChangeMonth) { - printMonth(ug, lastMonth, day.getYear(), lastChangeMonth, x1); - } - - printNamedDays(ug); - + printDaysOfMonth(ug); + printSmallVbars(ug, totalHeight); + printMonths(ug); } - private void printMonth(UGraphic ug, Month lastMonth, int year, double start, double end) { - final TextBlock small = getTextBlock(lastMonth.shortName(), 12, true); - final TextBlock big = getTextBlock(lastMonth.shortName() + " " + year, 12, true); + private void printMonths(final UGraphic ug) { + MonthYear last = null; + double lastChangeMonth = -1; + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + final double x1 = getTimeScale().getStartingPosition(wink); + if (day.monthYear().equals(last) == false) { + drawVbar(ug, x1, 0, Y_POS_ROW16); + if (last != null) { + printMonth(ug, last, lastChangeMonth, x1); + } + lastChangeMonth = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChangeMonth) { + printMonth(ug, last, lastChangeMonth, x1); + } + } + + private void printSmallVbars(final UGraphic ug, double totalHeight) { + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + if (calendar.toDayAsDate(wink).getDayOfWeek() == DayOfWeek.MONDAY) { + drawVbar(ug, getTimeScale().getStartingPosition(wink), Y_POS_ROW16, totalHeight); + } + } + } + + private void printDaysOfMonth(final UGraphic ug) { + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + if (day.getDayOfWeek() == DayOfWeek.MONDAY) { + printLeft(ug.apply(UTranslate.dy(Y_POS_ROW16)), getTextBlock("" + day.getDayOfMonth(), 10, false), + getTimeScale().getStartingPosition(wink) + 5); + } + } + } + + private void printMonth(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock small = getTextBlock(monthYear.shortName(), 12, true); + final TextBlock big = getTextBlock(monthYear.shortNameYYYY(), 12, true); printCentered(ug, start, end, small, big); } private void drawVbar(UGraphic ug, double x, double y1, double y2) { - final ULine vbar = new ULine(0, y2 - y1); - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x, y1)).draw(vbar); - } - - private void printNamedDays(final UGraphic ug) { -// if (nameDays.size() > 0) { -// String last = null; -// for (Wink wink = min; wink.compareTo(max.increment()) <= 0; wink = wink.increment()) { -// final DayAsDate tmpday = calendar.toDayAsDate(wink); -// final String name = nameDays.get(tmpday); -// if (name != null && name.equals(last) == false) { -// final double x1 = getTimeScale().getStartingPosition(wink); -// final double x2 = getTimeScale().getEndingPosition(wink); -// final TextBlock label = getTextBlock(name, 12, false); -// final double h = label.calculateDimension(ug.getStringBounder()).getHeight(); -// double y1 = getTimeHeaderHeight(); -// double y2 = getFullHeaderHeight(); -// label.drawU(ug.apply(new UTranslate(x1, Y_POS_NUMDAY + 11))); -// } -// last = name; -// } -// } + final ULine vbar = ULine.vline(y2 - y1); + ug.apply(new UChangeColor(HColorUtils.LIGHT_GRAY)).apply(new UTranslate(x, y1)).draw(vbar); } private void printLeft(UGraphic ug, TextBlock text, double start) { - text.drawU(ug.apply(new UTranslate(start, 0))); + text.drawU(ug.apply(UTranslate.dx(start))); } @Override public double getFullHeaderHeight() { - return getTimeHeaderHeight() + getHeaderNameDayHeight(); + return getTimeHeaderHeight(); } - private double getHeaderNameDayHeight() { -// if (nameDays.size() > 0) { -// return 16; -// } - return 0; - } - -// private void drawCenter(final UGraphic ug, final TextBlock text, final double x1, final double x2) { -// final double width = text.calculateDimension(ug.getStringBounder()).getWidth(); -// final double delta = (x2 - x1) - width; -// if (delta < 0) { -// return; -// } -// text.drawU(ug.apply(new UTranslate(x1 + delta / 2, 0))); -// } } diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementColors.java b/src/net/sourceforge/plantuml/project/lang/ComplementColors.java index 4bb445c1f..d2bc2f068 100644 --- a/src/net/sourceforge/plantuml/project/lang/ComplementColors.java +++ b/src/net/sourceforge/plantuml/project/lang/ComplementColors.java @@ -35,17 +35,17 @@ */ package net.sourceforge.plantuml.project.lang; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComplementColors implements Complement { - private final HtmlColor center; - private final HtmlColor border; + private final HColor center; + private final HColor border; - public ComplementColors(HtmlColor center, HtmlColor border) { + public ComplementColors(HColor center, HColor border) { this.center = center; this.border = border; } @@ -67,7 +67,7 @@ public class ComplementColors implements Complement { return center != null; } - public HtmlColor getCenter() { + public HColor getCenter() { return center; } } diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementDate.java b/src/net/sourceforge/plantuml/project/lang/ComplementDate.java index e4cdb55ee..1285d6c5b 100644 --- a/src/net/sourceforge/plantuml/project/lang/ComplementDate.java +++ b/src/net/sourceforge/plantuml/project/lang/ComplementDate.java @@ -40,10 +40,10 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.Failable; import net.sourceforge.plantuml.project.GanttDiagram; -import net.sourceforge.plantuml.project.core.Month; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.Month; public class ComplementDate implements ComplementPattern { @@ -115,20 +115,20 @@ public class ComplementDate implements ComplementPattern { final int day = Integer.parseInt(arg.get("ADAY" + suffix, 0)); final String month = arg.get("AMONTH" + suffix, 0); final int year = Integer.parseInt(arg.get("AYEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } private Complement resultB(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("BDAY" + suffix, 0)); final int month = Integer.parseInt(arg.get("BMONTH" + suffix, 0)); final int year = Integer.parseInt(arg.get("BYEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } private Complement resultC(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("CDAY" + suffix, 0)); final String month = arg.get("CMONTH" + suffix, 0); final int year = Integer.parseInt(arg.get("CYEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } } diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementDates.java b/src/net/sourceforge/plantuml/project/lang/ComplementDates.java index 7cbb13e74..398ec934b 100644 --- a/src/net/sourceforge/plantuml/project/lang/ComplementDates.java +++ b/src/net/sourceforge/plantuml/project/lang/ComplementDates.java @@ -39,10 +39,10 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.DaysAsDates; import net.sourceforge.plantuml.project.Failable; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class ComplementDates implements ComplementPattern { @@ -66,16 +66,16 @@ public class ComplementDates implements ComplementPattern { } public Subject getSubject(GanttDiagram project, RegexResult arg) { - final DayAsDate date1 = getDate(arg, "1"); - final DayAsDate date2 = getDate(arg, "2"); + final Day date1 = getDate(arg, "1"); + final Day date2 = getDate(arg, "2"); return new DaysAsDates(date1, date2); } - private DayAsDate getDate(RegexResult arg, String suffix) { + private Day getDate(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("DAY" + suffix, 0)); final int month = Integer.parseInt(arg.get("MONTH" + suffix, 0)); final int year = Integer.parseInt(arg.get("YEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { @@ -83,12 +83,12 @@ public class ComplementDates implements ComplementPattern { final int day1 = Integer.parseInt(arg.get("DAY1" + suffix, 0)); final int month1 = Integer.parseInt(arg.get("MONTH1" + suffix, 0)); final int year1 = Integer.parseInt(arg.get("YEAR1" + suffix, 0)); - final DayAsDate date1 = DayAsDate.create(year1, month1, day1); + final Day date1 = Day.create(year1, month1, day1); final int day2 = Integer.parseInt(arg.get("DAY2" + suffix, 0)); final int month2 = Integer.parseInt(arg.get("MONTH2" + suffix, 0)); final int year2 = Integer.parseInt(arg.get("YEAR2" + suffix, 0)); - final DayAsDate date2 = DayAsDate.create(year2, month2, day2); + final Day date2 = Day.create(year2, month2, day2); return Failable. ok(new DaysAsDates(date1, date2)); } diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementDayOfWeek.java b/src/net/sourceforge/plantuml/project/lang/ComplementDayOfWeek.java index 416352281..bd365d2e3 100644 --- a/src/net/sourceforge/plantuml/project/lang/ComplementDayOfWeek.java +++ b/src/net/sourceforge/plantuml/project/lang/ComplementDayOfWeek.java @@ -39,9 +39,9 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayOfWeek; import net.sourceforge.plantuml.project.Failable; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.DayOfWeek; public class ComplementDayOfWeek implements ComplementPattern { diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java b/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java index 0c9b5b68c..289c0b5d5 100644 --- a/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java +++ b/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java @@ -38,9 +38,9 @@ package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.project.Failable; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComplementInColors implements ComplementPattern { @@ -51,8 +51,8 @@ public class ComplementInColors implements ComplementPattern { public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { final String color1 = arg.get("COMPLEMENT" + suffix, 0); final String color2 = arg.get("COMPLEMENT" + suffix, 1); - final HtmlColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); - final HtmlColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); + final HColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); + final HColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); return Failable. ok(new ComplementColors(col1, col2)); } } diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java b/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java index fb1b504c2..5dea97234 100644 --- a/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java +++ b/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java @@ -38,9 +38,9 @@ package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.project.Failable; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComplementInColors2 implements ComplementPattern { @@ -51,8 +51,8 @@ public class ComplementInColors2 implements ComplementPattern { public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { final String color1 = arg.get("COMPLEMENT" + suffix, 0); final String color2 = arg.get("COMPLEMENT" + suffix, 1); - final HtmlColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); - final HtmlColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); + final HColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); + final HColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); return Failable. ok(new ComplementColors(col1, col2)); } } diff --git a/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java b/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java index 55992f2b8..083c2f07e 100644 --- a/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java +++ b/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class SubjectDayAsDate implements SubjectPattern { @@ -64,7 +64,7 @@ public class SubjectDayAsDate implements SubjectPattern { final int day = Integer.parseInt(arg.get("DAY", 0)); final int month = Integer.parseInt(arg.get("MONTH", 0)); final int year = Integer.parseInt(arg.get("YEAR", 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } } diff --git a/src/net/sourceforge/plantuml/project/lang/SubjectDayOfWeek.java b/src/net/sourceforge/plantuml/project/lang/SubjectDayOfWeek.java index 5f2ab8192..5fe23c476 100644 --- a/src/net/sourceforge/plantuml/project/lang/SubjectDayOfWeek.java +++ b/src/net/sourceforge/plantuml/project/lang/SubjectDayOfWeek.java @@ -41,8 +41,8 @@ import java.util.Collection; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayOfWeek; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.DayOfWeek; public class SubjectDayOfWeek implements SubjectPattern { diff --git a/src/net/sourceforge/plantuml/project/lang/SubjectDaysAsDates.java b/src/net/sourceforge/plantuml/project/lang/SubjectDaysAsDates.java index 95398e7a5..6ea25f9a3 100644 --- a/src/net/sourceforge/plantuml/project/lang/SubjectDaysAsDates.java +++ b/src/net/sourceforge/plantuml/project/lang/SubjectDaysAsDates.java @@ -43,9 +43,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.DaysAsDates; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class SubjectDaysAsDates implements SubjectPattern { @@ -107,26 +107,26 @@ public class SubjectDaysAsDates implements SubjectPattern { public Subject getSubject(GanttDiagram project, RegexResult arg) { final String countAnd = arg.get("COUNT_AND", 0); if (countAnd != null) { - final DayAsDate date3 = getDate(arg, "3"); + final Day date3 = getDate(arg, "3"); final int nb = Integer.parseInt(countAnd); return new DaysAsDates(project, date3, nb); } final String countThen = arg.get("COUNT_THEN", 0); if (countThen != null) { - final DayAsDate date3 = project.getThenDate(); + final Day date3 = project.getThenDate(); final int nb = Integer.parseInt(countThen); return new DaysAsDates(project, date3, nb); } - final DayAsDate date1 = getDate(arg, "1"); - final DayAsDate date2 = getDate(arg, "2"); + final Day date1 = getDate(arg, "1"); + final Day date2 = getDate(arg, "2"); return new DaysAsDates(date1, date2); } - private DayAsDate getDate(RegexResult arg, String suffix) { + private Day getDate(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("DAY" + suffix, 0)); final int month = Integer.parseInt(arg.get("MONTH" + suffix, 0)); final int year = Integer.parseInt(arg.get("YEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } } diff --git a/src/net/sourceforge/plantuml/project/lang/VerbAre.java b/src/net/sourceforge/plantuml/project/lang/VerbAre.java index 188e25d88..82d341320 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbAre.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbAre.java @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayOfWeek; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.DayOfWeek; public class VerbAre implements VerbPattern { diff --git a/src/net/sourceforge/plantuml/project/lang/VerbHappens.java b/src/net/sourceforge/plantuml/project/lang/VerbHappens.java index c17a697d8..68d15dd8f 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbHappens.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbHappens.java @@ -42,11 +42,11 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.Load; import net.sourceforge.plantuml.project.core.Task; import net.sourceforge.plantuml.project.core.TaskInstant; +import net.sourceforge.plantuml.project.time.Day; public class VerbHappens implements VerbPattern { @@ -63,9 +63,9 @@ public class VerbHappens implements VerbPattern { public CommandExecutionResult execute(Subject subject, Complement complement) { final Task task = (Task) subject; task.setLoad(Load.inWinks(1)); - if (complement instanceof DayAsDate) { - final DayAsDate start = (DayAsDate) complement; - final DayAsDate startingDate = project.getStartingDate(); + if (complement instanceof Day) { + final Day start = (Day) complement; + final Day startingDate = project.getStartingDate(); if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } diff --git a/src/net/sourceforge/plantuml/project/lang/VerbIsForToday.java b/src/net/sourceforge/plantuml/project/lang/VerbIsForToday.java index 030df6334..abf45bd79 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbIsForToday.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbIsForToday.java @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class VerbIsForToday implements VerbPattern { @@ -59,7 +59,7 @@ public class VerbIsForToday implements VerbPattern { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { // final Today task = (Today) subject; - final DayAsDate date = (DayAsDate) complement; + final Day date = (Day) complement; return project.setToday(date); } }; diff --git a/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java b/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java index 285ea496a..b7d46c522 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java @@ -44,11 +44,11 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; -import net.sourceforge.plantuml.project.DayOfWeek; import net.sourceforge.plantuml.project.DaysAsDates; import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.core.Resource; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; public class VerbIsOff implements VerbPattern { @@ -77,11 +77,11 @@ public class VerbIsOff implements VerbPattern { if (complement instanceof DayOfWeek) { resource.addCloseDay(((DayOfWeek) complement)); } else if (complement instanceof DaysAsDates) { - for (DayAsDate when : (DaysAsDates) complement) { + for (Day when : (DaysAsDates) complement) { resource.addCloseDay(project.convert(when)); } } else { - final DayAsDate when = (DayAsDate) complement; + final Day when = (Day) complement; resource.addCloseDay(project.convert(when)); } return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/project/lang/VerbIsOn.java b/src/net/sourceforge/plantuml/project/lang/VerbIsOn.java index 44003c446..1fba48b3b 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbIsOn.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbIsOn.java @@ -44,10 +44,10 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.DaysAsDates; import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.core.Resource; +import net.sourceforge.plantuml.project.time.Day; public class VerbIsOn implements VerbPattern { @@ -74,11 +74,11 @@ public class VerbIsOn implements VerbPattern { public CommandExecutionResult execute(Subject subject, Complement complement) { final Resource resource = (Resource) subject; if (complement instanceof DaysAsDates) { - for (DayAsDate when : (DaysAsDates) complement) { + for (Day when : (DaysAsDates) complement) { resource.addForceOnDay(project.convert(when)); } } else { - final DayAsDate when = (DayAsDate) complement; + final Day when = (Day) complement; resource.addForceOnDay(project.convert(when)); } return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/project/lang/VerbIsOrAre.java b/src/net/sourceforge/plantuml/project/lang/VerbIsOrAre.java index dd639b263..efb6f22d1 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbIsOrAre.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbIsOrAre.java @@ -42,10 +42,10 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.DaysAsDates; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class VerbIsOrAre implements VerbPattern { @@ -62,7 +62,7 @@ public class VerbIsOrAre implements VerbPattern { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { if (complement instanceof ComplementColors) { - final HtmlColor color = ((ComplementColors) complement).getCenter(); + final HColor color = ((ComplementColors) complement).getCenter(); return manageColor(project, subject, color); } if (complement == ComplementClose.CLOSE) { @@ -76,14 +76,14 @@ public class VerbIsOrAre implements VerbPattern { }; } - private CommandExecutionResult manageColor(final GanttDiagram project, Subject subject, HtmlColor color) { - if (subject instanceof DayAsDate) { - final DayAsDate day = (DayAsDate) subject; + private CommandExecutionResult manageColor(final GanttDiagram project, Subject subject, HColor color) { + if (subject instanceof Day) { + final Day day = (Day) subject; project.colorDay(day, color); } if (subject instanceof DaysAsDates) { final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.colorDay(d, color); } } @@ -91,13 +91,13 @@ public class VerbIsOrAre implements VerbPattern { } private CommandExecutionResult manageClose(final GanttDiagram project, Subject subject) { - if (subject instanceof DayAsDate) { - final DayAsDate day = (DayAsDate) subject; + if (subject instanceof Day) { + final Day day = (Day) subject; project.closeDayAsDate(day); } if (subject instanceof DaysAsDates) { final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.closeDayAsDate(d); } } @@ -105,13 +105,13 @@ public class VerbIsOrAre implements VerbPattern { } private CommandExecutionResult manageOpen(final GanttDiagram project, Subject subject) { - if (subject instanceof DayAsDate) { - final DayAsDate day = (DayAsDate) subject; + if (subject instanceof Day) { + final Day day = (Day) subject; project.openDayAsDate(day); } if (subject instanceof DaysAsDates) { final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.openDayAsDate(d); } } diff --git a/src/net/sourceforge/plantuml/project/lang/VerbIsOrAreNamed.java b/src/net/sourceforge/plantuml/project/lang/VerbIsOrAreNamed.java index 01062ee21..45ddfc761 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbIsOrAreNamed.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbIsOrAreNamed.java @@ -42,9 +42,9 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.DaysAsDates; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class VerbIsOrAreNamed implements VerbPattern { @@ -62,7 +62,7 @@ public class VerbIsOrAreNamed implements VerbPattern { final ComplementName named = (ComplementName) complement; final String name = named.getName(); final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.nameDay(d, name); } return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java b/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java index 2d0b047fc..bae17615c 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java @@ -45,8 +45,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class VerbProjectStarts implements VerbPattern { @@ -74,7 +74,7 @@ public class VerbProjectStarts implements VerbPattern { public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { - final DayAsDate start = (DayAsDate) complement; + final Day start = (Day) complement; assert project == subject; project.setStartingDate(start); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/project/lang/VerbTaskEndsAbsolute.java b/src/net/sourceforge/plantuml/project/lang/VerbTaskEndsAbsolute.java index 10d44afd4..11d3276dd 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbTaskEndsAbsolute.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbTaskEndsAbsolute.java @@ -42,9 +42,9 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.time.Day; public class VerbTaskEndsAbsolute implements VerbPattern { @@ -60,8 +60,8 @@ public class VerbTaskEndsAbsolute implements VerbPattern { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { final Task task = (Task) subject; - final DayAsDate end = (DayAsDate) complement; - final DayAsDate startingDate = project.getStartingDate(); + final Day end = (Day) complement; + final Day startingDate = project.getStartingDate(); if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } diff --git a/src/net/sourceforge/plantuml/project/lang/VerbTaskStartsAbsolute.java b/src/net/sourceforge/plantuml/project/lang/VerbTaskStartsAbsolute.java index 22dee2089..f021a74e4 100644 --- a/src/net/sourceforge/plantuml/project/lang/VerbTaskStartsAbsolute.java +++ b/src/net/sourceforge/plantuml/project/lang/VerbTaskStartsAbsolute.java @@ -42,9 +42,9 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.project.DayAsDate; import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.time.Day; public class VerbTaskStartsAbsolute implements VerbPattern { @@ -60,8 +60,8 @@ public class VerbTaskStartsAbsolute implements VerbPattern { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { final Task task = (Task) subject; - final DayAsDate start = (DayAsDate) complement; - final DayAsDate startingDate = project.getStartingDate(); + final Day start = (Day) complement; + final Day startingDate = project.getStartingDate(); if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } diff --git a/src/net/sourceforge/plantuml/project/DayAsDate.java b/src/net/sourceforge/plantuml/project/time/Day.java similarity index 69% rename from src/net/sourceforge/plantuml/project/DayAsDate.java rename to src/net/sourceforge/plantuml/project/time/Day.java index a9b0b97e3..8464465a5 100644 --- a/src/net/sourceforge/plantuml/project/DayAsDate.java +++ b/src/net/sourceforge/plantuml/project/time/Day.java @@ -33,30 +33,27 @@ * * */ -package net.sourceforge.plantuml.project; +package net.sourceforge.plantuml.project.time; import java.util.Date; -import net.sourceforge.plantuml.project.core.Month; -import net.sourceforge.plantuml.project.core.Wink; import net.sourceforge.plantuml.project.lang.Complement; import net.sourceforge.plantuml.project.lang.Subject; -public class DayAsDate implements Complement, Comparable, Subject { +public class Day implements Complement, Comparable, Subject { - private final int year; private final int dayOfMonth; - private final Month month; + private final MonthYear monthYear; - public static DayAsDate create(int year, String month, int dayOfMonth) { - return new DayAsDate(year, Month.fromString(month), dayOfMonth); + public static Day create(int year, String month, int dayOfMonth) { + return new Day(year, Month.fromString(month), dayOfMonth); } - public static DayAsDate create(int year, int month, int dayOfMonth) { - return new DayAsDate(year, Month.values()[month - 1], dayOfMonth); + public static Day create(int year, int month, int dayOfMonth) { + return new Day(year, Month.values()[month - 1], dayOfMonth); } - public static DayAsDate today() { + public static Day today() { final Date now = new Date(); final int year = now.getYear() + 1900; final int month = now.getMonth() + 1; @@ -64,33 +61,36 @@ public class DayAsDate implements Complement, Comparable, Subject { return create(year, month, dayOfMonth); } - private DayAsDate(int year, Month month, int dayOfMonth) { - this.year = year; - this.dayOfMonth = dayOfMonth; - this.month = month; + private Day(int year, Month month, int dayOfMonth) { + this(MonthYear.create(year, month), dayOfMonth); } - public int getYear() { - return year; + private Day(MonthYear monthYear, int dayOfMonth) { + this.dayOfMonth = dayOfMonth; + this.monthYear = monthYear; + } + + public int year() { + return monthYear.year(); } private int internalNumber() { - return year * 100 * 100 + month.ordinal() * 100 + dayOfMonth; + return year() * 100 * 100 + month().ordinal() * 100 + dayOfMonth; } @Override public String toString() { - return "" + year + "/" + month + "/" + dayOfMonth; + return monthYear.toString() + "/" + dayOfMonth; } @Override public int hashCode() { - return year * 113 + dayOfMonth * 17 + month.hashCode(); + return monthYear.hashCode() + dayOfMonth * 17; } @Override public boolean equals(Object obj) { - final DayAsDate other = (DayAsDate) obj; + final Day other = (Day) obj; return other.internalNumber() == this.internalNumber(); } @@ -99,42 +99,43 @@ public class DayAsDate implements Complement, Comparable, Subject { } private int daysPerMonth() { - return month.getDaysPerMonth(year); + return month().getDaysPerMonth(year()); } - public DayAsDate next() { + public Day next() { int newDayOfMonth = dayOfMonth + 1; if (newDayOfMonth <= daysPerMonth()) { - return new DayAsDate(year, month, newDayOfMonth); + return new Day(year(), month(), newDayOfMonth); } assert newDayOfMonth > daysPerMonth(); - newDayOfMonth = 1; - final Month newMonth = month.next(); - final int newYear = newMonth == Month.JANUARY ? year + 1 : year; - return new DayAsDate(newYear, newMonth, newDayOfMonth); + return new Day(monthYear.next(), 1); } - public Month getMonth() { - return month; + public Month month() { + return monthYear.month(); + } + + public MonthYear monthYear() { + return monthYear; } // https://en.wikipedia.org/wiki/Zeller%27s_congruence public DayOfWeek getDayOfWeek() { final int q = dayOfMonth; - final int m = month.m(); - final int y = m >= 13 ? year - 1 : year; + final int m = month().m(); + final int y = m >= 13 ? year() - 1 : year(); final int k = y % 100; final int j = y / 100; final int h = ((q + 13 * (m + 1) / 5) + k + k / 4 + j / 4 + 5 * j) % 7; return DayOfWeek.fromH(h); } - public Wink asInstantDay(DayAsDate reference) { + public Wink asInstantDay(Day reference) { // if (this.compareTo(reference) < 0) { // throw new IllegalArgumentException(); // } int cmp = 0; - DayAsDate current = reference; + Day current = reference; while (current.compareTo(this) < 0) { current = current.next(); cmp++; @@ -144,8 +145,8 @@ public class DayAsDate implements Complement, Comparable, Subject { // http://www.proesite.com/timex/wkcalc.htm public int ISO_WN() { - final int y = year; - int m = month.ordinal() + 1; + final int y = year(); + int m = month().ordinal() + 1; int d = dayOfMonth; int dow = DOW(y, m, d); int dow0101 = DOW(y, 1, 1); @@ -174,7 +175,7 @@ public class DayAsDate implements Complement, Comparable, Subject { return 0; } - public int compareTo(DayAsDate other) { + public int compareTo(Day other) { return this.internalNumber() - other.internalNumber(); } diff --git a/src/net/sourceforge/plantuml/project/DayOfWeek.java b/src/net/sourceforge/plantuml/project/time/DayOfWeek.java similarity index 98% rename from src/net/sourceforge/plantuml/project/DayOfWeek.java rename to src/net/sourceforge/plantuml/project/time/DayOfWeek.java index 37bcdb160..db268f486 100644 --- a/src/net/sourceforge/plantuml/project/DayOfWeek.java +++ b/src/net/sourceforge/plantuml/project/time/DayOfWeek.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.project; +package net.sourceforge.plantuml.project.time; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.project.lang.Complement; diff --git a/src/net/sourceforge/plantuml/project/GCalendar.java b/src/net/sourceforge/plantuml/project/time/GCalendar.java similarity index 84% rename from src/net/sourceforge/plantuml/project/GCalendar.java rename to src/net/sourceforge/plantuml/project/time/GCalendar.java index 05090b701..c0f359524 100644 --- a/src/net/sourceforge/plantuml/project/GCalendar.java +++ b/src/net/sourceforge/plantuml/project/time/GCalendar.java @@ -33,20 +33,18 @@ * * */ -package net.sourceforge.plantuml.project; - -import net.sourceforge.plantuml.project.core.Wink; +package net.sourceforge.plantuml.project.time; public class GCalendar { - private final DayAsDate start; + private final Day start; - public GCalendar(DayAsDate start) { + public GCalendar(Day start) { this.start = start; } - public DayAsDate toDayAsDate(Wink day) { - DayAsDate result = start; + public Day toDayAsDate(Wink day) { + Day result = start; final int target = day.getWink(); int work = 0; while (work < target) { @@ -56,7 +54,7 @@ public class GCalendar { return result; } - public Wink fromDayAsDate(DayAsDate day) { + public Wink fromDayAsDate(Day day) { if (day.compareTo(start) < 0) { throw new IllegalArgumentException(); } @@ -67,7 +65,7 @@ public class GCalendar { return result; } - public DayAsDate getStartingDate() { + public Day getStartingDate() { return start; } diff --git a/src/net/sourceforge/plantuml/project/core/Month.java b/src/net/sourceforge/plantuml/project/time/Month.java similarity index 95% rename from src/net/sourceforge/plantuml/project/core/Month.java rename to src/net/sourceforge/plantuml/project/time/Month.java index 73528c4fc..1b6bb8351 100644 --- a/src/net/sourceforge/plantuml/project/core/Month.java +++ b/src/net/sourceforge/plantuml/project/time/Month.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.project.core; +package net.sourceforge.plantuml.project.time; import net.sourceforge.plantuml.StringUtils; @@ -49,10 +49,10 @@ public enum Month { } public String shortName() { - return niceName().substring(0, 3); + return longName().substring(0, 3); } - public String niceName() { + public String longName() { return StringUtils.capitalize(name()); } diff --git a/src/net/sourceforge/plantuml/project/time/MonthYear.java b/src/net/sourceforge/plantuml/project/time/MonthYear.java new file mode 100644 index 000000000..9a62258dc --- /dev/null +++ b/src/net/sourceforge/plantuml/project/time/MonthYear.java @@ -0,0 +1,109 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.project.time; + +public class MonthYear implements Comparable { + + private final int year; + private final Month month; + + public static MonthYear create(int year, Month month) { + return new MonthYear(year, month); + } + + public String shortName() { + return month.shortName(); + } + + public String shortNameYYYY() { + return month.shortName() + " " + year; + } + + public String longName() { + return month.longName(); + } + + public String longNameYYYY() { + return month.longName() + " " + year; + } + + private MonthYear(int year, Month month) { + this.year = year; + this.month = month; + } + + public int year() { + return year; + } + + public MonthYear next() { + final Month newMonth = month.next(); + final int newYear = newMonth == Month.JANUARY ? year + 1 : year; + return new MonthYear(newYear, newMonth); + } + + public Month month() { + return month; + } + + private int internalNumber() { + return year * 100 + month.ordinal(); + } + + @Override + public String toString() { + return "" + year + "/" + month; + } + + @Override + public int hashCode() { + return year * 113 + month.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + final MonthYear other = (MonthYear) obj; + return other.internalNumber() == this.internalNumber(); + } + + public int compareTo(MonthYear other) { + return this.internalNumber() - other.internalNumber(); + } + +} diff --git a/src/net/sourceforge/plantuml/project/core/Wink.java b/src/net/sourceforge/plantuml/project/time/Wink.java similarity index 86% rename from src/net/sourceforge/plantuml/project/core/Wink.java rename to src/net/sourceforge/plantuml/project/time/Wink.java index 94c83dba5..45566c9ea 100644 --- a/src/net/sourceforge/plantuml/project/core/Wink.java +++ b/src/net/sourceforge/plantuml/project/time/Wink.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.project.core; +package net.sourceforge.plantuml.project.time; import net.sourceforge.plantuml.project.Value; @@ -70,4 +70,18 @@ public class Wink implements Value, Comparable { return "" + (wink + 1); } + public static Wink min(Wink wink1, Wink wink2) { + if (wink2.wink < wink1.wink) { + return wink2; + } + return wink1; + } + + public static Wink max(Wink wink1, Wink wink2) { + if (wink2.wink > wink1.wink) { + return wink2; + } + return wink1; + } + } diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScale.java b/src/net/sourceforge/plantuml/project/timescale/TimeScale.java index b5baf4ef6..c8ce1e654 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScale.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScale.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project.timescale; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; public interface TimeScale { diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScaleWeekly.java b/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java similarity index 77% rename from src/net/sourceforge/plantuml/project/timescale/TimeScaleWeekly.java rename to src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java index c06dc0780..ba3c335e2 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScaleWeekly.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java @@ -35,28 +35,29 @@ */ package net.sourceforge.plantuml.project.timescale; -import net.sourceforge.plantuml.project.GCalendar; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; -public class TimeScaleWeekly implements TimeScale { +public class TimeScaleCompressed implements TimeScale { - private static final int COMPRESS = 4; + private final int compress; private final TimeScale daily; - public TimeScaleWeekly(GCalendar calendar) { + public TimeScaleCompressed(GCalendar calendar, int compress) { this.daily = new TimeScaleDaily(calendar, null); + this.compress = compress; } public double getStartingPosition(Wink instant) { - return daily.getStartingPosition(instant) / COMPRESS; + return daily.getStartingPosition(instant) / compress; } public double getEndingPosition(Wink instant) { - return daily.getEndingPosition(instant) / COMPRESS; + return daily.getEndingPosition(instant) / compress; } public double getWidth(Wink instant) { - return daily.getWidth(instant) / COMPRESS; + return daily.getWidth(instant) / compress; } } diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java b/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java index e8bafb6cb..30e029702 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java @@ -35,16 +35,16 @@ */ package net.sourceforge.plantuml.project.timescale; -import net.sourceforge.plantuml.project.DayAsDate; -import net.sourceforge.plantuml.project.GCalendar; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; public final class TimeScaleDaily implements TimeScale { private final TimeScaleWink basic; private final double delta; - public TimeScaleDaily(GCalendar calendar, DayAsDate zeroDay) { + public TimeScaleDaily(GCalendar calendar, Day zeroDay) { this.basic = new TimeScaleWink(); if (zeroDay == null) { this.delta = 0; diff --git a/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java b/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java index 118642613..1d0280293 100644 --- a/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java +++ b/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.project.timescale; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Wink; public class TimeScaleWink implements TimeScale { diff --git a/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java b/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java index da6e677e5..0d0cd6203 100644 --- a/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java +++ b/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java @@ -35,10 +35,10 @@ */ package net.sourceforge.plantuml.project.timescale; -import net.sourceforge.plantuml.project.DayAsDate; -import net.sourceforge.plantuml.project.DayOfWeek; -import net.sourceforge.plantuml.project.GCalendar; -import net.sourceforge.plantuml.project.core.Wink; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; public class UnusedTimeScaleWithoutWeekEnd implements TimeScale { @@ -63,7 +63,7 @@ public class UnusedTimeScaleWithoutWeekEnd implements TimeScale { } public double getWidth(Wink instant) { - final DayAsDate day = calendar.toDayAsDate((Wink) instant); + final Day day = calendar.toDayAsDate((Wink) instant); final DayOfWeek dayOfWeek = day.getDayOfWeek(); if (dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) { return 1; diff --git a/src/net/sourceforge/plantuml/salt/Dictionary.java b/src/net/sourceforge/plantuml/salt/Dictionary.java index 3157d501f..dc9abde05 100644 --- a/src/net/sourceforge/plantuml/salt/Dictionary.java +++ b/src/net/sourceforge/plantuml/salt/Dictionary.java @@ -42,14 +42,13 @@ import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.SpriteContainer; -import net.sourceforge.plantuml.creole.CommandCreoleMonospaced; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.command.CommandCreoleMonospaced; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.element.WrappedElement; import net.sourceforge.plantuml.sprite.Sprite; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class Dictionary implements SpriteContainer, ISkinSimple { @@ -91,8 +90,8 @@ public class Dictionary implements SpriteContainer, ISkinSimple { return 8; } - public IHtmlColorSet getIHtmlColorSet() { - return new HtmlColorSetSimple(); + public HColorSet getIHtmlColorSet() { + return HColorSet.instance(); } public int getDpi() { diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java index 9ade106b7..9ad07d207 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java @@ -57,7 +57,6 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandFactorySprite; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.factory.AbstractElementFactoryComplex; @@ -80,10 +79,11 @@ import net.sourceforge.plantuml.salt.factory.ElementFactoryText; import net.sourceforge.plantuml.salt.factory.ElementFactoryTextField; import net.sourceforge.plantuml.salt.factory.ElementFactoryTree; import net.sourceforge.plantuml.sprite.Sprite; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemSalt extends AbstractPSystem implements WithSprite { @@ -115,12 +115,12 @@ public class PSystemSalt extends AbstractPSystem implements WithSprite { if (getScale() != null) { scale = getScale().getScale(size.getWidth(), size.getHeight()); } - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), scale, HtmlColorUtils.WHITE, null, + final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), scale, HColorUtils.WHITE, null, null, 5, 5, null, false); builder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); salt.drawU(ug, 0, new Dimension2DDouble(size.getWidth(), size.getHeight())); salt.drawU(ug, 1, new Dimension2DDouble(size.getWidth(), size.getHeight())); } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementBorder.java b/src/net/sourceforge/plantuml/salt/element/ElementBorder.java index b0bbb2426..ac63e278e 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementBorder.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementBorder.java @@ -85,8 +85,8 @@ public class ElementBorder extends AbstractElement { // - dimSouth.getHeight()); north.drawU(ug, zIndex, dimToUse); - south.drawU(ug.apply(new UTranslate(0, pC.getY())), zIndex, dimToUse); - west.drawU(ug.apply(new UTranslate(0, pA.getY())), zIndex, dimToUse); + south.drawU(ug.apply(UTranslate.dy(pC.getY())), zIndex, dimToUse); + west.drawU(ug.apply(UTranslate.dy(pA.getY())), zIndex, dimToUse); east.drawU(ug.apply(new UTranslate(pB.getX(), pB.getY())), zIndex, dimToUse); center.drawU(ug.apply(new UTranslate(pA.getX(), pA.getY())), zIndex, dimToUse); } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementButton.java b/src/net/sourceforge/plantuml/salt/element/ElementButton.java index f7ea79bc4..7f0ecb348 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementButton.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementButton.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; @@ -47,6 +46,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementButton extends AbstractElementText implements Element { @@ -70,9 +70,9 @@ public class ElementButton extends AbstractElementText implements Element { } final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); ug = ug.apply(new UStroke(stroke)); - ug = ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE"))); + ug = ug.apply(new UChangeBackColor(HColorSet.instance().getColorIfValid("#EEEEEE"))); ug.apply(new UTranslate(stroke, stroke)).draw( - new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke, 10, 10)); + new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke).rounded(10)); final Dimension2D dimPureText = getPureTextDimension(ug.getStringBounder()); drawText(ug, (dim.getWidth() - dimPureText.getWidth()) / 2, stroke + marginY); } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java index e4b5f53ca..40f96a539 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -54,6 +53,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementDroplist extends AbstractElementText implements Element { @@ -93,11 +93,11 @@ public class ElementDroplist extends AbstractElementText implements Element { public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); if (zIndex == 0) { - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE"))).draw( + ug.apply(new UChangeBackColor(HColorSet.instance().getColorIfValid("#EEEEEE"))).draw( new URectangle(dim.getWidth() - 1, dim.getHeight() - 1)); drawText(ug, 2, 2); final double xline = dim.getWidth() - box; - ug.apply(new UTranslate(xline, 0)).draw(new ULine(0, dim.getHeight() - 1)); + ug.apply(UTranslate.dx(xline)).draw(ULine.vline(dim.getHeight() - 1)); final UPolygon poly = new UPolygon(); poly.addPoint(0, 0); @@ -111,10 +111,10 @@ public class ElementDroplist extends AbstractElementText implements Element { if (openDrop != null) { final Dimension2D dimOpen = Dimension2DDouble.atLeast(openDrop.calculateDimension(ug.getStringBounder()), dim.getWidth() - 1, 0); - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE"))) - .apply(new UTranslate(0, dim.getHeight() - 1)) + ug.apply(new UChangeBackColor(HColorSet.instance().getColorIfValid("#EEEEEE"))) + .apply(UTranslate.dy(dim.getHeight() - 1)) .draw(new URectangle(dimOpen.getWidth() - 1, dimOpen.getHeight() - 1)); - openDrop.drawU(ug.apply(new UTranslate(0, dim.getHeight() - 1))); + openDrop.drawU(ug.apply(UTranslate.dy(dim.getHeight() - 1))); } } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementLine.java b/src/net/sourceforge/plantuml/salt/element/ElementLine.java index 3f0edc08e..a55d806f4 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementLine.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementLine.java @@ -38,13 +38,13 @@ package net.sourceforge.plantuml.salt.element; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementLine extends AbstractElement { @@ -62,7 +62,7 @@ public class ElementLine extends AbstractElement { if (zIndex != 0) { return; } - ug = ug.apply(new UChangeColor(HtmlColorSet.getInstance().getColorIfValid("#AAAAAA"))); + ug = ug.apply(new UChangeColor(HColorSet.instance().getColorIfValid("#AAAAAA"))); double y2 = dimToUse.getHeight() / 2; if (separator == '=') { y2 = y2 - 1; @@ -72,14 +72,14 @@ public class ElementLine extends AbstractElement { private static void drawLine(UGraphic ug, double x, double y, double widthToUse, char separator) { if (separator == '=') { - ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); - ug.apply(new UStroke()).apply(new UTranslate(x, y + 2)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); + ug.apply(new UStroke()).apply(new UTranslate(x, y + 2)).draw(ULine.hline(widthToUse)); } else if (separator == '.') { - ug.apply(new UStroke(1, 2, 1)).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke(1, 2, 1)).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); } else if (separator == '-') { - ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); } else { - ug.apply(new UStroke(1.5)).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke(1.5)).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java index 13a86c536..71aa1f486 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java @@ -43,13 +43,13 @@ import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementMenuBar extends AbstractElement { @@ -106,10 +106,10 @@ public class ElementMenuBar extends AbstractElement { double x1 = 0; if (zIndex == 0) { - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#DDDDDD"))).draw( + ug.apply(new UChangeBackColor(HColorSet.instance().getColorIfValid("#DDDDDD"))).draw( new URectangle(dimToUse.getWidth(), dimToUse.getHeight())); for (ElementMenuEntry entry : entries) { - entry.drawU(ug.apply(new UTranslate(x1, 0)), zIndex, dimToUse); + entry.drawU(ug.apply(UTranslate.dx(x1)), zIndex, dimToUse); final double w = entry.getPreferredDimension(ug.getStringBounder(), x1, 0).getWidth(); entry.setX(x1); x1 += w + 10; @@ -119,7 +119,7 @@ public class ElementMenuBar extends AbstractElement { if (zIndex == 1) { for (ElementMenuEntry entry : popups.keySet()) { - entry.setBackground(HtmlColorSet.getInstance().getColorIfValid("#BBBBBB")); + entry.setBackground(HColorSet.instance().getColorIfValid("#BBBBBB")); } final double y1 = preferred.getHeight(); diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java index 6c1dfcfc9..7d8d44f06 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java @@ -42,19 +42,19 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ElementMenuEntry extends AbstractElement { private final TextBlock block; private final String text; - private HtmlColor background; + private HColor background; private double xxx; public ElementMenuEntry(String text, UFont font, ISkinSimple spriteContainer) { @@ -90,11 +90,11 @@ public class ElementMenuEntry extends AbstractElement { return text; } - public HtmlColor getBackground() { + public HColor getBackground() { return background; } - public void setBackground(HtmlColor background) { + public void setBackground(HColor background) { this.background = background; } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java index 184c88262..57a406742 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java @@ -41,7 +41,6 @@ import java.util.Collection; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementMenuPopup extends AbstractElement { @@ -80,16 +80,16 @@ public class ElementMenuPopup extends AbstractElement { if (zIndex != 1) { return; } - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#DDDDDD"))).draw( + ug.apply(new UChangeBackColor(HColorSet.instance().getColorIfValid("#DDDDDD"))).draw( new URectangle(dimToUse.getWidth(), dimToUse.getHeight())); double y1 = 0; for (ElementMenuEntry entry : entries) { final double h = entry.getPreferredDimension(ug.getStringBounder(), 0, y1).getHeight(); if (entry.getText().equals("-")) { - ug.apply(new UTranslate(0, y1 + h / 2)).draw(new ULine(dimToUse.getWidth(), 0)); + ug.apply(UTranslate.dy(y1 + h / 2)).draw(ULine.hline(dimToUse.getWidth())); } else { - entry.drawU(ug.apply(new UTranslate(0, y1)), zIndex, dimToUse); + entry.drawU(ug.apply(UTranslate.dy(y1)), zIndex, dimToUse); } y1 += h; } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java b/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java index b8053842a..48ebbfb3e 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.salt.Positionner2; import net.sourceforge.plantuml.salt.factory.ScrollStrategy; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ElementPyramidScrolled extends ElementPyramid { @@ -78,10 +78,10 @@ public class ElementPyramidScrolled extends ElementPyramid { super.drawU(ug, zIndex, dimToUse); final Dimension2D dim = super.getPreferredDimension(ug.getStringBounder(), 0, 0); if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.VERTICAL_ONLY) { - drawV(ug.apply(new UTranslate(dim.getWidth() + 4, 0)), v1, dim.getHeight()); + drawV(ug.apply(UTranslate.dx(dim.getWidth() + 4)), v1, dim.getHeight()); } if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.HORIZONTAL_ONLY) { - drawH(ug.apply(new UTranslate(0, dim.getHeight() + 4)), dim.getWidth(), v1); + drawH(ug.apply(UTranslate.dy(dim.getHeight() + 4)), dim.getWidth(), v1); } } @@ -127,18 +127,18 @@ public class ElementPyramidScrolled extends ElementPyramid { private void drawV(UGraphic ug, double width, double height) { ug.draw(new URectangle(width, height)); - ug.apply(new UTranslate(0, v2)).draw(new ULine(width, 0)); - ug.apply(new UTranslate(0, height - v2)).draw(new ULine(width, 0)); - ug.apply(new UTranslate(4, 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr0()); - ug.apply(new UTranslate(4, height - v2 + 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr180()); + ug.apply(UTranslate.dy(v2)).draw(ULine.hline(width)); + ug.apply(UTranslate.dy(height - v2)).draw(ULine.hline(width)); + ug.apply(new UTranslate(4, 4)).apply(new UChangeBackColor(HColorUtils.BLACK)).draw(getTr0()); + ug.apply(new UTranslate(4, height - v2 + 4)).apply(new UChangeBackColor(HColorUtils.BLACK)).draw(getTr180()); } private void drawH(UGraphic ug, double width, double height) { ug.draw(new URectangle(width, height)); - ug.apply(new UTranslate(v2, 0)).draw(new ULine(0, height)); - ug.apply(new UTranslate(width - v2, 0)).draw(new ULine(0, height)); - ug.apply(new UTranslate(4, 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr90()); - ug.apply(new UTranslate(width - v2 + 4, 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr270()); + ug.apply(UTranslate.dx(v2)).draw(ULine.vline(height)); + ug.apply(UTranslate.dx(width - v2)).draw(ULine.vline(height)); + ug.apply(new UTranslate(4, 4)).apply(new UChangeBackColor(HColorUtils.BLACK)).draw(getTr90()); + ug.apply(new UTranslate(width - v2 + 4, 4)).apply(new UChangeBackColor(HColorUtils.BLACK)).draw(getTr270()); } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java b/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java index f6338cfcc..75d45a727 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java @@ -82,7 +82,7 @@ public class ElementRadioCheckbox extends AbstractElement { if (zIndex != 0) { return; } - block.drawU(ug.apply(new UTranslate(margin, 0))); + block.drawU(ug.apply(UTranslate.dx(margin))); final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); final double height = dim.getHeight(); diff --git a/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java b/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java index c1f641d4d..1adbf282f 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java @@ -106,10 +106,10 @@ public class ElementTabBar extends AbstractElement { elt.drawU(ug.apply(new UTranslate(x1 + margin1, y)), zIndex, dimToUse); final Dimension2D dimText = elt.getPreferredDimension(ug.getStringBounder(), x1, y); final double w = dimText.getWidth(); - ug.apply(new UTranslate(x1, y)).draw(new ULine(0, dimText.getHeight())); - ug.apply(new UTranslate(x1, y)).draw(new ULine(w + margin1 + margin2, 0)); - ug.apply(new UTranslate(x1 + w + margin1 + margin2, y)).draw(new ULine(0, dimText.getHeight())); - ug.apply(new UTranslate(x1 + w + margin1 + margin2, y + dimText.getHeight())).draw(new ULine(margin3, 0)); + ug.apply(new UTranslate(x1, y)).draw(ULine.vline(dimText.getHeight())); + ug.apply(new UTranslate(x1, y)).draw(ULine.hline(w + margin1 + margin2)); + ug.apply(new UTranslate(x1 + w + margin1 + margin2, y)).draw(ULine.vline(dimText.getHeight())); + ug.apply(new UTranslate(x1 + w + margin1 + margin2, y + dimText.getHeight())).draw(ULine.hline(margin3)); x1 += w + margin1 + margin2 + margin3; } } @@ -130,13 +130,13 @@ public class ElementTabBar extends AbstractElement { ug = ug.apply(new UTranslate(x, y)); double y1 = x; for (Element elt : tabs) { - elt.drawU(ug.apply(new UTranslate(0, y1 + margin1)), zIndex, dimToUse); + elt.drawU(ug.apply(UTranslate.dy(y1 + margin1)), zIndex, dimToUse); final Dimension2D dimText = elt.getPreferredDimension(ug.getStringBounder(), x, y1); final double h = dimText.getHeight(); - ug.apply(new UTranslate(0, y1)).draw(new ULine(preferred.getWidth(), 0)); - ug.apply(new UTranslate(0, y1)).draw(new ULine(0, h + margin1 + margin2)); - ug.apply(new UTranslate(0, y1 + h + margin1 + margin2)).draw(new ULine(preferred.getWidth(), 0)); - ug.apply(new UTranslate(preferred.getWidth(), y1 + h + margin1 + margin2)).draw(new ULine(0, margin3)); + ug.apply(UTranslate.dy(y1)).draw(ULine.hline(preferred.getWidth())); + ug.apply(UTranslate.dy(y1)).draw(ULine.vline(h + margin1 + margin2)); + ug.apply(UTranslate.dy(y1 + h + margin1 + margin2)).draw(ULine.hline(preferred.getWidth())); + ug.apply(new UTranslate(preferred.getWidth(), y1 + h + margin1 + margin2)).draw(ULine.vline(margin3)); y1 += h + margin1 + margin2 + margin3; } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementTextField.java b/src/net/sourceforge/plantuml/salt/element/ElementTextField.java index 961985e39..f92481aeb 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementTextField.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementTextField.java @@ -63,10 +63,10 @@ public class ElementTextField extends AbstractElementText implements Element { drawText(ug, 3, 0); final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); final Dimension2D textDim = getTextDimensionAt(ug.getStringBounder(), 0); - ug.apply(new UTranslate(1, textDim.getHeight())).draw(new ULine(dim.getWidth() - 3, 0)); + ug.apply(new UTranslate(1, textDim.getHeight())).draw(ULine.hline(dim.getWidth() - 3)); final double y3 = textDim.getHeight() - 3; - ug.apply(new UTranslate(1, y3)).draw(new ULine(0, 2)); - ug.apply(new UTranslate(3 + textDim.getWidth() + 1, y3)).draw(new ULine(0, 2)); + ug.apply(new UTranslate(1, y3)).draw(ULine.vline(2)); + ug.apply(new UTranslate(3 + textDim.getWidth() + 1, y3)).draw(ULine.vline(2)); } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementTree.java b/src/net/sourceforge/plantuml/salt/element/ElementTree.java index 6f0c1363a..09030a082 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementTree.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementTree.java @@ -44,11 +44,11 @@ import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementTree extends AbstractElement { @@ -145,7 +145,7 @@ public class ElementTree extends AbstractElement { yvar += h; rows.add(yvar); } - ug = ug.apply(new UChangeColor(HtmlColorSet.getInstance().getColorIfValid("#888888"))); + ug = ug.apply(new UChangeColor(HColorSet.instance().getColorIfValid("#888888"))); skeleton.draw(ug, 0, 0); if (strategy != TableStrategy.DRAW_NONE) { final Grid2 grid = new Grid2(rows, cols, strategy); diff --git a/src/net/sourceforge/plantuml/salt/element/Grid.java b/src/net/sourceforge/plantuml/salt/element/Grid.java index 7bae8a600..ca458d7c9 100644 --- a/src/net/sourceforge/plantuml/salt/element/Grid.java +++ b/src/net/sourceforge/plantuml/salt/element/Grid.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import java.util.HashSet; import java.util.Set; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.salt.Cell; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -48,6 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Grid { @@ -90,21 +90,21 @@ public class Grid { final int row1 = seg.getRow(); final int col1 = seg.getCol(); final double width = colsStart[col1 + 1] - colsStart[col1]; - ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(new ULine(width, 0)); + ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(ULine.hline(width)); } // Vlines for (Segment seg : verticals) { final int row1 = seg.getRow(); final int col1 = seg.getCol(); final double height = rowsStart[row1 + 1] - rowsStart[row1]; - ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(new ULine(0, height)); + ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(ULine.vline(height)); } final Dimension2D dim = title.calculateDimension(ug.getStringBounder()); if (dim.getWidth() > 0 && dim.getHeight() > 0) { final UGraphic ug2 = ug.apply(new UTranslate(x + 6, y - dim.getHeight() * 0)); - ug2.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UChangeColor(HtmlColorUtils.WHITE)) + ug2.apply(new UChangeBackColor(HColorUtils.WHITE)).apply(new UChangeColor(HColorUtils.WHITE)) .draw(new URectangle(dim)); title.drawU(ug2); } diff --git a/src/net/sourceforge/plantuml/salt/element/Grid2.java b/src/net/sourceforge/plantuml/salt/element/Grid2.java index 8a888a3b2..a0d3b1e47 100644 --- a/src/net/sourceforge/plantuml/salt/element/Grid2.java +++ b/src/net/sourceforge/plantuml/salt/element/Grid2.java @@ -59,19 +59,19 @@ public class Grid2 { final double ymin = rowsStart.get(0); final double ymax = rowsStart.get(rowsStart.size() - 1); if (strategy == TableStrategy.DRAW_OUTSIDE || strategy == TableStrategy.DRAW_OUTSIDE_WITH_TITLE) { - ug.apply(new UTranslate(xmin, ymin)).draw(new ULine(xmax - xmin, 0)); - ug.apply(new UTranslate(xmin, ymax)).draw(new ULine(xmax - xmin, 0)); - ug.apply(new UTranslate(xmin, ymin)).draw(new ULine(0, ymax - ymin)); - ug.apply(new UTranslate(xmax, ymin)).draw(new ULine(0, ymax - ymin)); + ug.apply(new UTranslate(xmin, ymin)).draw(ULine.hline(xmax - xmin)); + ug.apply(new UTranslate(xmin, ymax)).draw(ULine.hline(xmax - xmin)); + ug.apply(new UTranslate(xmin, ymin)).draw(ULine.vline(ymax - ymin)); + ug.apply(new UTranslate(xmax, ymin)).draw(ULine.vline(ymax - ymin)); } if (drawHorizontal()) { for (Double y : rowsStart) { - ug.apply(new UTranslate(xmin, y)).draw(new ULine(xmax - xmin, 0)); + ug.apply(new UTranslate(xmin, y)).draw(ULine.hline(xmax - xmin)); } } if (drawVertical()) { for (Double x : colsStart) { - ug.apply(new UTranslate(x, ymin)).draw(new ULine(0, ymax - ymin)); + ug.apply(new UTranslate(x, ymin)).draw(ULine.vline(ymax - ymin)); } } } diff --git a/src/net/sourceforge/plantuml/salt/element/Skeleton.java b/src/net/sourceforge/plantuml/salt/element/Skeleton.java index 5b8279298..6019cd181 100644 --- a/src/net/sourceforge/plantuml/salt/element/Skeleton.java +++ b/src/net/sourceforge/plantuml/salt/element/Skeleton.java @@ -86,10 +86,10 @@ public class Skeleton { private void drawChild(UGraphic ug, Entry parent, Entry child) { final double dy = child.ypos - parent.ypos - 2; - ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(new ULine(0, dy)); + ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(ULine.vline(dy)); final double dx = child.xpos - parent.xpos - 2; - ug.apply(new UTranslate(parent.xpos + 1, child.ypos + 1)).draw(new ULine(dx, 0)); + ug.apply(new UTranslate(parent.xpos + 1, child.ypos + 1)).draw(ULine.hline(dx)); } diff --git a/src/net/sourceforge/plantuml/salt/element/Skeleton2.java b/src/net/sourceforge/plantuml/salt/element/Skeleton2.java index 634471dc4..5e09cc421 100644 --- a/src/net/sourceforge/plantuml/salt/element/Skeleton2.java +++ b/src/net/sourceforge/plantuml/salt/element/Skeleton2.java @@ -61,13 +61,13 @@ public class Skeleton2 { void drawHline(UGraphic ug) { final double xpos = getXStartForLevel(level); ug.apply(new UTranslate(xpos + sizeX - 1, ypos - 1)).draw(new URectangle(2, 2)); - ug.apply(new UTranslate(xpos, ypos)).draw(new ULine(sizeX, 0)); + ug.apply(new UTranslate(xpos, ypos)).draw(ULine.hline(sizeX)); } public void drawVline(UGraphic ug, double lastY) { // System.err.println("ypos=" + ypos); final double xpos = getXStartForLevel(level); - ug.apply(new UTranslate(xpos, lastY)).draw(new ULine(0, ypos - lastY)); + ug.apply(new UTranslate(xpos, lastY)).draw(ULine.vline(ypos - lastY)); } } @@ -124,7 +124,7 @@ public class Skeleton2 { // // private void drawChild(UGraphic ug, Entry parent, Entry child) { // final double dy = child.ypos - parent.ypos - 2; - // ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(new ULine(0, dy)); + // ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(ULine.dy(dy)); // // final double dx = child.xpos - parent.xpos - 2; // ug.apply(new UTranslate(parent.xpos + 1, child.ypos + 1)).draw(new ULine(dx, 0)); diff --git a/src/net/sourceforge/plantuml/sequencediagram/Englober.java b/src/net/sourceforge/plantuml/sequencediagram/Englober.java index f6b42e923..755ed19cc 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Englober.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Englober.java @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.PaddingParam; import net.sourceforge.plantuml.SkinParamBackcolored; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.RealUtils; @@ -60,6 +59,7 @@ import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Englober implements WithStyle { @@ -78,7 +78,7 @@ public class Englober implements WithStyle { public Style[] getUsedStyles() { Style tmp = getDefaultStyleDefinition().with(participantEnglober.getStereotype()).getMergedStyle(styleBuilder); - final HtmlColor backColor = participantEnglober.getBoxColor(); + final HColor backColor = participantEnglober.getBoxColor(); if (tmp != null) { tmp = tmp.eventuallyOverride(PName.BackGroundColor, backColor); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Grouping.java b/src/net/sourceforge/plantuml/sequencediagram/Grouping.java index 1645dceba..59ee4ee64 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Grouping.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Grouping.java @@ -35,20 +35,20 @@ */ package net.sourceforge.plantuml.sequencediagram; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public abstract class Grouping implements Event, WithStyle { private final String title; private final GroupingType type; private final String comment; - private final HtmlColor backColorElement; + private final HColor backColorElement; // private final StyleBuilder styleBuilder; @@ -70,7 +70,7 @@ public abstract class Grouping implements Event, WithStyle { backColorElement) }; } - public Grouping(String title, String comment, GroupingType type, HtmlColor backColorElement, + public Grouping(String title, String comment, GroupingType type, HColor backColorElement, StyleBuilder styleBuilder) { this.title = title; // this.styleBuilder = styleBuilder; @@ -96,13 +96,13 @@ public abstract class Grouping implements Event, WithStyle { public abstract int getLevel(); - public abstract HtmlColor getBackColorGeneral(); + public abstract HColor getBackColorGeneral(); final public String getComment() { return comment; } - public final HtmlColor getBackColorElement() { + public final HColor getBackColorElement() { return backColorElement; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java b/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java index f500274df..0b961cd63 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java +++ b/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java @@ -39,16 +39,16 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.ugraphic.color.HColor; final public class GroupingLeaf extends Grouping implements EventWithDeactivate { private final GroupingStart start; - private final HtmlColor backColorGeneral; + private final HColor backColorGeneral; - public GroupingLeaf(String title, String comment, GroupingType type, HtmlColor backColorGeneral, - HtmlColor backColorElement, GroupingStart start, StyleBuilder styleBuilder) { + public GroupingLeaf(String title, String comment, GroupingType type, HColor backColorGeneral, + HColor backColorElement, GroupingStart start, StyleBuilder styleBuilder) { super(title, comment, type, backColorElement, styleBuilder); if (start == null) { throw new IllegalArgumentException(); @@ -79,7 +79,7 @@ final public class GroupingLeaf extends Grouping implements EventWithDeactivate } @Override - public final HtmlColor getBackColorGeneral() { + public final HColor getBackColorGeneral() { if (backColorGeneral == null) { return start.getBackColorGeneral(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java b/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java index a1dbab497..7748c0eea 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java +++ b/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java @@ -40,20 +40,20 @@ import java.util.Collections; import java.util.List; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class GroupingStart extends Grouping { private final List children = new ArrayList(); - private final HtmlColor backColorGeneral; + private final HColor backColorGeneral; final private GroupingStart parent; private boolean parallel = false; - public GroupingStart(String title, String comment, HtmlColor backColorGeneral, HtmlColor backColorElement, + public GroupingStart(String title, String comment, HColor backColorGeneral, HColor backColorElement, GroupingStart parent, StyleBuilder styleBuilder) { super(title, comment, GroupingType.START, backColorElement, styleBuilder); this.backColorGeneral = backColorGeneral; @@ -84,7 +84,7 @@ public class GroupingStart extends Grouping { } @Override - public HtmlColor getBackColorGeneral() { + public HColor getBackColorGeneral() { return backColorGeneral; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java index 513ee7321..4c83ac03c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java +++ b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java @@ -43,13 +43,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.sequencediagram.teoz.YPositionedTile; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class LinkAnchor { @@ -91,7 +91,7 @@ public class LinkAnchor { final double ymin = Math.min(y1, y2); final double ymax = Math.max(y1, y2); - final HtmlColor color = new Rose().getHtmlColor(param, ColorParam.arrow); + final HColor color = new Rose().getHtmlColor(param, ColorParam.arrow); final Rainbow rainbow = Rainbow.fromColor(color); final Snake snake = new Snake(Arrows.asToUp(), HorizontalAlignment.CENTER, rainbow, Arrows.asToDown()); diff --git a/src/net/sourceforge/plantuml/sequencediagram/Participant.java b/src/net/sourceforge/plantuml/sequencediagram/Participant.java index 2e8c87fdf..6264bb97f 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Participant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Participant.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -54,6 +53,7 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Participant implements SpecificBackcolorable, WithStyle { @@ -172,7 +172,7 @@ public class Participant implements SpecificBackcolorable, WithStyle { return colors; } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) { if (color != null) { this.colors = colors.add(type, color); } @@ -203,14 +203,14 @@ public class Participant implements SpecificBackcolorable, WithStyle { } public SkinParamBackcolored getSkinParamBackcolored(ISkinParam skinParam) { - HtmlColor specificBackColor = getColors(skinParam).getColor(ColorType.BACK); + HColor specificBackColor = getColors(skinParam).getColor(ColorType.BACK); final boolean clickable = getUrl() != null; - final HtmlColor stereoBackColor = skinParam.getHtmlColor(getBackgroundColorParam(), getStereotype(), clickable); + final HColor stereoBackColor = skinParam.getHtmlColor(getBackgroundColorParam(), getStereotype(), clickable); if (stereoBackColor != null && specificBackColor == null) { specificBackColor = stereoBackColor; } final SkinParamBackcolored result = new SkinParamBackcolored(skinParam, specificBackColor, clickable); - final HtmlColor stereoBorderColor = skinParam.getHtmlColor(ColorParam.participantBorder, getStereotype(), + final HColor stereoBorderColor = skinParam.getHtmlColor(ColorParam.participantBorder, getStereotype(), clickable); if (stereoBorderColor != null) { result.forceColor(ColorParam.participantBorder, stereoBorderColor); diff --git a/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java b/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java index 13c04dda9..a5c62da54 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java +++ b/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java @@ -37,15 +37,15 @@ package net.sourceforge.plantuml.sequencediagram; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ParticipantEnglober { final private Display title; - final private HtmlColor boxColor; + final private HColor boxColor; final private Stereotype stereotype; - public ParticipantEnglober(Display title, HtmlColor boxColor, Stereotype stereotype) { + public ParticipantEnglober(Display title, HColor boxColor, Stereotype stereotype) { this.title = title; this.boxColor = boxColor; this.stereotype = stereotype; @@ -55,7 +55,7 @@ public class ParticipantEnglober { return title; } - public final HtmlColor getBoxColor() { + public final HColor getBoxColor() { return boxColor; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Reference.java b/src/net/sourceforge/plantuml/sequencediagram/Reference.java index 041a6ad35..a034c46f5 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Reference.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Reference.java @@ -41,19 +41,19 @@ import java.util.List; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Reference extends AbstractEvent implements Event { private final List participants; private final Url url; - private final HtmlColor backColorGeneral; - private final HtmlColor backColorElement; + private final HColor backColorGeneral; + private final HColor backColorElement; private final Display strings; @@ -75,8 +75,8 @@ public class Reference extends AbstractEvent implements Event { backColorElement) }; } - public Reference(List participants, Url url, Display strings, HtmlColor backColorGeneral, - HtmlColor backColorElement, StyleBuilder styleBuilder) { + public Reference(List participants, Url url, Display strings, HColor backColorGeneral, + HColor backColorElement, StyleBuilder styleBuilder) { this.participants = participants; this.url = url; this.strings = strings; @@ -119,11 +119,11 @@ public class Reference extends AbstractEvent implements Event { return sb.toString(); } - public final HtmlColor getBackColorGeneral() { + public final HColor getBackColorGeneral() { return backColorGeneral; } - public final HtmlColor getBackColorElement() { + public final HColor getBackColorElement() { return backColorElement; } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index 691550309..8e6543524 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -62,13 +62,13 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker; import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2; import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramTxtMaker; import net.sourceforge.plantuml.sequencediagram.teoz.SequenceDiagramFileMakerTeoz; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SequenceDiagram extends UmlDiagram { @@ -92,8 +92,8 @@ public class SequenceDiagram extends UmlDiagram { public Participant getOrCreateParticipant(String code, Display display) { Participant result = participantsget(code); if (result == null) { - result = new Participant(ParticipantType.PARTICIPANT, code, display, hiddenPortions, 0, getSkinParam() - .getCurrentStyleBuilder()); + result = new Participant(ParticipantType.PARTICIPANT, code, display, hiddenPortions, 0, + getSkinParam().getCurrentStyleBuilder()); addWithOrder(result); participantEnglobers2.put(result, participantEnglober); } @@ -123,8 +123,8 @@ public class SequenceDiagram extends UmlDiagram { // display = Arrays.asList(code); display = Display.getWithNewlines(code); } - final Participant result = new Participant(type, code, display, hiddenPortions, order, getSkinParam() - .getCurrentStyleBuilder()); + final Participant result = new Participant(type, code, display, hiddenPortions, order, + getSkinParam().getCurrentStyleBuilder()); addWithOrder(result); participantEnglobers2.put(result, participantEnglober); return result; @@ -226,7 +226,7 @@ public class SequenceDiagram extends UmlDiagram { return Collections.unmodifiableList(events); } - private FileMaker getSequenceDiagramPngMaker(FileFormatOption fileFormatOption) { + private FileMaker getSequenceDiagramPngMaker(int index, FileFormatOption fileFormatOption) { final FileFormat fileFormat = fileFormatOption.getFileFormat(); @@ -235,7 +235,7 @@ public class SequenceDiagram extends UmlDiagram { } if (modeTeoz()) { - return new SequenceDiagramFileMakerTeoz(this, skin2, fileFormatOption); + return new SequenceDiagramFileMakerTeoz(this, skin2, fileFormatOption, index); } return new SequenceDiagramFileMakerPuma2(this, skin2, fileFormatOption); @@ -248,7 +248,7 @@ public class SequenceDiagram extends UmlDiagram { @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormat) throws IOException { - final FileMaker sequenceDiagramPngMaker = getSequenceDiagramPngMaker(fileFormat); + final FileMaker sequenceDiagramPngMaker = getSequenceDiagramPngMaker(index, fileFormat); return sequenceDiagramPngMaker.createOne(os, index, fileFormat.isWithMetadata()); } @@ -264,11 +264,11 @@ public class SequenceDiagram extends UmlDiagram { private LifeEvent pendingCreate = null; - public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor) { + public String activate(Participant p, LifeEventType lifeEventType, HColor backcolor) { return activate(p, lifeEventType, backcolor, null); } - public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor, HtmlColor linecolor) { + public String activate(Participant p, LifeEventType lifeEventType, HColor backcolor, HColor linecolor) { if (lastDelay != null) { return "You cannot Activate/Deactivate just after a ..."; } @@ -305,8 +305,8 @@ public class SequenceDiagram extends UmlDiagram { private final List openGroupings = new ArrayList(); - public boolean grouping(String title, String comment, GroupingType type, HtmlColor backColorGeneral, - HtmlColor backColorElement, boolean parallel) { + public boolean grouping(String title, String comment, GroupingType type, HColor backColorGeneral, + HColor backColorElement, boolean parallel) { if (type != GroupingType.START && openGroupings.size() == 0) { return false; } @@ -316,9 +316,11 @@ public class SequenceDiagram extends UmlDiagram { final GroupingStart top = openGroupings.size() > 0 ? openGroupings.get(0) : null; - final Grouping g = type == GroupingType.START ? new GroupingStart(title, comment, backColorGeneral, - backColorElement, top, getSkinParam().getCurrentStyleBuilder()) : new GroupingLeaf(title, comment, - type, backColorGeneral, backColorElement, top, getSkinParam().getCurrentStyleBuilder()); + final Grouping g = type == GroupingType.START + ? new GroupingStart(title, comment, backColorGeneral, backColorElement, top, + getSkinParam().getCurrentStyleBuilder()) + : new GroupingLeaf(title, comment, type, backColorGeneral, backColorElement, top, + getSkinParam().getCurrentStyleBuilder()); events.add(g); if (type == GroupingType.START) { @@ -356,7 +358,8 @@ public class SequenceDiagram extends UmlDiagram { // autoNumber.resume(decimalFormat); // } // - // public final void autonumberResume(int increment, DecimalFormat decimalFormat) { + // public final void autonumberResume(int increment, DecimalFormat + // decimalFormat) { // autoNumber.resume(increment, decimalFormat); // } @@ -392,7 +395,7 @@ public class SequenceDiagram extends UmlDiagram { private ParticipantEnglober participantEnglober; - public void boxStart(Display comment, HtmlColor color, Stereotype stereotype) { + public void boxStart(Display comment, HColor color, Stereotype stereotype) { if (participantEnglober != null) { throw new IllegalStateException(); } @@ -413,7 +416,7 @@ public class SequenceDiagram extends UmlDiagram { @Override public int getNbImages() { try { - return getSequenceDiagramPngMaker(new FileFormatOption(FileFormat.PNG)).getNbPages(); + return getSequenceDiagramPngMaker(1, new FileFormatOption(FileFormat.PNG)).getNbPages(); } catch (Throwable t) { t.printStackTrace(); return 1; @@ -518,7 +521,7 @@ public class SequenceDiagram extends UmlDiagram { return super.checkFinalError(); } - private final Set hiddenPortions = EnumSet. noneOf(EntityPortion.class); + private final Set hiddenPortions = EnumSet.noneOf(EntityPortion.class); public void hideOrShow(Set portions, boolean show) { if (show) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java index 2e225f703..f351f8fdb 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java @@ -44,10 +44,10 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandActivate extends SingleLineCommand2 { @@ -74,8 +74,8 @@ public class CommandActivate extends SingleLineCommand2 { final LifeEventType type = LifeEventType.valueOf(StringUtils.goUpperCase(arg.get("TYPE", 0))); final Participant p = diagram.getOrCreateParticipant(StringUtils .eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("WHO", 0))); - final HtmlColor backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("BACK", 0)); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINE", 0)); + final HColor backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("BACK", 0)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINE", 0)); final String error = diagram.activate(p, type, backColor, lineColor); if (error == null) { return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java index 7b72b2e19..f1bec2a55 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java @@ -52,8 +52,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.Participant; @@ -63,6 +61,8 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowDecoration; import net.sourceforge.plantuml.skin.ArrowHead; import net.sourceforge.plantuml.skin.ArrowPart; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandArrow extends SingleLineCommand2 { @@ -263,7 +263,7 @@ public class CommandArrow extends SingleLineCommand2 { return CommandExecutionResult.error(error); } - final HtmlColor activationColor = diagram.getSkinParam().getIHtmlColorSet() + final HColor activationColor = diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("LIFECOLOR", 0)); if (activationSpec != null) { @@ -323,7 +323,7 @@ public class CommandArrow extends SingleLineCommand2 { config = config.withBody(ArrowBody.HIDDEN); // link.goHidden(); } else { - config = config.withColor(HtmlColorSet.getInstance().getColorIfValid(s)); + config = config.withColor(HColorSet.instance().getColorIfValid(s)); } } return config; diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java index 235ba8d00..016a76e61 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.MessageExoType; @@ -56,6 +55,7 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowDecoration; import net.sourceforge.plantuml.skin.ArrowHead; import net.sourceforge.plantuml.skin.ArrowPart; +import net.sourceforge.plantuml.ugraphic.color.HColor; abstract class CommandExoArrowAny extends SingleLineCommand2 { @@ -148,7 +148,7 @@ abstract class CommandExoArrowAny extends SingleLineCommand2 { return CommandExecutionResult.error(error); } - final HtmlColor activationColor = diagram.getSkinParam().getIHtmlColorSet() + final HColor activationColor = diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("LIFECOLOR", 0)); if (activationSpec != null) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java index 0413113c0..05c203207 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java @@ -47,9 +47,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.GroupingType; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandGrouping extends SingleLineCommand2 { @@ -72,10 +72,10 @@ public class CommandGrouping extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) { String type = StringUtils.goLowerCase(arg.get("TYPE", 0)); - final HtmlColor backColorElement = diagram.getSkinParam().getIHtmlColorSet() + final HColor backColorElement = diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("COLORS", 0)); - final HtmlColor backColorGeneral = diagram.getSkinParam().getIHtmlColorSet() - .getColorIfValid(arg.get("COLORS", 1), true); + final HColor backColorGeneral = diagram.getSkinParam().getIHtmlColorSet() + .getColorIfValid(arg.get("COLORS", 1), diagram.getSkinParam().getBackgroundColor()); String comment = arg.get("COMMENT", 0); final GroupingType groupingType = GroupingType.getType(type); if ("group".equals(type)) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java index db8914128..4254690bd 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java @@ -46,10 +46,10 @@ import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandMultilines; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandReferenceMultilinesOverSeveral extends CommandMultilines { @@ -66,8 +66,8 @@ public class CommandReferenceMultilinesOverSeveral extends CommandMultilines line0 = StringUtils.getSplit(getStartingPattern(), lines.getFirst499().getTrimmed() .getString()); - final HtmlColor backColorElement = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get(0)); - // final HtmlColor backColorGeneral = HtmlColorSet.getInstance().getColorIfValid(line0.get(1)); + final HColor backColorElement = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get(0)); + // final HtmlColor backColorGeneral = HtmlColorSetSimple.instance().getColorIfValid(line0.get(1)); final List participants = StringUtils.splitComma(line0.get(1)); final List p = new ArrayList(); @@ -88,7 +88,7 @@ public class CommandReferenceMultilinesOverSeveral extends CommandMultilines { @@ -77,8 +77,8 @@ public class CommandReferenceOverSeveral extends SingleLineCommand2 participants = StringUtils.splitComma(arg.get("PARTS", 0)); final String url = arg.get("URL", 0); @@ -97,7 +97,7 @@ public class CommandReferenceOverSeveral extends SingleLineCommand2 { @@ -92,7 +91,7 @@ public class CommandReturn extends SingleLineCommand2 { ArrowConfiguration arrow = message1.getArrowConfiguration().withBody(ArrowBody.DOTTED); final String color = arg.get("COLOR", 0); if (color != null) { - arrow = arrow.withColor(HtmlColorSet.getInstance().getColorIfValid(color)); + arrow = arrow.withColor(HColorSet.instance().getColorIfValid(color)); } final Display display = Display.getWithNewlines(arg.get("MESSAGE", 0)); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java index 836382bf3..381ffc8b2 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java @@ -97,7 +97,7 @@ class ArrowAndParticipant extends Arrow implements InGroupable { arrow.drawInternalU(ug, maxX, context); } else { final double boxWidth = participantBox.getPreferredWidth(ug.getStringBounder()); - arrow.drawInternalU(ug.apply(new UTranslate(boxWidth / 2 - paddingParticipant, 0)), maxX, context); + arrow.drawInternalU(ug.apply(UTranslate.dx(boxWidth / 2 - paddingParticipant)), maxX, context); } final double arrowHeight = arrow.getPreferredHeight(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java index a80d99dad..dced37e32 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java @@ -296,7 +296,7 @@ public class DrawableSet { private UTranslate getTranslate4(final double delta) { if (delta > 0) { - return new UTranslate(0, -delta); + return UTranslate.dy(-delta); } return new UTranslate(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java index a590e589d..9e7a3bc3a 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java @@ -56,7 +56,7 @@ class GraphicalDivider extends GraphicalElement { @Override protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { - ug = ug.apply(new UTranslate(0, getStartingY())); + ug = ug.apply(UTranslate.dy(getStartingY())); final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dim = new Dimension2DDouble(maxX, comp.getPreferredHeight(stringBounder)); comp.drawU(ug, new Area(dim), context); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java index 6dc63bb34..edd052356 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java @@ -58,7 +58,7 @@ class GraphicalNewpage extends GraphicalElement { @Override protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { //final double x = ug.getTranslateX(); - ug = ug.apply(new UTranslate(0, getStartingY())); + ug = ug.apply(UTranslate.dy(getStartingY())); final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dim = new Dimension2DDouble(maxX, comp.getPreferredHeight(stringBounder)); comp.drawU(ug, new Area(dim), context); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java index 29c79143f..291f8ec00 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java @@ -103,7 +103,7 @@ class GroupingGraphicalElementHeader extends GroupingGraphicalElement { comp.drawU(ug, new Area(dim), context); for (Component note : notes) { final Dimension2D dimNote = note.getPreferredDimension(stringBounder); - note.drawU(ug.apply(new UTranslate(x2 - x1, 0)), new Area(dimNote), context); + note.drawU(ug.apply(UTranslate.dx(x2 - x1)), new Area(dimNote), context); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java index a16da8072..bd7b37c48 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SkinParamForceColor; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.Component; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class LifeLine { @@ -203,15 +203,15 @@ public class LifeLine { public void drawU(UGraphic ug, Rose skin, ISkinParam skinParam) { final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UTranslate(getStartingX(stringBounder), 0)); + ug = ug.apply(UTranslate.dx(getStartingX(stringBounder))); for (int i = 0; i < events.size(); i++) { ComponentType type = ComponentType.ALIVE_BOX_CLOSE_OPEN; for (final Iterator it = getSegmentsCutted(stringBounder, i).iterator(); it.hasNext();) { final SegmentColored seg = it.next(); - final HtmlColor specificBackColor = seg.getSpecificBackColor(); + final HColor specificBackColor = seg.getSpecificBackColor(); ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, specificBackColor); - final HtmlColor specificLineColor = seg.getSpecificLineColor(); + final HColor specificLineColor = seg.getSpecificLineColor(); if (specificLineColor != null) { skinParam2 = new SkinParamForceColor(skinParam2, ColorParam.sequenceLifeLineBorder, specificLineColor); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java index 078c47877..de176a036 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java @@ -149,14 +149,14 @@ public class ParticipantBox implements Pushable { // ug.translate(outMargin, 0); final StringBounder stringBounder = ug.getStringBounder(); head.drawU( - ug.apply(new UTranslate(outMargin, 0)), + ug.apply(UTranslate.dx(outMargin)), new Area(new Dimension2DDouble(head.getPreferredWidth(stringBounder), head .getPreferredHeight(stringBounder))), new SimpleContext2D(false)); // ug.translate(-outMargin, 0); } public void drawLineU22(UGraphic ug, double startingY, final double endingY, boolean showTail, double myDelta) { - ug = ug.apply(new UTranslate(startingX, 0)); + ug = ug.apply(UTranslate.dx(startingX)); if (delays.size() > 0) { final StringBounder stringBounder = ug.getStringBounder(); for (GraphicalDelayText delay : delays) { @@ -185,7 +185,7 @@ public class ParticipantBox implements Pushable { private void drawLine(UGraphic ug, double startingY, double endingY, Component comp) { final StringBounder stringBounder = ug.getStringBounder(); - comp.drawU(ug.apply(new UTranslate(0, startingY)), + comp.drawU(ug.apply(UTranslate.dy(startingY)), new Area(new Dimension2DDouble(head.getPreferredWidth(stringBounder) + outMargin * 2, endingY - startingY)), new SimpleContext2D(false)); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java index 0dc367542..d35a22ed7 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java @@ -41,7 +41,6 @@ import java.util.Collection; import java.util.Iterator; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.Area; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class SegmentColored { @@ -68,14 +68,14 @@ class SegmentColored { this.pos1Initial = pos1Initial; } - public HtmlColor getSpecificBackColor() { + public HColor getSpecificBackColor() { if (colors == null) { return null; } return colors.getBackColor(); } - public HtmlColor getSpecificLineColor() { + public HColor getSpecificLineColor() { if (colors == null) { return null; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java index 5c9ea175d..e7feb2eb2 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java @@ -56,7 +56,6 @@ import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -75,6 +74,7 @@ import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SequenceDiagramFileMakerPuma2 implements FileMaker { @@ -266,7 +266,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { return; } text.drawU(ug.apply(new UTranslate(area.getFooterX(diagram.getFooter().getHorizontalAlignment()), area - .getFooterY() + legendHeight))); + .getFooterY() + legendHeight))); } private void drawHeader(SequenceDiagramArea area, UGraphic ug, int page) { @@ -276,7 +276,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { return; } text.drawU(ug.apply(new UTranslate(area.getHeaderX(diagram.getHeader().getHorizontalAlignment()), area - .getHeaderY()))); + .getHeaderY()))); } private double oneOf(double a, double b) { @@ -308,8 +308,8 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { private PngTitler getPngTitler(final FontParam fontParam, int page) { final ISkinParam skinParam = diagram.getSkinParam(); - final HtmlColor hyperlinkColor = skinParam.getHyperlinkColor(); - final HtmlColor titleColor = skinParam.getFontHtmlColor(null, fontParam); + final HColor hyperlinkColor = skinParam.getHyperlinkColor(); + final HColor titleColor = skinParam.getFontHtmlColor(null, fontParam); final String fontFamily = skinParam.getFont(null, false, fontParam).getFamily(null); final int fontSize = skinParam.getFont(null, false, fontParam).getSize(); final DisplaySection display = diagram.getFooterOrHeaderTeoz(fontParam).withPage(page + 1, pages.size()); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java index fd3b0f1b6..45d670f0c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java @@ -111,7 +111,7 @@ public class SequenceDiagramTxtMaker implements FileMaker { if (title.isWhite()) { ug2 = ug; } else { - ug2 = (UGraphicTxt) ug.apply(new UTranslate(0, title.as().size() + 1)); + ug2 = (UGraphicTxt) ug.apply(UTranslate.dy(title.as().size() + 1)); } drawableSet.drawU22(ug2, 0, fullDimension.getWidth(), page, diagram.isShowFootbox()); if (title.isWhite() == false) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java index f959b3b34..ac13d3570 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java @@ -51,15 +51,15 @@ public abstract class AbstractTile implements Tile { return result; } - public boolean matchAnchor(String anchor) { + public Tile matchAnchorV1(String anchor) { final Event event = this.getEvent(); if (event instanceof AbstractMessage) { final AbstractMessage msg = (AbstractMessage) event; if (anchor.equals(msg.getAnchor())) { - return true; + return this; } } - return false; + return null; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java index d7164c9d9..b277feb3a 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java @@ -121,7 +121,7 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate } final Area area = new Area(x2 - x1, dim.getHeight()); - ug = ug.apply(new UTranslate(x1, 0)); + ug = ug.apply(UTranslate.dx(x1)); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java index 0e7114e84..0efc9b38a 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java @@ -171,7 +171,7 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta } x2 += LIVE_DELTA_SIZE * level2; area = new Area(x1 - x2, dim.getHeight()); - ug = ug.apply(new UTranslate(x2, 0)); + ug = ug.apply(UTranslate.dx(x2)); if (isCreate()) { livingSpace2.drawHead(ug, (Context2D) ug, VerticalAlignment.TOP, HorizontalAlignment.RIGHT); } @@ -184,9 +184,9 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta x1 += LIVE_DELTA_SIZE * level1; x2 += LIVE_DELTA_SIZE * level2; area = new Area(x2 - x1, dim.getHeight()); - ug = ug.apply(new UTranslate(x1, 0)); + ug = ug.apply(UTranslate.dx(x1)); if (isCreate()) { - livingSpace2.drawHead(ug.apply(new UTranslate(area.getDimensionToUse().getWidth(), 0)), (Context2D) ug, + livingSpace2.drawHead(ug.apply(UTranslate.dx(area.getDimensionToUse().getWidth())), (Context2D) ug, VerticalAlignment.TOP, HorizontalAlignment.LEFT); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java index 564e87193..5e5e45979 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.AbstractMessage; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommunicationTileNoteBottom extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY { @@ -119,7 +119,7 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit private final double spacey = 10; private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) { - final HtmlColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); + final HColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); final double dx = x2 - x1; final double dy = y2 - y1; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java index af839e449..96b5cf6bc 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java @@ -103,7 +103,7 @@ public class CommunicationTileNoteLeft extends AbstractTile implements TileWithU tile.drawU(ug); final Real p = getNotePosition(stringBounder); - comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug); } public double getPreferredHeight(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java index ba5932c04..9c35dae9f 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java @@ -111,7 +111,7 @@ public class CommunicationTileNoteRight extends AbstractTile implements TileWith tile.drawU(ug); final Real p = getNotePosition(stringBounder); - comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug); } public double getPreferredHeight(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java index fe55a2e7a..a360979cb 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.AbstractMessage; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommunicationTileNoteTop extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY { @@ -103,14 +103,14 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Area area = new Area(dim.getWidth(), dim.getHeight()); - tile.drawU(ug.apply(new UTranslate(0, dim.getHeight() + spacey))); + tile.drawU(ug.apply(UTranslate.dy(dim.getHeight() + spacey))); final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder) .getCurrentValue()) / 2; final double xNote = getNotePosition(stringBounder).getCurrentValue(); - comp.drawU(ug.apply(new UTranslate(xNote, 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(xNote)), area, (Context2D) ug); drawLine(ug, middleMsg, tile.getYPoint(stringBounder) + dim.getHeight() + spacey, xNote + dim.getWidth() / 2, dim.getHeight() - 2 * Rose.paddingY); @@ -120,7 +120,7 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp private final double spacey = 10; private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) { - final HtmlColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); + final HColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); final double dx = x2 - x1; final double dy = y2 - y1; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java index 6196b02d8..7db19bc75 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java @@ -140,7 +140,7 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat // // x1 += CommunicationTile.LIVE_DELTA_SIZE * levelConsidere; // } area.setDeltaX1((levelIgnore - levelConsidere) * CommunicationTile.LIVE_DELTA_SIZE); - ug = ug.apply(new UTranslate(x1, 0)); + ug = ug.apply(UTranslate.dx(x1)); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java index f26c6dbfc..546bcf7cc 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java @@ -99,7 +99,7 @@ public class CommunicationTileSelfNoteRight extends AbstractTile implements Tile tile.drawU(ug); final Real p = getNotePosition(stringBounder); - comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug); } public double getPreferredHeight(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java index 407198621..d7e59329c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java @@ -102,7 +102,7 @@ public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY { final Area area = new Area(getPreferredWidth(stringBounder), dim.getHeight()); tileArguments.getLivingSpaces().delayOn(y, dim.getHeight()); - ug = ug.apply(new UTranslate(getMinX(stringBounder).getCurrentValue(), 0)); + ug = ug.apply(UTranslate.dx(getMinX(stringBounder).getCurrentValue())); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java index 964182495..f7795fb7b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java @@ -83,7 +83,7 @@ public class DividerTile extends AbstractTile implements Tile { final Area area = new Area(tileArguments.getBorder2() - tileArguments.getBorder1() - origin.getCurrentValue(), dim.getHeight()); - ug = ug.apply(new UTranslate(tileArguments.getBorder1(), 0)); + ug = ug.apply(UTranslate.dx(tileArguments.getBorder1())); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java index 681a3c5ec..6b7be4fb9 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java @@ -87,12 +87,23 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY { return 0; } + @Override + public Tile matchAnchorV1(String anchor) { + for (Tile tile : tiles) { + final Tile result = tile.matchAnchorV1(anchor); + if (result != null) { + return result; + } + } + return super.matchAnchorV1(anchor); + } + public GroupingTile(Iterator it, GroupingStart start, TileArguments tileArgumentsBachColorChanged, TileArguments tileArgumentsOriginal) { final StringBounder stringBounder = tileArgumentsOriginal.getStringBounder(); this.start = start; - this.display = start.getTitle().equals("group") ? Display.create(start.getComment()) : Display.create( - start.getTitle(), start.getComment()); + this.display = start.getTitle().equals("group") ? Display.create(start.getComment()) + : Display.create(start.getTitle(), start.getComment()); this.skin = tileArgumentsOriginal.getSkin(); // this.skinParam = tileArgumentsOriginal.getSkinParam(); this.skinParam = tileArgumentsBachColorChanged.getSkinParam(); @@ -155,14 +166,15 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY { final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), getTotalHeight(stringBounder)); if (ug instanceof LiveBoxFinder == false) { - comp.drawU(ug.apply(new UTranslate(min.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(min.getCurrentValue())), area, (Context2D) ug); drawAllElses(ug); } - // ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)).draw(new URectangle(area.getDimensionToUse())); + // ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)).draw(new + // URectangle(area.getDimensionToUse())); double h = dim1.getHeight() + MARGINY / 2; for (Tile tile : tiles) { - ug.apply(new UTranslate(0, h)).draw(tile); + ug.apply(UTranslate.dy(h)).draw(tile); final double preferredHeight = tile.getPreferredHeight(stringBounder); h += preferredHeight; } @@ -176,7 +188,8 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY { private void drawAllElses(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final double totalHeight = getTotalHeight(stringBounder); - // final double suppHeight = getPreferredDimensionIfEmpty(stringBounder).getHeight() + MARGINY / 2; + // final double suppHeight = + // getPreferredDimensionIfEmpty(stringBounder).getHeight() + MARGINY / 2; final List ys = new ArrayList(); for (Tile tile : tiles) { if (tile instanceof ElseTile) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java index 4daa64fd5..5ed13a66d 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java @@ -87,7 +87,7 @@ public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs final Component cross = skin.createComponent(null, ComponentType.DESTROY, null, skinParam, null); final Dimension2D dimCross = cross.getPreferredDimension(ug.getStringBounder()); final double x = livingSpace.getPosC(ug.getStringBounder()).getCurrentValue(); - cross.drawU(ug.apply(new UTranslate(x - dimCross.getWidth() / 2, 0)), null, (Context2D) ug); + cross.drawU(ug.apply(UTranslate.dx(x - dimCross.getWidth() / 2)), null, (Context2D) ug); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java index 94e64a807..886f8e93b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java @@ -37,8 +37,6 @@ package net.sourceforge.plantuml.sequencediagram.teoz; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -48,6 +46,8 @@ import net.sourceforge.plantuml.ugraphic.UParamNull; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class LiveBoxFinder implements UGraphic { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java index 932561d96..b783fb506 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java @@ -87,7 +87,7 @@ public class LiveBoxes { private void drawOneLevel(UGraphic ug, int levelToDraw, Stairs2 stairs, Context2D context) { final LiveBoxesDrawer drawer = new LiveBoxesDrawer(context, skin, skinParam, delays); - ug = ug.apply(new UTranslate((levelToDraw - 1) * drawer.getWidth(ug.getStringBounder()) / 2.0, 0)); + ug = ug.apply(UTranslate.dx((levelToDraw - 1) * drawer.getWidth(ug.getStringBounder()) / 2.0)); boolean pending = true; for (Iterator it = stairs.getYs().iterator(); it.hasNext();) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java index a32f6ab16..d3f7d1226 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java @@ -177,10 +177,10 @@ public class LivingSpace { p.getSkinParamBackcolored(skinParam), p.getDisplay(skinParam.forceSequenceParticipantUnderlined())); final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder()); if (horizontalAlignment == HorizontalAlignment.RIGHT) { - ug = ug.apply(new UTranslate(-dim.getWidth(), 0)); + ug = ug.apply(UTranslate.dx(-dim.getWidth())); } if (verticalAlignment == VerticalAlignment.CENTER) { - ug = ug.apply(new UTranslate(0, -dim.getHeight() / 2)); + ug = ug.apply(UTranslate.dy(-dim.getHeight() / 2)); } final Area area = new Area(dim); final Url url = getParticipant().getUrl(); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java index 156cc914c..8f4427180 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java @@ -136,7 +136,7 @@ public class LivingSpaces { // } // System.err.println("drawing lines " + livingSpace); final double x = livingSpace.getPosC(ug.getStringBounder()).getCurrentValue(); - livingSpace.drawLineAndLiveBoxes(ug.apply(new UTranslate(x, 0)), height, context); + livingSpace.drawLineAndLiveBoxes(ug.apply(UTranslate.dx(x)), height, context); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java index 497e4bd6f..872bce870 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java @@ -110,7 +110,7 @@ public class MutingLine { final Component comp = skin.createComponent(new Style[] { style }, defaultLineType, null, skinParam, null); final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder()); final Area area = new Area(dim.getWidth(), y2 - y1); - comp.drawU(ug.apply(new UTranslate(0, y1)), area, context); + comp.drawU(ug.apply(UTranslate.dy(y1)), area, context); } public void delayOn(double y, double height) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java index 3df211f46..17348cc28 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java @@ -101,7 +101,7 @@ public class NoteTile extends AbstractTile implements Tile { final double x = getX(stringBounder).getCurrentValue(); final Area area = new Area(getUsedWidth(stringBounder), dim.getHeight()); - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java index 9ee0b25b3..e85f37948 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java @@ -99,7 +99,7 @@ public class NotesTile extends AbstractTile implements Tile { final double x = getX(stringBounder, note).getCurrentValue(); final Area area = new Area(getUsedWidth(stringBounder, note), dim.getHeight()); - final UGraphic ug2 = ug.apply(new UTranslate(x, 0)); + final UGraphic ug2 = ug.apply(UTranslate.dx(x)); comp.drawU(ug2, area, (Context2D) ug2); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java index 57353c7e6..9215b0c2b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java @@ -128,7 +128,7 @@ public class PlayingSpace implements Bordered { private YPositionedTile getFromAnchor(List positionedTiles, String anchor) { for (YPositionedTile tile : positionedTiles) { - if (tile.matchAnchor(anchor)) { + if (tile.matchAnchorV2(anchor)) { return tile; } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java index 1b108c73e..61a5c5336 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java @@ -40,7 +40,6 @@ import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.VerticalAlignment; @@ -52,6 +51,7 @@ import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PlayingSpaceWithParticipants extends AbstractTextBlock implements TextBlock { @@ -91,26 +91,26 @@ public class PlayingSpaceWithParticipants extends AbstractTextBlock implements T final double headHeight = livingSpaces.getHeadHeight(stringBounder); if (ymax == 0) { - playingSpace.drawBackground(ug.apply(new UTranslate(0, headHeight))); + playingSpace.drawBackground(ug.apply(UTranslate.dy(headHeight))); } else { final UClip clip = new UClip(-1000, ymin, Double.MAX_VALUE, ymax - ymin + 1); - playingSpace.drawBackground(ug.apply(new UTranslate(0, headHeight)).apply(clip)); + playingSpace.drawBackground(ug.apply(UTranslate.dy(headHeight)).apply(clip)); } - livingSpaces.drawLifeLines(ug.apply(new UTranslate(0, headHeight)), height, context); + livingSpaces.drawLifeLines(ug.apply(UTranslate.dy(headHeight)), height, context); livingSpaces.drawHeads(ug, context, VerticalAlignment.BOTTOM); if (playingSpace.isShowFootbox()) { - livingSpaces.drawHeads(ug.apply(new UTranslate(0, height + headHeight)), context, VerticalAlignment.TOP); + livingSpaces.drawHeads(ug.apply(UTranslate.dy(height + headHeight)), context, VerticalAlignment.TOP); } if (ymax == 0) { - playingSpace.drawForeground(ug.apply(new UTranslate(0, headHeight))); + playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight))); } else { final UClip clip = new UClip(-1000, ymin, Double.MAX_VALUE, ymax - ymin + 1); - // playingSpace.drawForeground(new UGraphicNewpages(ug.apply(new UTranslate(0, headHeight)), ymin, ymax)); - playingSpace.drawForeground(ug.apply(new UTranslate(0, headHeight)).apply(clip)); + // playingSpace.drawForeground(new UGraphicNewpages(ug.apply(UTranslate.dy(headHeight)), ymin, ymax)); + playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight)).apply(clip)); } - // drawNewPages(ug.apply(new UTranslate(0, headHeight))); + // drawNewPages(ug.apply(UTranslate.dy(headHeight))); } public Real getMinX(StringBounder stringBounder) { @@ -132,12 +132,12 @@ public class PlayingSpaceWithParticipants extends AbstractTextBlock implements T } private void drawNewPages(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)); + ug = ug.apply(new UChangeColor(HColorUtils.BLUE)); for (Double change : yNewPages()) { if (change == 0 || change == Double.MAX_VALUE) { continue; } - ug.apply(new UTranslate(0, change)).draw(new ULine(100, 0)); + ug.apply(UTranslate.dy(change)).draw(ULine.hline(100)); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java index 52d20d6f3..39bb1e6e7 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java @@ -106,7 +106,7 @@ public class ReferenceTile extends AbstractTile implements Tile { final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Area area = new Area(last.getCurrentValue() - first.getCurrentValue(), dim.getHeight()); - ug = ug.apply(new UTranslate(first.getCurrentValue(), 0)); + ug = ug.apply(UTranslate.dx(first.getCurrentValue())); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index f6dbe4135..0d7cf1227 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -73,6 +72,7 @@ import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class SequenceDiagramFileMakerTeoz implements FileMaker { @@ -81,17 +81,20 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { private final FileFormatOption fileFormatOption; private final Rose skin; private final AnnotatedWorker annotatedWorker; + private final int index; - public SequenceDiagramFileMakerTeoz(SequenceDiagram sequenceDiagram, Rose skin, FileFormatOption fileFormatOption) { + public SequenceDiagramFileMakerTeoz(SequenceDiagram sequenceDiagram, Rose skin, FileFormatOption fileFormatOption, + int index) { + this.index = index; this.stringBounder = fileFormatOption.getDefaultStringBounder(); this.diagram = sequenceDiagram; this.fileFormatOption = fileFormatOption; this.skin = skin; + this.body = new PlayingSpaceWithParticipants(createMainTile()); this.footer = getFooterOrHeader(FontParam.FOOTER); this.header = getFooterOrHeader(FontParam.HEADER); this.annotatedWorker = new AnnotatedWorker(sequenceDiagram, sequenceDiagram.getSkinParam(), stringBounder); - this.body = new PlayingSpaceWithParticipants(createMainTile()); this.min1 = body.getMinX(stringBounder); this.title = getTitle(); @@ -101,10 +104,10 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { this.heightEnglober1 = englobers.getOffsetForEnglobers(stringBounder); this.heightEnglober2 = heightEnglober1 == 0 ? 0 : 10; - final double totalWidth = MathUtils.max(body.calculateDimension(stringBounder).getWidth(), title - .calculateDimension(stringBounder).getWidth(), footer.calculateDimension(stringBounder).getWidth(), - header.calculateDimension(stringBounder).getWidth(), legend.calculateDimension(stringBounder) - .getWidth()); + final double totalWidth = MathUtils.max(body.calculateDimension(stringBounder).getWidth(), + title.calculateDimension(stringBounder).getWidth(), footer.calculateDimension(stringBounder).getWidth(), + header.calculateDimension(stringBounder).getWidth(), + legend.calculateDimension(stringBounder).getWidth()); final double totalHeight = body.calculateDimension(stringBounder).getHeight() + heightEnglober1 + heightEnglober2 + title.calculateDimension(stringBounder).getHeight() + header.calculateDimension(stringBounder).getHeight() @@ -139,6 +142,9 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { } public ImageData createOne(OutputStream os, final int index, boolean isWithMetadata) throws IOException { + if (this.index != index) { + throw new IllegalStateException(); + } final double dpiFactor = diagram.getDpiFactor(fileFormatOption, dimTotal); final double scale = 1; @@ -173,11 +179,11 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { ug = goDown(ug, legend); } final double dx = (dimTotal.getWidth() - body.calculateDimension(stringBounder).getWidth()) / 2; - return ug.apply(new UTranslate(dx, 0)); + return ug.apply(UTranslate.dx(dx)); } private UGraphic goDown(UGraphic ug, TextBlock size) { - return ug.apply(new UTranslate(0, size.calculateDimension(stringBounder).getHeight())); + return ug.apply(UTranslate.dy(size.calculateDimension(stringBounder).getHeight())); } public void printAligned(UGraphic ug, HorizontalAlignment align, final TextBlock layer) { @@ -187,21 +193,21 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { } else if (align == HorizontalAlignment.CENTER) { dx = (dimTotal.getWidth() - layer.calculateDimension(stringBounder).getWidth()) / 2; } - layer.drawU(ug.apply(new UTranslate(dx, 0))); + layer.drawU(ug.apply(UTranslate.dx(dx))); } private PlayingSpace createMainTile() { final RealOrigin origin = RealUtils.createOrigin(); Real currentPos = origin.addAtLeast(0); for (Participant p : diagram.participants()) { - final LivingSpace livingSpace = new LivingSpace(p, diagram.getEnglober(p), skin, getSkinParam(), - currentPos, diagram.events()); + final LivingSpace livingSpace = new LivingSpace(p, diagram.getEnglober(p), skin, getSkinParam(), currentPos, + diagram.events()); livingSpaces.put(p, livingSpace); currentPos = livingSpace.getPosD(stringBounder).addAtLeast(0); } - final TileArguments tileArguments = new TileArguments(stringBounder, livingSpaces, skin, - diagram.getSkinParam(), origin); + final TileArguments tileArguments = new TileArguments(stringBounder, livingSpaces, skin, diagram.getSkinParam(), + origin); this.englobers = new Englobers(tileArguments); final PlayingSpace mainTile = new PlayingSpace(diagram, englobers, tileArguments); @@ -223,10 +229,10 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { } final TextBlock compTitle; if (SkinParam.USE_STYLES()) { - final Style style = StyleSignature.of(SName.root, SName.title).getMergedStyle( - diagram.getSkinParam().getCurrentStyleBuilder()); - compTitle = style.createTextBlockBordered(diagram.getTitle().getDisplay(), diagram.getSkinParam() - .getIHtmlColorSet(), diagram.getSkinParam()); + final Style style = StyleSignature.of(SName.root, SName.title) + .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); + compTitle = style.createTextBlockBordered(diagram.getTitle().getDisplay(), + diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam()); return compTitle; } else { compTitle = TextBlockUtils.title(new FontConfiguration(getSkinParam(), FontParam.TITLE, null), @@ -247,9 +253,9 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { if (diagram.getFooterOrHeaderTeoz(param).isNull()) { return new TeozLayer(null, stringBounder, param); } - final DisplaySection display = diagram.getFooterOrHeaderTeoz(param); - final HtmlColor hyperlinkColor = getSkinParam().getHyperlinkColor(); - final HtmlColor titleColor = getSkinParam().getFontHtmlColor(null, param); + final DisplaySection display = diagram.getFooterOrHeaderTeoz(param).withPage(index + 1, getNbPages()); + final HColor hyperlinkColor = getSkinParam().getHyperlinkColor(); + final HColor titleColor = getSkinParam().getFontHtmlColor(null, param); final String fontFamily = getSkinParam().getFont(null, false, param).getFamily(null); final int fontSize = getSkinParam().getFont(null, false, param).getSize(); Style style = null; @@ -269,11 +275,12 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { private void drawInternal(UGraphic ug, int index) { body.setIndex(index); - final UTranslate min1translate = new UTranslate(-min1.getCurrentValue(), 0); + final UTranslate min1translate = UTranslate.dx(-min1.getCurrentValue()); ug = ug.apply(min1translate); - englobers.drawEnglobers(goDownAndCenterForEnglobers(ug), body.calculateDimension(stringBounder).getHeight() - + heightEnglober1 + heightEnglober2 / 2, new SimpleContext2D(true)); + englobers.drawEnglobers(goDownAndCenterForEnglobers(ug), + body.calculateDimension(stringBounder).getHeight() + heightEnglober1 + heightEnglober2 / 2, + new SimpleContext2D(true)); printAligned(ug, diagram.getFooterOrHeaderTeoz(FontParam.HEADER).getHorizontalAlignment(), header); ug = goDown(ug, header); @@ -292,12 +299,12 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { ug = goDown(ug, legend); } - ug = ug.apply(new UTranslate(0, heightEnglober1)); + ug = ug.apply(UTranslate.dy(heightEnglober1)); final TextBlock bodyFramed = annotatedWorker.addFrame(body); - printAligned(ug.apply(new UTranslate((annotatedWorker.hasMainFrame() ? 4 : 0), 0)), HorizontalAlignment.CENTER, + printAligned(ug.apply(UTranslate.dx((annotatedWorker.hasMainFrame() ? 4 : 0))), HorizontalAlignment.CENTER, bodyFramed); ug = goDown(ug, bodyFramed); - ug = ug.apply(new UTranslate(0, heightEnglober2)); + ug = ug.apply(UTranslate.dy(heightEnglober2)); printAligned(ug, HorizontalAlignment.CENTER, caption); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java index 590ce7229..5d354ca4b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java @@ -57,7 +57,7 @@ public interface Tile extends UDrawable, UShape { public double getZ(StringBounder stringBounder); - public boolean matchAnchor(String anchor); + public Tile matchAnchorV1(String anchor); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java index 7675178ed..c658416df 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java @@ -38,12 +38,12 @@ package net.sourceforge.plantuml.sequencediagram.teoz; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SkinParamBackcoloredReference; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TileArguments implements Bordered { private final StringBounder stringBounder; @@ -61,7 +61,7 @@ public class TileArguments implements Bordered { this.skinParam = skinParam; } - public TileArguments withBackColorGeneral(HtmlColor backColorElement, HtmlColor backColorGeneral) { + public TileArguments withBackColorGeneral(HColor backColorElement, HColor backColorGeneral) { return new TileArguments(stringBounder, livingSpaces, skin, new SkinParamBackcolored(skinParam, backColorElement, backColorGeneral), origin); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java index 7a476f8e6..f0852eb4b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java @@ -77,8 +77,9 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac final double yPointAll = getYPoint(stringBounder); for (Tile tile : tiles) { final double yPoint = tile.getYPoint(stringBounder); - // tile.drawU(ug.apply(new UTranslate(0, totalHeight - tile.getPreferredHeight(stringBounder)))); - tile.drawU(ug.apply(new UTranslate(0, yPointAll - yPoint))); + // tile.drawU(ug.apply(UTranslate.dy(totalHeight - + // tile.getPreferredHeight(stringBounder)))); + tile.drawU(ug.apply(UTranslate.dy(yPointAll - yPoint))); } } @@ -164,13 +165,14 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac return null; } - public boolean matchAnchor(String anchor) { + public Tile matchAnchorV1(String anchor) { for (Tile tile : tiles) { - if (tile.matchAnchor(anchor)) { - return true; + final Tile result = tile.matchAnchorV1(anchor); + if (result != null) { + return result; } } - return false; + return null; } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java index 9e55439bc..f8d6bec97 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java @@ -63,11 +63,12 @@ public class YPositionedTile { public void drawInArea(UGraphic ug) { // System.err.println("YPositionedTile::drawU y=" + y + " " + tile); - ug.apply(new UTranslate(0, y)).draw(tile); + ug.apply(UTranslate.dy(y)).draw(tile); } - public boolean matchAnchor(String anchor) { - return tile.matchAnchor(anchor); + public boolean matchAnchorV2(String anchor) { + final Tile result = tile.matchAnchorV1(anchor); + return result != null; } public final double getY(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index b19bfe6f9..c43d49873 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -47,14 +47,14 @@ import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public abstract class AbstractTextualComponent extends AbstractComponent { @@ -68,11 +68,11 @@ public abstract class AbstractTextualComponent extends AbstractComponent { private final ISkinSimple spriteContainer; private final UFont font; - private final HtmlColor fontColor; + private final HColor fontColor; public AbstractTextualComponent(Style style, LineBreakStrategy maxMessageSize, CharSequence label, FontConfiguration font, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, - ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + ISkinSimple spriteContainer, UFont fontForStereotype, HColor htmlColorForStereotype) { this(style, style, maxMessageSize, Display.getWithNewlines(label == null ? "" : label.toString()), font, horizontalAlignment, marginX1, marginX2, marginY, spriteContainer, false, fontForStereotype, htmlColorForStereotype); @@ -80,14 +80,14 @@ public abstract class AbstractTextualComponent extends AbstractComponent { public AbstractTextualComponent(Style style, LineBreakStrategy maxMessageSize, Display display, FontConfiguration fc, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, - ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HColor htmlColorForStereotype) { this(style, style, maxMessageSize, display, fc, horizontalAlignment, marginX1, marginX2, marginY, spriteContainer, enhanced, fontForStereotype, htmlColorForStereotype); } public AbstractTextualComponent(Style style, Style stereo, LineBreakStrategy maxMessageSize, Display display, FontConfiguration fc, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, - ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HColor htmlColorForStereotype) { super(style); this.spriteContainer = spriteContainer; if (SkinParam.USE_STYLES()) { @@ -119,7 +119,7 @@ public abstract class AbstractTextualComponent extends AbstractComponent { } } - protected IHtmlColorSet getIHtmlColorSet() { + protected HColorSet getIHtmlColorSet() { return ((ISkinParam) spriteContainer).getIHtmlColorSet(); } @@ -159,7 +159,7 @@ public abstract class AbstractTextualComponent extends AbstractComponent { return font; } - protected HtmlColor getFontColor() { + protected HColor getFontColor() { return fontColor; } diff --git a/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java b/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java index a363ec3d8..b391c7c40 100644 --- a/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java +++ b/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java @@ -35,9 +35,9 @@ */ package net.sourceforge.plantuml.skin; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ArrowConfiguration { @@ -49,14 +49,14 @@ public class ArrowConfiguration { private final ArrowDecoration decoration1; private final ArrowDecoration decoration2; - private final HtmlColor color; + private final HColor color; private final boolean isSelf; private final double thickness; private final boolean reverseDefine; private ArrowConfiguration(ArrowBody body, ArrowDressing dressing1, ArrowDressing dressing2, - ArrowDecoration decoration1, ArrowDecoration decoration2, HtmlColor color, boolean isSelf, + ArrowDecoration decoration1, ArrowDecoration decoration2, HColor color, boolean isSelf, double thickness, boolean reverseDefine) { if (body == null || dressing1 == null || dressing2 == null) { throw new IllegalArgumentException(); @@ -161,7 +161,7 @@ public class ArrowConfiguration { reverseDefine); } - public ArrowConfiguration withColor(HtmlColor color) { + public ArrowConfiguration withColor(HColor color) { return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf, thickness, reverseDefine); } @@ -217,7 +217,7 @@ public class ArrowConfiguration { return dressing1.getPart(); } - public HtmlColor getColor() { + public HColor getColor() { return color; } diff --git a/src/net/sourceforge/plantuml/skin/CircleInterface.java b/src/net/sourceforge/plantuml/skin/CircleInterface.java index f77c39d7a..f2286c044 100644 --- a/src/net/sourceforge/plantuml/skin/CircleInterface.java +++ b/src/net/sourceforge/plantuml/skin/CircleInterface.java @@ -35,7 +35,6 @@ */ package net.sourceforge.plantuml.skin; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -44,19 +43,20 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CircleInterface implements UDrawable { private final float thickness; private final double headDiam; - private final HtmlColor backgroundColor; - private final HtmlColor foregroundColor; + private final HColor backgroundColor; + private final HColor foregroundColor; - public CircleInterface(HtmlColor backgroundColor, HtmlColor foregroundColor) { + public CircleInterface(HColor backgroundColor, HColor foregroundColor) { this(backgroundColor, foregroundColor, 16, 2); } - public CircleInterface(HtmlColor backgroundColor, HtmlColor foregroundColor, double headDiam, float thickness) { + public CircleInterface(HColor backgroundColor, HColor foregroundColor, double headDiam, float thickness) { this.backgroundColor = backgroundColor; this.foregroundColor = foregroundColor; this.headDiam = headDiam; diff --git a/src/net/sourceforge/plantuml/skin/Padder.java b/src/net/sourceforge/plantuml/skin/Padder.java index 9af71727d..2e30def7a 100644 --- a/src/net/sourceforge/plantuml/skin/Padder.java +++ b/src/net/sourceforge/plantuml/skin/Padder.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -47,13 +46,14 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Padder { private final double margin; private final double padding; - private final HtmlColor backgroundColor; - private final HtmlColor borderColor; + private final HColor backgroundColor; + private final HColor borderColor; private final double roundCorner; public static final Padder NONE = new Padder(0, 0, null, null, 0); @@ -63,7 +63,8 @@ public class Padder { return "" + margin + "/" + padding + "/" + borderColor + "/" + backgroundColor; } - private Padder(double margin, double padding, HtmlColor backgroundColor, HtmlColor borderColor, double roundCorner) { + private Padder(double margin, double padding, HColor backgroundColor, HColor borderColor, + double roundCorner) { this.margin = margin; this.padding = padding; this.borderColor = borderColor; @@ -79,11 +80,11 @@ public class Padder { return new Padder(margin, padding, backgroundColor, borderColor, roundCorner); } - public Padder withBackgroundColor(HtmlColor backgroundColor) { + public Padder withBackgroundColor(HColor backgroundColor) { return new Padder(margin, padding, backgroundColor, borderColor, roundCorner); } - public Padder withBorderColor(HtmlColor borderColor) { + public Padder withBorderColor(HColor borderColor) { return new Padder(margin, padding, backgroundColor, borderColor, roundCorner); } @@ -99,11 +100,11 @@ public class Padder { return padding; } - public final HtmlColor getBackgroundColor() { + public final HColor getBackgroundColor() { return backgroundColor; } - public final HtmlColor getBorderColor() { + public final HColor getBorderColor() { return borderColor; } @@ -118,11 +119,11 @@ public class Padder { public void drawU(UGraphic ug) { ug = ug.apply(new UTranslate(margin, margin)); - final UGraphic ug2 = ug.apply(new UChangeBackColor(backgroundColor)).apply( - new UChangeColor(borderColor)); + final UGraphic ug2 = ug.apply(new UChangeBackColor(backgroundColor)) + .apply(new UChangeColor(borderColor)); final Dimension2D originalDim = orig.calculateDimension(ug.getStringBounder()); - final URectangle rect = new URectangle(Dimension2DDouble.delta(originalDim, 2 * padding), roundCorner, - roundCorner); + final URectangle rect = new URectangle(Dimension2DDouble.delta(originalDim, 2 * padding)) + .rounded(roundCorner); ug2.draw(rect); orig.drawU(ug.apply(new UTranslate(padding, padding))); } diff --git a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java index 97e546bcd..00bafdc67 100644 --- a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java +++ b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java @@ -41,7 +41,6 @@ import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -53,6 +52,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public enum VisibilityModifier { PRIVATE_FIELD(ColorParam.iconPrivate, null), PROTECTED_FIELD(ColorParam.iconProtected, null), PACKAGE_PRIVATE_FIELD( @@ -77,7 +77,7 @@ public enum VisibilityModifier { this.backgroundParam = background; } - public UDrawable getUDrawable(final int size, final HtmlColor foregroundColor, final HtmlColor backgoundColor) { + public UDrawable getUDrawable(final int size, final HColor foregroundColor, final HColor backgoundColor) { return new UDrawable() { public void drawU(UGraphic ug) { drawInternal(ug, size, foregroundColor, backgoundColor, 0, 0); @@ -86,7 +86,7 @@ public enum VisibilityModifier { }; } - public TextBlock getUBlock(final int size, final HtmlColor foregroundColor, final HtmlColor backgoundColor, + public TextBlock getUBlock(final int size, final HColor foregroundColor, final HColor backgoundColor, final boolean withInvisibleRectanble) { return new AbstractTextBlock() { @@ -108,7 +108,7 @@ public enum VisibilityModifier { }; } - private void drawInternal(UGraphic ug, int size, final HtmlColor foregroundColor, final HtmlColor backgoundColor, + private void drawInternal(UGraphic ug, int size, final HColor foregroundColor, final HColor backgoundColor, double x, double y) { ug = ug.apply(new UChangeBackColor(backgoundColor)).apply(new UChangeColor(foregroundColor)); size = ensureEven(size); diff --git a/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java index e0db3a396..d2fbecc11 100644 --- a/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; @@ -52,15 +51,16 @@ import net.sourceforge.plantuml.skin.Padder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public abstract class AbstractComponentRoseArrow extends AbstractTextualComponent implements ArrowComponent { private final int arrowDeltaX = 10; private final int arrowDeltaY = 4; - private final HtmlColor foregroundColor; + private final HColor foregroundColor; private final ArrowConfiguration arrowConfiguration; - public AbstractComponentRoseArrow(Style style, HtmlColor foregroundColor, FontConfiguration font, + public AbstractComponentRoseArrow(Style style, HColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment, LineBreakStrategy maxMessageSize) { super(style, maxMessageSize, stringsToDisplay, font, textHorizontalAlignment, 7, 7, 1, spriteContainer, false, @@ -85,7 +85,7 @@ public abstract class AbstractComponentRoseArrow extends AbstractTextualComponen abstract public double getYPoint(StringBounder stringBounder); - protected final HtmlColor getForegroundColor() { + protected final HColor getForegroundColor() { return foregroundColor; } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java index 67c37815f..39d77018c 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java @@ -38,7 +38,6 @@ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractComponent; @@ -50,6 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ComponentRoseActiveLine extends AbstractComponent { @@ -58,7 +58,7 @@ public class ComponentRoseActiveLine extends AbstractComponent { private final boolean closeDown; public ComponentRoseActiveLine(Style style, SymbolContext symbolContext, boolean closeUp, boolean closeDown, - IHtmlColorSet set) { + HColorSet set) { super(style); if (SkinParam.USE_STYLES()) { symbolContext = style.getSymbolContext(set); @@ -79,19 +79,19 @@ public class ComponentRoseActiveLine extends AbstractComponent { } ug = ug.apply(new UChangeColor(symbolContext.getForeColor())); if (closeUp && closeDown) { - ug.apply(new UChangeBackColor(symbolContext.getBackColor())).apply(new UTranslate(x, 0)).draw(rect); + ug.apply(new UChangeBackColor(symbolContext.getBackColor())).apply(UTranslate.dx(x)).draw(rect); return; } ug.apply(new UChangeBackColor(symbolContext.getBackColor())) - .apply(new UChangeColor(symbolContext.getBackColor())).apply(new UTranslate(x, 0)).draw(rect); + .apply(new UChangeColor(symbolContext.getBackColor())).apply(UTranslate.dx(x)).draw(rect); - final ULine vline = new ULine(0, dimensionToUse.getHeight()); - ug.apply(new UTranslate(x, 0)).draw(vline); - ug.apply(new UTranslate(x + getPreferredWidth(stringBounder), 0)).draw(vline); + final ULine vline = ULine.vline(dimensionToUse.getHeight()); + ug.apply(UTranslate.dx(x)).draw(vline); + ug.apply(UTranslate.dx(x + getPreferredWidth(stringBounder))).draw(vline); - final ULine hline = new ULine(getPreferredWidth(stringBounder), 0); + final ULine hline = ULine.hline(getPreferredWidth(stringBounder)); if (closeUp) { - ug.apply(new UTranslate(x, 0)).draw(hline); + ug.apply(UTranslate.dx(x)).draw(hline); } if (closeDown) { ug.apply(new UTranslate(x, dimensionToUse.getHeight())).draw(hline); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java index 96ae27f27..629c10e04 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseActor extends AbstractTextualComponent { @@ -63,7 +63,7 @@ public class ComponentRoseActor extends AbstractTextualComponent { public ComponentRoseActor(ActorStyle actorStyle, Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + UFont fontForStereotype, HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); this.head = head; @@ -83,9 +83,9 @@ public class ComponentRoseActor extends AbstractTextualComponent { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java index b34d5ec97..fb9324346 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; @@ -61,6 +60,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseArrow extends AbstractComponentRoseArrow { @@ -68,7 +68,7 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { private final boolean niceArrow; private final boolean belowForResponse; - public ComponentRoseArrow(Style style, HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, + public ComponentRoseArrow(Style style, HColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment, LineBreakStrategy maxMessageSize, boolean niceArrow, boolean belowForResponse) { @@ -148,9 +148,9 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { yText = 0; } - drawDressing1(ug.apply(new UTranslate(0, posArrow)), pos1, dressing1, getArrowConfiguration().getDecoration1()); - drawDressing2(ug.apply(new UTranslate(0, posArrow)), pos2, dressing2, getArrowConfiguration().getDecoration2()); - getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(new ULine(len, 0)); + drawDressing1(ug.apply(UTranslate.dy(posArrow)), pos1, dressing1, getArrowConfiguration().getDecoration1()); + drawDressing2(ug.apply(UTranslate.dy(posArrow)), pos2, dressing2, getArrowConfiguration().getDecoration2()); + getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(ULine.hline(len)); final ArrowDirection direction2 = getDirection2(); final double textPos; @@ -185,11 +185,11 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { if (dressing.getHead() == ArrowHead.ASYNC) { if (dressing.getPart() != ArrowPart.BOTTOM_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x - 1)) .draw(new ULine(getArrowDeltaX(), -getArrowDeltaY())); } if (dressing.getPart() != ArrowPart.TOP_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x - 1)) .draw(new ULine(getArrowDeltaX(), getArrowDeltaY())); } } else if (dressing.getHead() == ArrowHead.CROSSX) { @@ -200,7 +200,7 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { new ULine(getArrowDeltaX(), -getArrowDeltaX())); } else if (dressing.getHead() == ArrowHead.NORMAL) { final UPolygon polygon = getPolygonReverse(dressing.getPart()); - ug.apply(new UChangeBackColor(getForegroundColor())).apply(new UTranslate(x, 0)).draw(polygon); + ug.apply(new UChangeBackColor(getForegroundColor())).apply(UTranslate.dx(x)).draw(polygon); } } @@ -217,11 +217,11 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { if (dressing.getHead() == ArrowHead.ASYNC) { if (dressing.getPart() != ArrowPart.BOTTOM_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x)) .draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY())); } if (dressing.getPart() != ArrowPart.TOP_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x)) .draw(new ULine(-getArrowDeltaX(), getArrowDeltaY())); } } else if (dressing.getHead() == ArrowHead.CROSSX) { diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java index 9f57f6a4e..41259b48c 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -54,6 +53,7 @@ import net.sourceforge.plantuml.svek.Boundary; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseBoundary extends AbstractTextualComponent { @@ -62,7 +62,7 @@ public class ComponentRoseBoundary extends AbstractTextualComponent { public ComponentRoseBoundary(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -81,9 +81,9 @@ public class ComponentRoseBoundary extends AbstractTextualComponent { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java index 83ca403ca..8aa6607c6 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -54,6 +53,7 @@ import net.sourceforge.plantuml.svek.Control; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseControl extends AbstractTextualComponent { @@ -62,7 +62,7 @@ public class ComponentRoseControl extends AbstractTextualComponent { public ComponentRoseControl(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -81,9 +81,9 @@ public class ComponentRoseControl extends AbstractTextualComponent { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java index c2cd93cc2..a1e1f070b 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -56,6 +55,7 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseDatabase extends AbstractTextualComponent { @@ -64,7 +64,7 @@ public class ComponentRoseDatabase extends AbstractTextualComponent { public ComponentRoseDatabase(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); this.head = head; @@ -87,9 +87,9 @@ public class ComponentRoseDatabase extends AbstractTextualComponent { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java index f17971bb7..e052f4a65 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java @@ -37,7 +37,6 @@ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; @@ -48,12 +47,13 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseDelayLine extends AbstractComponent { - private final HtmlColor color; + private final HColor color; - public ComponentRoseDelayLine(Style style, HtmlColor color) { + public ComponentRoseDelayLine(Style style, HColor color) { super(style); this.color = color; } @@ -63,7 +63,7 @@ public class ComponentRoseDelayLine extends AbstractComponent { final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = ArrowConfiguration.stroke(ug, 1, 4, 1).apply(new UChangeColor(color)); final int x = (int) (dimensionToUse.getWidth() / 2); - ug.apply(UAntiAliasing.ANTI_ALIASING_OFF).apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight())); + ug.apply(UAntiAliasing.ANTI_ALIASING_OFF).apply(UTranslate.dx(x)).draw(ULine.vline(dimensionToUse.getHeight())); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java index f89d36d57..285503995 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java @@ -35,7 +35,6 @@ */ package net.sourceforge.plantuml.skin.rose; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; @@ -45,12 +44,13 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseDestroy extends AbstractComponent { - private final HtmlColor foregroundColor; + private final HColor foregroundColor; - public ComponentRoseDestroy(Style style, HtmlColor foregroundColor) { + public ComponentRoseDestroy(Style style, HColor foregroundColor) { super(style); this.foregroundColor = foregroundColor; } @@ -62,7 +62,7 @@ public class ComponentRoseDestroy extends AbstractComponent { ug = ug.apply(new UStroke(2)).apply(new UChangeColor(foregroundColor)); ug.draw(new ULine(2 * crossSize, 2 * crossSize)); - ug.apply(new UTranslate(0, 2 * crossSize)).draw(new ULine(2 * crossSize, -2 * crossSize)); + ug.apply(UTranslate.dy(2 * crossSize)).draw(new ULine(2 * crossSize, -2 * crossSize)); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java index 1c3be373f..96a6cb42f 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; @@ -57,19 +56,20 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseDivider extends AbstractTextualComponent { // private final int outMargin = 5; - private final HtmlColor borderColor; - private final HtmlColor background; + private final HColor borderColor; + private final HColor background; private final boolean empty; private final boolean withShadow; private final UStroke stroke; private final double roundCorner; - public ComponentRoseDivider(Style style, FontConfiguration font, HtmlColor background, Display stringsToDisplay, - ISkinSimple spriteContainer, boolean withShadow, UStroke stroke, HtmlColor borderColor) { + public ComponentRoseDivider(Style style, FontConfiguration font, HColor background, Display stringsToDisplay, + ISkinSimple spriteContainer, boolean withShadow, UStroke stroke, HColor borderColor) { super(style, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, false, null, null); if (SkinParam.USE_STYLES()) { @@ -93,7 +93,7 @@ public class ComponentRoseDivider extends AbstractTextualComponent { ug = ug.apply(new UChangeBackColor(background)); if (empty) { - drawSep(ug.apply(new UTranslate(0, dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); + drawSep(ug.apply(UTranslate.dy(dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); } else { final TextBlock textBlock = getTextBlock(); final StringBounder stringBounder = ug.getStringBounder(); @@ -103,11 +103,11 @@ public class ComponentRoseDivider extends AbstractTextualComponent { final double xpos = (dimensionToUse.getWidth() - textWidth - deltaX) / 2; final double ypos = (dimensionToUse.getHeight() - textHeight) / 2; - drawSep(ug.apply(new UTranslate(0, dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); + drawSep(ug.apply(UTranslate.dy(dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); ug = ug.apply(new UChangeColor(borderColor)); ug = ug.apply(stroke); - final URectangle rect = new URectangle(textWidth + deltaX, textHeight, roundCorner, roundCorner); + final URectangle rect = new URectangle(textWidth + deltaX, textHeight).rounded(roundCorner); if (withShadow) { rect.setDeltaShadow(4); } @@ -121,12 +121,12 @@ public class ComponentRoseDivider extends AbstractTextualComponent { private void drawSep(UGraphic ug, double width) { ug = ug.apply(new UChangeColor(background)); - drawRectLong(ug.apply(new UTranslate(0, -1)), width); + drawRectLong(ug.apply(UTranslate.dy(-1)), width); drawDoubleLine(ug, width); } private void drawRectLong(UGraphic ug, double width) { - final URectangle rectLong = new URectangle(width, 3, roundCorner, roundCorner); + final URectangle rectLong = new URectangle(width, 3).rounded(roundCorner); if (withShadow) { rectLong.setDeltaShadow(2); } @@ -136,9 +136,9 @@ public class ComponentRoseDivider extends AbstractTextualComponent { private void drawDoubleLine(UGraphic ug, final double width) { ug = ug.apply(new UStroke(stroke.getThickness() / 2)).apply(new UChangeColor(borderColor)); - final ULine line = new ULine(width, 0); - ug.apply(new UTranslate(0, -1)).draw(line); - ug.apply(new UTranslate(0, 2)).draw(line); + final ULine line = ULine.hline(width); + ug.apply(UTranslate.dy(-1)).draw(line); + ug.apply(UTranslate.dy(2)).draw(line); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java index bc083dc93..4f4f7363d 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java @@ -74,9 +74,9 @@ public class ComponentRoseEnglober extends AbstractTextualComponent { protected void drawBackgroundInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = symbolContext.transparentBackColorToNull().apply(ug); - ug.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight(), roundCorner, roundCorner)); + ug.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()).rounded(roundCorner)); final double xpos = (dimensionToUse.getWidth() - getPureTextWidth(ug.getStringBounder())) / 2; - getTextBlock().drawU(ug.apply(new UTranslate(xpos, 0))); + getTextBlock().drawU(ug.apply(UTranslate.dx(xpos))); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java index 2f1bb954c..6902487ce 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -54,6 +53,7 @@ import net.sourceforge.plantuml.svek.EntityDomain; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseEntity extends AbstractTextualComponent { @@ -62,7 +62,7 @@ public class ComponentRoseEntity extends AbstractTextualComponent { public ComponentRoseEntity(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -81,9 +81,9 @@ public class ComponentRoseEntity extends AbstractTextualComponent { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java index 28668ea91..5bc9b0b65 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java @@ -43,8 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; @@ -58,14 +56,16 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; public class ComponentRoseGroupingElse extends AbstractTextualComponent { - private final HtmlColor groupBorder; - private final HtmlColor backgroundColor; + private final HColor groupBorder; + private final HColor backgroundColor; - public ComponentRoseGroupingElse(Style style, HtmlColor groupBorder, FontConfiguration smallFont, - CharSequence comment, ISkinSimple spriteContainer, HtmlColor backgroundColor) { + public ComponentRoseGroupingElse(Style style, HColor groupBorder, FontConfiguration smallFont, + CharSequence comment, ISkinSimple spriteContainer, HColor backgroundColor) { super(style, LineBreakStrategy.NONE, comment == null ? null : "[" + comment + "]", smallFont, HorizontalAlignment.LEFT, 5, 5, 1, spriteContainer, null, null); if (SkinParam.USE_STYLES()) { @@ -83,7 +83,7 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent { @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { - if (backgroundColor instanceof HtmlColorTransparent) { + if (backgroundColor instanceof HColorBackground) { return; } final Dimension2D dimensionToUse = area.getDimensionToUse(); @@ -95,7 +95,7 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent { protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(new UChangeColor(groupBorder)); - ug.apply(new UTranslate(0, 1)).draw(new ULine(dimensionToUse.getWidth(), 0)); + ug.apply(UTranslate.dy(1)).draw(ULine.hline(dimensionToUse.getWidth())); ug = ug.apply(new UStroke()); getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY()))); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java index 2de5609ed..df34389ad 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java @@ -43,8 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -59,6 +57,8 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; public class ComponentRoseGroupingHeader extends AbstractTextualComponent { @@ -67,12 +67,12 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { private final TextBlock commentTextBlock; - private final HtmlColor background; + private final HColor background; private final SymbolContext symbolContext; private final SymbolContext symbolContextCorner; private final double roundCorner; - public ComponentRoseGroupingHeader(Style style, Style styleHeader, HtmlColor background, + public ComponentRoseGroupingHeader(Style style, Style styleHeader, HColor background, SymbolContext symbolContext, FontConfiguration bigFont, FontConfiguration smallFont2, Display strings, ISkinSimple spriteContainer, double roundCorner) { super(styleHeader, LineBreakStrategy.NONE, strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, @@ -103,7 +103,8 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { } } - // new FontConfiguration(smallFont, bigFont.getColor(), bigFont.getHyperlinkColor(), + // new FontConfiguration(smallFont, bigFont.getColor(), + // bigFont.getHyperlinkColor(), // bigFont.useUnderlineForHyperlink()); private double getSuppHeightForComment(StringBounder stringBounder) { @@ -138,13 +139,13 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { - if (background instanceof HtmlColorTransparent) { + if (background instanceof HColorBackground) { return; } final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor())); - final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight(), roundCorner, - roundCorner); + final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()) + .rounded(roundCorner); rect.setDeltaShadow(symbolContext.getDeltaShadow()); ug.apply(new UChangeBackColor(background)).draw(rect); } @@ -163,8 +164,8 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { } ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor())); - final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight(), roundCorner, - roundCorner); + final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()) + .rounded(roundCorner); ug.draw(rect); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java index 6d1ae2b8b..5f9572a3f 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java @@ -38,8 +38,6 @@ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; @@ -51,14 +49,16 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ComponentRoseLine extends AbstractComponent { - private final HtmlColor color; + private final HColor color; private final boolean continueLine; private final UStroke stroke; - public ComponentRoseLine(Style style, HtmlColor color, boolean continueLine, UStroke stroke, IHtmlColorSet set) { + public ComponentRoseLine(Style style, HColor color, boolean continueLine, UStroke stroke, HColorSet set) { super(style); if (SkinParam.USE_STYLES()) { this.color = style.value(PName.LineColor).asColor(set); @@ -79,7 +79,7 @@ public class ComponentRoseLine extends AbstractComponent { ug = ArrowConfiguration.stroke(ug, 5, 5, stroke.getThickness()); } final int x = (int) (dimensionToUse.getWidth() / 2); - ug.apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight())); + ug.apply(UTranslate.dx(x)).draw(ULine.vline(dimensionToUse.getHeight())); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java index dff6c8967..ef8c07807 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java @@ -37,7 +37,6 @@ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; @@ -46,12 +45,13 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseNewpage extends AbstractComponent { - private final HtmlColor foregroundColor; + private final HColor foregroundColor; - public ComponentRoseNewpage(Style style, HtmlColor foregroundColor) { + public ComponentRoseNewpage(Style style, HColor foregroundColor) { super(style); this.foregroundColor = foregroundColor; } @@ -60,7 +60,7 @@ public class ComponentRoseNewpage extends AbstractComponent { protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(new UChangeColor(foregroundColor)); - ug.draw(new ULine(dimensionToUse.getWidth(), 0)); + ug.draw(ULine.hline(dimensionToUse.getWidth())); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java index 2c35139c9..93f644c1e 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java @@ -104,7 +104,7 @@ final public class ComponentRoseNoteBox extends AbstractTextualComponent { } ug = symbolContext.apply(ug); - final URectangle rect = new URectangle(x2, textHeight, roundCorner, roundCorner); + final URectangle rect = new URectangle(x2, textHeight).rounded(roundCorner); rect.setDeltaShadow(symbolContext.getDeltaShadow()); ug.draw(rect); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java index 3634b7dea..b2b1e64ff 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; @@ -56,29 +56,34 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseParticipant extends AbstractTextualComponent { - private final HtmlColor back; - private final HtmlColor foregroundColor; + private final HColor back; + private final HColor foregroundColor; private final double deltaShadow; private final double roundCorner; + private final double diagonalCorner; private final UStroke stroke; private final double minWidth; private final boolean collections; private final double padding; public ComponentRoseParticipant(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, - Display stringsToDisplay, ISkinSimple spriteContainer, double roundCorner, UFont fontForStereotype, - HtmlColor htmlColorForStereotype, double minWidth, boolean collections, double padding) { + Display stringsToDisplay, ISkinSimple spriteContainer, double roundCorner, double diagonalCorner, + UFont fontForStereotype, HColor htmlColorForStereotype, double minWidth, boolean collections, + double padding) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { this.roundCorner = style.value(PName.RoundCorner).asInt(); + this.diagonalCorner = style.value(PName.DiagonalCorner).asInt(); biColor = style.getSymbolContext(getIHtmlColorSet()); this.stroke = style.getStroke(); } else { this.roundCorner = roundCorner; + this.diagonalCorner = diagonalCorner; this.stroke = biColor.getStroke(); } this.padding = padding; @@ -92,15 +97,15 @@ public class ComponentRoseParticipant extends AbstractTextualComponent { @Override protected void drawInternalU(UGraphic ug, Area area) { final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UTranslate(padding, 0)); + ug = ug.apply(UTranslate.dx(padding)); ug = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(foregroundColor)); ug = ug.apply(stroke); - final URectangle rect = new URectangle(getTextWidth(stringBounder), getTextHeight(stringBounder), roundCorner, - roundCorner); + final Shadowable rect = new URectangle(getTextWidth(stringBounder), getTextHeight(stringBounder)) + .rounded(roundCorner).diagonalCorner(diagonalCorner); rect.setDeltaShadow(deltaShadow); if (collections) { - ug.apply(new UTranslate(getDeltaCollection(), 0)).draw(rect); - ug = ug.apply(new UTranslate(0, getDeltaCollection())); + ug.apply(UTranslate.dx(getDeltaCollection())).draw(rect); + ug = ug.apply(UTranslate.dy(getDeltaCollection())); } ug.draw(rect); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java index 3ed37dd44..3d672b7d9 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseQueue extends AbstractTextualComponent { @@ -63,7 +63,7 @@ public class ComponentRoseQueue extends AbstractTextualComponent { public ComponentRoseQueue(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -80,7 +80,7 @@ public class ComponentRoseQueue extends AbstractTextualComponent { final Dimension2D dimStickman = stickman.calculateDimension(stringBounder); final double delta = (getPreferredWidth(stringBounder) - dimStickman.getWidth()) / 2; - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); stickman.drawU(ug); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java index f74a8c23d..082cf9344 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseReference extends AbstractTextualComponent { @@ -68,7 +68,7 @@ public class ComponentRoseReference extends AbstractTextualComponent { public ComponentRoseReference(Style style, Style styleHeader, FontConfiguration font, SymbolContext symbolContext, FontConfiguration fcHeader, Display stringsToDisplay, HorizontalAlignment position, - ISkinSimple spriteContainer, HtmlColor background) { + ISkinSimple spriteContainer, HColor background) { super(style, LineBreakStrategy.NONE, stringsToDisplay.subList(1, stringsToDisplay.size()), font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, false, null, null); if (SkinParam.USE_STYLES()) { @@ -97,7 +97,7 @@ public class ComponentRoseReference extends AbstractTextualComponent { - symbolContextHeader.getDeltaShadow(), dimensionToUse.getHeight() - heightFooter); rect.setDeltaShadow(symbolContextHeader.getDeltaShadow()); ug = symbolContextBody.apply(ug); - ug.apply(new UTranslate(xMargin, 0)).draw(rect); + ug.apply(UTranslate.dx(xMargin)).draw(rect); final UPolygon polygon = new UPolygon(); polygon.addPoint(0, 0); @@ -110,7 +110,7 @@ public class ComponentRoseReference extends AbstractTextualComponent { polygon.addPoint(0, 0); ug = symbolContextHeader.apply(ug); - ug.apply(new UTranslate(xMargin, 0)).draw(polygon); + ug.apply(UTranslate.dx(xMargin)).draw(polygon); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java index 4568ec7cd..1e56de8c4 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; @@ -59,13 +58,14 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { private final double arrowWidth = 45; private final boolean niceArrow; - public ComponentRoseSelfArrow(Style style, HtmlColor foregroundColor, FontConfiguration font, + public ComponentRoseSelfArrow(Style style, HColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, boolean niceArrow) { super(style, foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, @@ -113,9 +113,9 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { } final double arrowHeight = textAndArrowHeight - textHeight; - ug2.apply(new UTranslate(x1, textHeight)).draw(new ULine(xRight - x1, 0)); - ug2.apply(new UTranslate(xRight, textHeight)).draw(new ULine(0, arrowHeight)); - ug2.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(xRight - x2, 0)); + ug2.apply(new UTranslate(x1, textHeight)).draw(ULine.hline(xRight - x1)); + ug2.apply(new UTranslate(xRight, textHeight)).draw(ULine.vline(arrowHeight)); + ug2.apply(new UTranslate(x2, textAndArrowHeight)).draw(ULine.hline(xRight - x2)); if (getArrowConfiguration().isAsync()) { if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) { @@ -130,18 +130,18 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { ug = ug.apply(new UStroke(2)); ug.apply( new UTranslate(ComponentRoseArrow.spaceCrossX, textHeight - getArrowDeltaX() / 2 - + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), getArrowDeltaX())); + + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), getArrowDeltaX())); ug.apply( new UTranslate(ComponentRoseArrow.spaceCrossX, textHeight + getArrowDeltaX() / 2 - + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), -getArrowDeltaX())); + + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), -getArrowDeltaX())); } else { final UPolygon polygon = getPolygon(textAndArrowHeight); - ug.apply(new UChangeBackColor(getForegroundColor())).apply(new UTranslate(x2, 0)).draw(polygon); + ug.apply(new UChangeBackColor(getForegroundColor())).apply(UTranslate.dx(x2)).draw(polygon); } - getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), 0))); + getTextBlock().drawU(ug.apply(UTranslate.dx(getMarginX1()))); } private UPolygon getPolygon(final double textAndArrowHeight) { diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java index d45051abb..9dc8c43c8 100644 --- a/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.ArrowComponent; @@ -62,23 +61,24 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Rose { final private double paddingX = 5; final public static double paddingY = 5; - public HtmlColor getFontColor(ISkinParam skin, FontParam fontParam) { + public HColor getFontColor(ISkinParam skin, FontParam fontParam) { return skin.getFontHtmlColor(null, fontParam); } - public HtmlColor getHtmlColor(ISkinParam skin, ColorParam color) { + public HColor getHtmlColor(ISkinParam skin, ColorParam color) { return getHtmlColor(skin, null, color); } - public HtmlColor getHtmlColor(ISkinParam skin, Stereotype stereotype, ColorParam... colorParams) { + public HColor getHtmlColor(ISkinParam skin, Stereotype stereotype, ColorParam... colorParams) { for (ColorParam param : colorParams) { - final HtmlColor result = skin.getHtmlColor(param, stereotype, false); + final HColor result = skin.getHtmlColor(param, stereotype, false); if (result != null) { return result; } @@ -94,6 +94,8 @@ public class Rose { Display stringsToDisplay) { final UFont fontGrouping = param.getFont(null, false, FontParam.SEQUENCE_GROUP); + final Stereotype stereotype = stringsToDisplay == null ? null : stringsToDisplay.getStereotypeIfAny(); + final UFont newFontForStereotype = param.getFont(null, false, FontParam.SEQUENCE_STEREOTYPE); if (type.isArrow()) { @@ -101,198 +103,210 @@ public class Rose { } final double padding = param.getPadding(PaddingParam.PARTICIPANT); final double roundCorner = param.getRoundCorner(CornerParam.DEFAULT, null); + final double diagonalCorner = param.getDiagonalCorner(CornerParam.DEFAULT, null); if (type == ComponentType.PARTICIPANT_HEAD) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false, padding); + getSymbolContext(stereotype, param, ColorParam.participantBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + false, padding); } if (type == ComponentType.PARTICIPANT_TAIL) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false, padding); + getSymbolContext(stereotype, param, ColorParam.participantBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + false, padding); } if (type == ComponentType.COLLECTIONS_HEAD) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.collectionsBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true, padding); + getSymbolContext(stereotype, param, ColorParam.collectionsBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + true, padding); } if (type == ComponentType.COLLECTIONS_TAIL) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.collectionsBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true, padding); + getSymbolContext(stereotype, param, ColorParam.collectionsBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + true, padding); } if (type == ComponentType.PARTICIPANT_LINE) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, false, getStroke(param, - LineParam.sequenceLifeLineBorder, 1), param.getIHtmlColorSet()); + final HColor borderColor = getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder); + return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, false, + getStroke(param, LineParam.sequenceLifeLineBorder, 1), param.getIHtmlColorSet()); } if (type == ComponentType.CONTINUE_LINE) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, true, getStroke(param, - LineParam.sequenceLifeLineBorder, 1.5), param.getIHtmlColorSet()); + final HColor borderColor = getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder); + return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, true, + getStroke(param, LineParam.sequenceLifeLineBorder, 1.5), param.getIHtmlColorSet()); } if (type == ComponentType.ACTOR_HEAD) { return new ComponentRoseActor(param.getActorStyle(), styles == null ? null : styles[0], - styles == null ? null : styles[1], getSymbolContext(param, ColorParam.actorBorder), getUFont2( - param, FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor( - param, FontParam.SEQUENCE_STEREOTYPE)); + styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), + getUFont2(param, FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.ACTOR_TAIL) { return new ComponentRoseActor(param.getActorStyle(), styles == null ? null : styles[0], - styles == null ? null : styles[1], getSymbolContext(param, ColorParam.actorBorder), getUFont2( - param, FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, + styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), + getUFont2(param, FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.BOUNDARY_HEAD) { return new ComponentRoseBoundary(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.boundaryBorder), getUFont2(param, FontParam.BOUNDARY), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.BOUNDARY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.boundaryBorder), + getUFont2(param, FontParam.BOUNDARY), stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.BOUNDARY_STEREOTYPE)); } if (type == ComponentType.BOUNDARY_TAIL) { return new ComponentRoseBoundary(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.boundaryBorder), getUFont2(param, FontParam.BOUNDARY), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.BOUNDARY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.boundaryBorder), + getUFont2(param, FontParam.BOUNDARY), stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.BOUNDARY_STEREOTYPE)); } if (type == ComponentType.CONTROL_HEAD) { return new ComponentRoseControl(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.CONTROL_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), + stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.CONTROL_STEREOTYPE)); } if (type == ComponentType.CONTROL_TAIL) { return new ComponentRoseControl(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.CONTROL_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), + stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.CONTROL_STEREOTYPE)); } if (type == ComponentType.ENTITY_HEAD) { return new ComponentRoseEntity(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.ENTITY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), + stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.ENTITY_STEREOTYPE)); } if (type == ComponentType.ENTITY_TAIL) { return new ComponentRoseEntity(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.ENTITY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), + stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.ENTITY_STEREOTYPE)); } if (type == ComponentType.QUEUE_HEAD) { return new ComponentRoseQueue(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.QUEUE), + getSymbolContext(stereotype, param, ColorParam.queueBorder), getUFont2(param, FontParam.QUEUE), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, FontParam.QUEUE_STEREOTYPE)); } if (type == ComponentType.QUEUE_TAIL) { return new ComponentRoseQueue(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.QUEUE), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.QUEUE_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.queueBorder), getUFont2(param, FontParam.QUEUE), + stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.QUEUE_STEREOTYPE)); } if (type == ComponentType.DATABASE_HEAD) { return new ComponentRoseDatabase(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.databaseBorder), getUFont2(param, FontParam.DATABASE), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.DATABASE_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.databaseBorder), + getUFont2(param, FontParam.DATABASE), stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.DATABASE_STEREOTYPE)); } if (type == ComponentType.DATABASE_TAIL) { return new ComponentRoseDatabase(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.databaseBorder), getUFont2(param, FontParam.DATABASE), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.DATABASE_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.databaseBorder), + getUFont2(param, FontParam.DATABASE), stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.DATABASE_STEREOTYPE)); } if (type == ComponentType.NOTE) { final HorizontalAlignment alignment = param.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); - return new ComponentRoseNote(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), stringsToDisplay, paddingX, paddingY, - param, roundCorner, alignment); + return new ComponentRoseNote(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), + stringsToDisplay, paddingX, paddingY, param, roundCorner, alignment); } if (type == ComponentType.NOTE_HEXAGONAL) { final HorizontalAlignment alignment = param.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); - return new ComponentRoseNoteHexagonal(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), stringsToDisplay, param, alignment); + return new ComponentRoseNoteHexagonal(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), + stringsToDisplay, param, alignment); } if (type == ComponentType.NOTE_BOX) { final HorizontalAlignment alignment = param.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); - return new ComponentRoseNoteBox(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), stringsToDisplay, param, roundCorner, - alignment); + return new ComponentRoseNoteBox(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), + stringsToDisplay, param, roundCorner, alignment); } final FontConfiguration bigFont = getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER); if (type == ComponentType.GROUPING_HEADER) { FontConfiguration smallFont = bigFont.forceFont(fontGrouping, null); - final HtmlColor smallColor = SkinParamUtils.getFontColor(param, FontParam.SEQUENCE_GROUP, null); + final HColor smallColor = SkinParamUtils.getFontColor(param, FontParam.SEQUENCE_GROUP, null); if (smallColor != null) { smallFont = smallFont.changeColor(smallColor); } - return new ComponentRoseGroupingHeader(styles == null ? null : styles[0], - styles == null ? null : styles[1], param.getBackgroundColor(), getSymbolContext(param, - ColorParam.sequenceGroupBorder), bigFont, smallFont, stringsToDisplay, param, roundCorner); + return new ComponentRoseGroupingHeader(styles == null ? null : styles[0], styles == null ? null : styles[1], + param.getBackgroundColor(), getSymbolContext(stereotype, param, ColorParam.sequenceGroupBorder), + bigFont, smallFont, stringsToDisplay, param, roundCorner); } if (type == ComponentType.GROUPING_ELSE) { - return new ComponentRoseGroupingElse(styles == null ? null : styles[0], getHtmlColor(param, - ColorParam.sequenceGroupBorder), getUFont2(param, FontParam.SEQUENCE_GROUP), - stringsToDisplay.get(0), param, param.getBackgroundColor()); + return new ComponentRoseGroupingElse(styles == null ? null : styles[0], + getHtmlColor(param, stereotype, ColorParam.sequenceGroupBorder), + getUFont2(param, FontParam.SEQUENCE_GROUP), stringsToDisplay.get(0), param, + param.getBackgroundColor()); } if (type == ComponentType.GROUPING_SPACE) { return new ComponentRoseGroupingSpace(7); } if (type == ComponentType.ALIVE_BOX_CLOSE_CLOSE) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), true, true, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), true, true, + param.getIHtmlColorSet()); } if (type == ComponentType.ALIVE_BOX_CLOSE_OPEN) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), true, false, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), true, false, + param.getIHtmlColorSet()); } if (type == ComponentType.ALIVE_BOX_OPEN_CLOSE) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), false, true, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), false, true, + param.getIHtmlColorSet()); } if (type == ComponentType.ALIVE_BOX_OPEN_OPEN) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), false, false, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), false, false, + param.getIHtmlColorSet()); } if (type == ComponentType.DELAY_LINE) { - return new ComponentRoseDelayLine(null, getHtmlColor(param, ColorParam.sequenceLifeLineBorder)); + return new ComponentRoseDelayLine(null, getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder)); } if (type == ComponentType.DELAY_TEXT) { - return new ComponentRoseDelayText(styles == null ? null : styles[0], getUFont2(param, - FontParam.SEQUENCE_DELAY), stringsToDisplay, param); + return new ComponentRoseDelayText(styles == null ? null : styles[0], + getUFont2(param, FontParam.SEQUENCE_DELAY), stringsToDisplay, param); } if (type == ComponentType.DESTROY) { - return new ComponentRoseDestroy(null, getHtmlColor(param, ColorParam.sequenceLifeLineBorder)); + return new ComponentRoseDestroy(null, getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder)); } if (type == ComponentType.NEWPAGE) { throw new UnsupportedOperationException(); } if (type == ComponentType.DIVIDER) { - return new ComponentRoseDivider(styles == null ? null : styles[0], getUFont2(param, - FontParam.SEQUENCE_DIVIDER), getHtmlColor(param, ColorParam.sequenceDividerBackground), - stringsToDisplay, param, deltaShadow(param, ColorParam.sequenceDividerBackground) > 0, getStroke( - param, LineParam.sequenceDividerBorder, 2), getHtmlColor(param, - ColorParam.sequenceDividerBorder)); + return new ComponentRoseDivider(styles == null ? null : styles[0], + getUFont2(param, FontParam.SEQUENCE_DIVIDER), + getHtmlColor(param, stereotype, ColorParam.sequenceDividerBackground), stringsToDisplay, param, + deltaShadow(param, ColorParam.sequenceDividerBackground) > 0, + getStroke(param, LineParam.sequenceDividerBorder, 2), + getHtmlColor(param, stereotype, ColorParam.sequenceDividerBorder)); } if (type == ComponentType.REFERENCE) { return new ComponentRoseReference(styles == null ? null : styles[0], styles == null ? null : styles[1], - getUFont2(param, FontParam.SEQUENCE_REFERENCE), getSymbolContext(param, - ColorParam.sequenceReferenceBorder), bigFont, stringsToDisplay, + getUFont2(param, FontParam.SEQUENCE_REFERENCE), + getSymbolContext(stereotype, param, ColorParam.sequenceReferenceBorder), bigFont, stringsToDisplay, param.getHorizontalAlignment(AlignmentParam.sequenceReferenceAlignment, null, false), param, - getHtmlColor(param, ColorParam.sequenceReferenceBackground)); + getHtmlColor(param, stereotype, ColorParam.sequenceReferenceBackground)); } if (type == ComponentType.ENGLOBER) { - return new ComponentRoseEnglober(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceBoxBorder), stringsToDisplay, getUFont2(param, FontParam.SEQUENCE_BOX), param, - roundCorner); + return new ComponentRoseEnglober(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceBoxBorder), stringsToDisplay, + getUFont2(param, FontParam.SEQUENCE_BOX), param, roundCorner); } return null; @@ -304,11 +318,11 @@ public class Rose { public ArrowComponent createComponentArrow(Style[] styles, ArrowConfiguration config, ISkinParam param, Display stringsToDisplay) { - final HtmlColor sequenceArrow = config.getColor() == null ? getHtmlColor(param, ColorParam.arrow) : config - .getColor(); + final HColor sequenceArrow = config.getColor() == null ? getHtmlColor(param, ColorParam.arrow) + : config.getColor(); if (config.getArrowDirection() == ArrowDirection.SELF) { - return new ComponentRoseSelfArrow(styles == null ? null : styles[0], sequenceArrow, getUFont2(param, - FontParam.ARROW), stringsToDisplay, config, param, param.maxMessageSize(), + return new ComponentRoseSelfArrow(styles == null ? null : styles[0], sequenceArrow, + getUFont2(param, FontParam.ARROW), stringsToDisplay, config, param, param.maxMessageSize(), param.strictUmlStyle() == false); } HorizontalAlignment messageHorizontalAlignment; @@ -359,9 +373,10 @@ public class Rose { textHorizontalAlignment = param.getHorizontalAlignment(AlignmentParam.sequenceMessageTextAlignment, config.getArrowDirection(), false); } - return new ComponentRoseArrow(styles == null ? null : styles[0], sequenceArrow, getUFont2(param, - FontParam.ARROW), stringsToDisplay, config, messageHorizontalAlignment, param, textHorizontalAlignment, - param.maxMessageSize(), param.strictUmlStyle() == false, param.responseMessageBelowArrow()); + return new ComponentRoseArrow(styles == null ? null : styles[0], sequenceArrow, + getUFont2(param, FontParam.ARROW), stringsToDisplay, config, messageHorizontalAlignment, param, + textHorizontalAlignment, param.maxMessageSize(), param.strictUmlStyle() == false, + param.responseMessageBelowArrow()); } private double deltaShadow(ISkinParam param, ColorParam color) { @@ -385,66 +400,81 @@ public class Rose { return result ? 4.0 : 0; } - private SymbolContext getSymbolContext(ISkinParam skin, ColorParam color) { + private SymbolContext getSymbolContext(Stereotype stereotype, ISkinParam skin, ColorParam color) { if (color == ColorParam.participantBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.participantBackground), getHtmlColor(skin, - ColorParam.participantBorder)) - .withStroke(getStroke(skin, LineParam.sequenceParticipantBorder, 1.5)).withDeltaShadow( - deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.participantBackground), + getHtmlColor(skin, stereotype, ColorParam.participantBorder)) + .withStroke(getStroke(skin, LineParam.sequenceParticipantBorder, 1.5)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.actorBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.actorBackground), getHtmlColor(skin, - ColorParam.actorBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.actorBackground), + getHtmlColor(skin, stereotype, ColorParam.actorBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.boundaryBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.boundaryBackground), getHtmlColor(skin, - ColorParam.boundaryBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.boundaryBackground), + getHtmlColor(skin, stereotype, ColorParam.boundaryBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.controlBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.controlBackground), getHtmlColor(skin, - ColorParam.controlBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.controlBackground), + getHtmlColor(skin, stereotype, ColorParam.controlBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.collectionsBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.collectionsBackground), getHtmlColor(skin, - ColorParam.collectionsBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 1.5)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.collectionsBackground), + getHtmlColor(skin, stereotype, ColorParam.collectionsBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 1.5)) + .withDeltaShadow(deltaShadow(skin, color)); + } + if (color == ColorParam.queueBorder) { + final double tmp = deltaShadow(skin, color); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.queueBackground), + getHtmlColor(skin, stereotype, ColorParam.queueBorder)) + .withStroke(getStroke(skin, LineParam.queueBorder, 2)).withDeltaShadow(tmp); } if (color == ColorParam.entityBorder) { final double tmp = deltaShadow(skin, color); - return new SymbolContext(getHtmlColor(skin, ColorParam.entityBackground), getHtmlColor(skin, - ColorParam.entityBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(tmp); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.entityBackground), + getHtmlColor(skin, stereotype, ColorParam.entityBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)).withDeltaShadow(tmp); } if (color == ColorParam.databaseBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.databaseBackground), getHtmlColor(skin, - ColorParam.databaseBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.databaseBackground), + getHtmlColor(skin, stereotype, ColorParam.databaseBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.sequenceLifeLineBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceLifeLineBackground), getHtmlColor(skin, - ColorParam.sequenceLifeLineBorder)).withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceLifeLineBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceLifeLineBorder)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.noteBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.noteBackground), getHtmlColor(skin, - ColorParam.noteBorder)).withStroke(getStroke(skin, LineParam.noteBorder, 1)).withDeltaShadow( - deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.noteBackground), + getHtmlColor(skin, stereotype, ColorParam.noteBorder)) + .withStroke(getStroke(skin, LineParam.noteBorder, 1)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.sequenceGroupBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceGroupBackground), getHtmlColor(skin, - ColorParam.sequenceGroupBorder)).withStroke(getStroke(skin, LineParam.sequenceGroupBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceGroupBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceGroupBorder)) + .withStroke(getStroke(skin, LineParam.sequenceGroupBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.sequenceBoxBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceBoxBackground), getHtmlColor(skin, - ColorParam.sequenceBoxBorder)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceBoxBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceBoxBorder)); } if (color == ColorParam.sequenceReferenceBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceReferenceHeaderBackground), getHtmlColor( - skin, ColorParam.sequenceReferenceBorder)).withStroke( - getStroke(skin, LineParam.sequenceReferenceBorder, 2)).withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceReferenceHeaderBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceReferenceBorder)) + .withStroke(getStroke(skin, LineParam.sequenceReferenceBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/sprite/ColorPalette.java b/src/net/sourceforge/plantuml/sprite/ColorPalette.java index dc6717ccf..fc0352ee7 100644 --- a/src/net/sourceforge/plantuml/sprite/ColorPalette.java +++ b/src/net/sourceforge/plantuml/sprite/ColorPalette.java @@ -37,23 +37,23 @@ package net.sourceforge.plantuml.sprite; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class ColorPalette { private static final String colorValue = "!#$%&*+-:;<=>?@^_~GHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public char getCharFor(Color dest) { - return getCharFor(new HtmlColorSimple(dest, false)); + return getCharFor(new HColorSimple(dest, false)); } - public char getCharFor(HtmlColor dest) { + public char getCharFor(HColor dest) { char result = 0; double resultDist = Double.MAX_VALUE; for (int i = 0; i < colorValue.length(); i++) { final char c = colorValue.charAt(i); - final double dist = ((HtmlColorSimple) dest).distance(getHtmlColorSimpleFor(c)); + final double dist = ((HColorSimple) dest).distance(getHtmlColorSimpleFor(c)); if (dist < resultDist) { result = c; resultDist = dist; @@ -63,12 +63,12 @@ public class ColorPalette { return result; } - private HtmlColorSimple getHtmlColorSimpleFor(char c) { + private HColorSimple getHtmlColorSimpleFor(char c) { final Color color = getColorFor(c); if (color == null) { throw new IllegalArgumentException(); } - return new HtmlColorSimple(color, false); + return new HColorSimple(color, false); } public Color getColorFor(char c) { diff --git a/src/net/sourceforge/plantuml/sprite/ColorPalette4096.java b/src/net/sourceforge/plantuml/sprite/ColorPalette4096.java index 82779347d..b8c2d6265 100644 --- a/src/net/sourceforge/plantuml/sprite/ColorPalette4096.java +++ b/src/net/sourceforge/plantuml/sprite/ColorPalette4096.java @@ -37,22 +37,22 @@ package net.sourceforge.plantuml.sprite; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class ColorPalette4096 { private static final String colorValue = "!#$%&*+-:;<=>?@^_~GHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public String getStringFor(Color dest) { - return getStringFor(new HtmlColorSimple(dest, false)); + return getStringFor(new HColorSimple(dest, false)); } - public String getStringFor(HtmlColor dest) { + public String getStringFor(HColor dest) { int result = 0; double resultDist = Double.MAX_VALUE; for (int i = 0; i < 4096; i++) { - final double dist = ((HtmlColorSimple) dest).distance(getHtmlColorSimpleFor(i)); + final double dist = ((HColorSimple) dest).distance(getHtmlColorSimpleFor(i)); if (dist < resultDist) { result = i; resultDist = dist; @@ -68,12 +68,12 @@ public class ColorPalette4096 { return "" + colorValue.charAt(v1) + colorValue.charAt(v2); } - private HtmlColorSimple getHtmlColorSimpleFor(int s) { + private HColorSimple getHtmlColorSimpleFor(int s) { final Color color = getColorFor(s); if (color == null) { throw new IllegalArgumentException(); } - return new HtmlColorSimple(color, false); + return new HColorSimple(color, false); } public Color getColorFor(String s) { diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java index 7ce43f5a5..f2308849b 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -58,6 +57,7 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ListSpriteDiagram extends UmlDiagram { @@ -102,7 +102,7 @@ public class ListSpriteDiagram extends UmlDiagram { TextBlock blockName = Display.create(n).create( FontConfiguration.blackBlueTrue(UFont.sansSerif(14)), HorizontalAlignment.LEFT, getSkinParam()); - TextBlock tb = sprite.asTextBlock(HtmlColorUtils.BLACK, 1.0); + TextBlock tb = sprite.asTextBlock(HColorUtils.BLACK, 1.0); tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER); tb.drawU(ug.apply(new UTranslate(x, y))); final Dimension2D dim = tb.calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/sprite/PSystemListInternalSprites.java b/src/net/sourceforge/plantuml/sprite/PSystemListInternalSprites.java index a4c040321..89be13037 100644 --- a/src/net/sourceforge/plantuml/sprite/PSystemListInternalSprites.java +++ b/src/net/sourceforge/plantuml/sprite/PSystemListInternalSprites.java @@ -45,13 +45,13 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.donors.PSystemDonors; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockHorizontal; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.VerticalAlignment; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemListInternalSprites extends AbstractPSystem { @@ -59,7 +59,7 @@ public class PSystemListInternalSprites extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final UDrawable result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, getMetadata(), null, 0, 0, null, false); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); diff --git a/src/net/sourceforge/plantuml/sprite/Sprite.java b/src/net/sourceforge/plantuml/sprite/Sprite.java index f061d85dd..795b34649 100644 --- a/src/net/sourceforge/plantuml/sprite/Sprite.java +++ b/src/net/sourceforge/plantuml/sprite/Sprite.java @@ -35,11 +35,11 @@ */ package net.sourceforge.plantuml.sprite; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface Sprite { - public TextBlock asTextBlock(final HtmlColor color, double scale); + public TextBlock asTextBlock(final HColor color, double scale); } diff --git a/src/net/sourceforge/plantuml/sprite/SpriteColor.java b/src/net/sourceforge/plantuml/sprite/SpriteColor.java index 608830be8..2612f5869 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteColor.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteColor.java @@ -41,14 +41,14 @@ import java.awt.image.BufferedImage; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class SpriteColor implements Sprite { @@ -97,16 +97,16 @@ public class SpriteColor implements Sprite { return width; } - public UImage toUImage(ColorMapper colorMapper, HtmlColor backcolor, HtmlColor forecolor) { + public UImage toUImage(ColorMapper colorMapper, HColor backcolor, HColor forecolor) { final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); if (backcolor == null) { - backcolor = HtmlColorUtils.WHITE; + backcolor = HColorUtils.WHITE; } if (forecolor == null) { - forecolor = HtmlColorUtils.BLACK; + forecolor = HColorUtils.BLACK; } - final HtmlColorGradient gradient = new HtmlColorGradient(backcolor, forecolor, '\0'); + final HColorGradient gradient = new HColorGradient(backcolor, forecolor, '\0'); for (int col = 0; col < width; col++) { for (int line = 0; line < height; line++) { final int localColor = color[line][col]; @@ -122,7 +122,7 @@ public class SpriteColor implements Sprite { return new UImage(im); } - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java b/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java index 00b4d5213..e3237dd4a 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java @@ -49,7 +49,7 @@ import net.sourceforge.plantuml.code.CompressionZlib; import net.sourceforge.plantuml.code.CompressionZopfliZlib; import net.sourceforge.plantuml.code.PairInt; import net.sourceforge.plantuml.code.SpiralOnRectangle; -import net.sourceforge.plantuml.ugraphic.ColorChangerMonochrome; +import net.sourceforge.plantuml.ugraphic.color.ColorChangerMonochrome; public enum SpriteGrayLevel { diff --git a/src/net/sourceforge/plantuml/sprite/SpriteImage.java b/src/net/sourceforge/plantuml/sprite/SpriteImage.java index ae64e0503..1b2f882f6 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteImage.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteImage.java @@ -44,12 +44,12 @@ import javax.imageio.ImageIO; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class SpriteImage implements Sprite { @@ -59,14 +59,14 @@ public class SpriteImage implements Sprite { this.img = new UImage(img); } - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { if (color == null) { ug.draw(img.scale(scale)); } else { - ug.draw(img.muteColor(((HtmlColorSimple) color).getColor999()).scale(scale)); + ug.draw(img.muteColor(((HColorSimple) color).getColor999()).scale(scale)); } } diff --git a/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java b/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java index 8f4cca647..117836a74 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java @@ -43,15 +43,15 @@ import java.io.OutputStream; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class SpriteMonochrome implements Sprite { @@ -181,19 +181,19 @@ public class SpriteMonochrome implements Sprite { return width; } - public UImage toUImage(ColorMapper colorMapper, HtmlColor backcolor, HtmlColor color) { + public UImage toUImage(ColorMapper colorMapper, HColor backcolor, HColor color) { if (backcolor == null) { - backcolor = HtmlColorUtils.WHITE; + backcolor = HColorUtils.WHITE; } if (color == null) { - color = HtmlColorUtils.BLACK; + color = HColorUtils.BLACK; } // if (backcolor instanceof HtmlColorGradient) { // return special(colorMapper, (HtmlColorGradient) backcolor, color); // } final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); - final HtmlColorGradient gradient = new HtmlColorGradient(backcolor, color, '\0'); + final HColorGradient gradient = new HColorGradient(backcolor, color, '\0'); for (int col = 0; col < width; col++) { for (int line = 0; line < height; line++) { final double coef = 1.0 * grey[line][col] / (grayLevel - 1); @@ -204,13 +204,13 @@ public class SpriteMonochrome implements Sprite { return new UImage(im); } - private UImage special(ColorMapper colorMapper, HtmlColorGradient backcolor, HtmlColor color) { + private UImage special(ColorMapper colorMapper, HColorGradient backcolor, HColor color) { final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int col = 0; col < width; col++) { for (int line = 0; line < height; line++) { - final HtmlColor backColorLocal = new HtmlColorSimple(backcolor.getColor(colorMapper, 1.0 * line + final HColor backColorLocal = new HColorSimple(backcolor.getColor(colorMapper, 1.0 * line / height), false); - final HtmlColorGradient gradient = new HtmlColorGradient(backColorLocal, color, '\0'); + final HColorGradient gradient = new HColorGradient(backColorLocal, color, '\0'); final double coef = 1.0 * grey[line][col] / (grayLevel - 1); final Color c = gradient.getColor(colorMapper, coef); im.setRGB(col, line, c.getRGB()); @@ -219,7 +219,7 @@ public class SpriteMonochrome implements Sprite { return new UImage(im); } - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/sprite/SpriteSvg.java b/src/net/sourceforge/plantuml/sprite/SpriteSvg.java index 0544c569b..965f9aa99 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteSvg.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteSvg.java @@ -44,11 +44,11 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.SvgString; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImageSvg; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SpriteSvg implements Sprite { @@ -66,7 +66,7 @@ public class SpriteSvg implements Sprite { this(FileUtils.readSvg(is)); } - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java index 0edd374b0..1fd688688 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java @@ -55,7 +55,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -64,6 +63,7 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class StdlibDiagram extends UmlDiagram { @@ -144,7 +144,7 @@ public class StdlibDiagram extends UmlDiagram { final Sprite sprite = getSkinParam().getSprite(n); TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)), HorizontalAlignment.LEFT, getSkinParam()); - TextBlock tb = sprite.asTextBlock(HtmlColorUtils.BLACK, 1.0); + TextBlock tb = sprite.asTextBlock(HColorUtils.BLACK, 1.0); tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER); tb.drawU(ug.apply(new UTranslate(x, y))); final Dimension2D dim = tb.calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java index db318bf25..62e821c00 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java @@ -56,11 +56,11 @@ import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.statediagram.StateDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreatePackageState extends SingleLineCommand2 { @@ -134,7 +134,7 @@ public class CommandCreatePackageState extends SingleLineCommand2 Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java index 2eab0b6fb..29f9da5cc 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java @@ -54,11 +54,11 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.statediagram.StateDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateState extends SingleLineCommand2 { @@ -133,7 +133,7 @@ public class CommandCreateState extends SingleLineCommand2 { Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } diff --git a/src/net/sourceforge/plantuml/stats/PSystemStats.java b/src/net/sourceforge/plantuml/stats/PSystemStats.java index 853de4e02..1719c87a6 100644 --- a/src/net/sourceforge/plantuml/stats/PSystemStats.java +++ b/src/net/sourceforge/plantuml/stats/PSystemStats.java @@ -45,8 +45,8 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemStats extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/style/Style.java b/src/net/sourceforge/plantuml/style/Style.java index 614253cc7..fcf3f01dc 100644 --- a/src/net/sourceforge/plantuml/style/Style.java +++ b/src/net/sourceforge/plantuml/style/Style.java @@ -45,8 +45,6 @@ import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -56,6 +54,8 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class Style { @@ -98,7 +98,7 @@ public class Style { // return new Style(this.kind.add(other.kind), this.name + "," + other.name, both); } - public Style eventuallyOverride(PName param, HtmlColor color) { + public Style eventuallyOverride(PName param, HColor color) { if (color == null) { return this; } @@ -112,11 +112,11 @@ public class Style { public Style eventuallyOverride(Colors colors) { Style result = this; if (colors != null) { - final HtmlColor back = colors.getColor(ColorType.BACK); + final HColor back = colors.getColor(ColorType.BACK); if (back != null) { result = result.eventuallyOverride(PName.BackGroundColor, back); } - final HtmlColor line = colors.getColor(ColorType.LINE); + final HColor line = colors.getColor(ColorType.LINE); if (line != null) { result = result.eventuallyOverride(PName.LineColor, line); } @@ -127,7 +127,7 @@ public class Style { public Style eventuallyOverride(SymbolContext symbolContext) { Style result = this; if (symbolContext != null) { - final HtmlColor back = symbolContext.getBackColor(); + final HColor back = symbolContext.getBackColor(); if (back != null) { result = result.eventuallyOverride(PName.BackGroundColor, back); } @@ -146,16 +146,16 @@ public class Style { return new UFont(family, fontStyle, size); } - public FontConfiguration getFontConfiguration(IHtmlColorSet set) { + public FontConfiguration getFontConfiguration(HColorSet set) { final UFont font = getUFont(); - final HtmlColor color = value(PName.FontColor).asColor(set); - final HtmlColor hyperlinkColor = value(PName.HyperLinkColor).asColor(set); + final HColor color = value(PName.FontColor).asColor(set); + final HColor hyperlinkColor = value(PName.HyperLinkColor).asColor(set); return new FontConfiguration(font, color, hyperlinkColor, true); } - public SymbolContext getSymbolContext(IHtmlColorSet set) { - final HtmlColor backColor = value(PName.BackGroundColor).asColor(set); - final HtmlColor foreColor = value(PName.LineColor).asColor(set); + public SymbolContext getSymbolContext(HColorSet set) { + final HColor backColor = value(PName.BackGroundColor).asColor(set); + final HColor foreColor = value(PName.LineColor).asColor(set); final double deltaShadowing = value(PName.Shadowing).asDouble(); return new SymbolContext(backColor, foreColor).withStroke(getStroke()).withDeltaShadow(deltaShadowing); } @@ -198,19 +198,19 @@ public class Style { return value(PName.HorizontalAlignment).asHorizontalAlignment(); } - private TextBlock createTextBlockInternal(Display display, IHtmlColorSet set, ISkinSimple spriteContainer, + private TextBlock createTextBlockInternal(Display display, HColorSet set, ISkinSimple spriteContainer, HorizontalAlignment alignment) { final FontConfiguration fc = getFontConfiguration(set); return display.create(fc, alignment, spriteContainer); } - public TextBlock createTextBlockBordered(Display note, IHtmlColorSet set, ISkinSimple spriteContainer) { + public TextBlock createTextBlockBordered(Display note, HColorSet set, ISkinSimple spriteContainer) { // final HorizontalAlignment alignment = HorizontalAlignment.LEFT; final HorizontalAlignment alignment = this.getHorizontalAlignment(); final TextBlock textBlock = this.createTextBlockInternal(note, set, spriteContainer, alignment); - final HtmlColor legendBackgroundColor = this.value(PName.BackGroundColor).asColor(set); - final HtmlColor legendColor = this.value(PName.LineColor).asColor(set); + final HColor legendBackgroundColor = this.value(PName.BackGroundColor).asColor(set); + final HColor legendColor = this.value(PName.LineColor).asColor(set); final UStroke stroke = this.getStroke(); final int cornersize = this.value(PName.RoundCorner).asInt(); final double margin = this.value(PName.Margin).asDouble(); @@ -221,7 +221,7 @@ public class Style { return TextBlockUtils.withMargin(result, margin, margin); } - public UGraphic applyStrokeAndLineColor(UGraphic ug, IHtmlColorSet colorSet) { + public UGraphic applyStrokeAndLineColor(UGraphic ug, HColorSet colorSet) { ug = ug.apply(new UChangeColor(value(PName.LineColor).asColor(colorSet))); ug = ug.apply(getStroke()); return ug; diff --git a/src/net/sourceforge/plantuml/style/Value.java b/src/net/sourceforge/plantuml/style/Value.java index ea45626b0..a237353cf 100644 --- a/src/net/sourceforge/plantuml/style/Value.java +++ b/src/net/sourceforge/plantuml/style/Value.java @@ -36,14 +36,14 @@ package net.sourceforge.plantuml.style; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public interface Value { public String asString(); - public HtmlColor asColor(IHtmlColorSet set); + public HColor asColor(HColorSet set); public int asInt(); diff --git a/src/net/sourceforge/plantuml/style/ValueAbstract.java b/src/net/sourceforge/plantuml/style/ValueAbstract.java index 6066f8d50..e46e82acd 100644 --- a/src/net/sourceforge/plantuml/style/ValueAbstract.java +++ b/src/net/sourceforge/plantuml/style/ValueAbstract.java @@ -36,8 +36,8 @@ package net.sourceforge.plantuml.style; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public abstract class ValueAbstract implements Value { @@ -45,7 +45,7 @@ public abstract class ValueAbstract implements Value { throw new UnsupportedOperationException("Class=" + getClass()); } - public HtmlColor asColor(IHtmlColorSet set) { + public HColor asColor(HColorSet set) { throw new UnsupportedOperationException("Class=" + getClass()); } diff --git a/src/net/sourceforge/plantuml/style/ValueColor.java b/src/net/sourceforge/plantuml/style/ValueColor.java index e7a87ee4e..f2316c7db 100644 --- a/src/net/sourceforge/plantuml/style/ValueColor.java +++ b/src/net/sourceforge/plantuml/style/ValueColor.java @@ -35,20 +35,20 @@ */ package net.sourceforge.plantuml.style; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ValueColor extends ValueAbstract { - private final HtmlColor color; + private final HColor color; private final int priority; - public ValueColor(HtmlColor color, int priority) { + public ValueColor(HColor color, int priority) { this.color = color; this.priority = priority; } - public HtmlColor asColor(IHtmlColorSet set) { + public HColor asColor(HColorSet set) { return color; } diff --git a/src/net/sourceforge/plantuml/style/ValueImpl.java b/src/net/sourceforge/plantuml/style/ValueImpl.java index a9db9ee84..a3263e39a 100644 --- a/src/net/sourceforge/plantuml/style/ValueImpl.java +++ b/src/net/sourceforge/plantuml/style/ValueImpl.java @@ -38,8 +38,8 @@ package net.sourceforge.plantuml.style; import java.awt.Font; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ValueImpl implements Value { @@ -60,7 +60,7 @@ public class ValueImpl implements Value { return value; } - public HtmlColor asColor(IHtmlColorSet set) { + public HColor asColor(HColorSet set) { if ("none".equalsIgnoreCase(value) || "transparent".equalsIgnoreCase(value)) { return null; } diff --git a/src/net/sourceforge/plantuml/style/ValueNull.java b/src/net/sourceforge/plantuml/style/ValueNull.java index 62426a16f..d27ae9eb3 100644 --- a/src/net/sourceforge/plantuml/style/ValueNull.java +++ b/src/net/sourceforge/plantuml/style/ValueNull.java @@ -38,9 +38,9 @@ package net.sourceforge.plantuml.style; import java.awt.Font; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ValueNull extends ValueAbstract implements Value { @@ -75,8 +75,8 @@ public class ValueNull extends ValueAbstract implements Value { } @Override - public HtmlColor asColor(IHtmlColorSet set) { - return HtmlColorUtils.BLACK; + public HColor asColor(HColorSet set) { + return HColorUtils.BLACK; } @Override diff --git a/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java b/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java index 2057c135c..be5626062 100644 --- a/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java +++ b/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java @@ -54,16 +54,16 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.eps.EpsStrategy; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.png.PngIO; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; @@ -145,19 +145,19 @@ public class GraphicsSudoku { } } - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.BLACK)).apply(new UChangeColor(null)); + ug = ug.apply(new UChangeBackColor(HColorUtils.BLACK)).apply(new UChangeColor(null)); for (int i = 0; i < 10; i++) { final boolean bold = i % boldWidth == 0; final int w = bold ? boldWidth : 1; - ug.apply(new UTranslate(0, i * cellHeight)).draw(new URectangle(9 * cellWidth + boldWidth, w)); + ug.apply(UTranslate.dy(i * cellHeight)).draw(new URectangle(9 * cellWidth + boldWidth, w)); } for (int i = 0; i < 10; i++) { final boolean bold = i % boldWidth == 0; final int w = bold ? boldWidth : 1; - ug.apply(new UTranslate(i * cellWidth, 0)).draw(new URectangle(w, 9 * cellHeight + boldWidth)); + ug.apply(UTranslate.dx(i * cellWidth)).draw(new URectangle(w, 9 * cellHeight + boldWidth)); } - ug = ug.apply(new UTranslate(0, sudoHeight)); + ug = ug.apply(UTranslate.dy(sudoHeight)); final List texts = new ArrayList(); texts.add("http://plantuml.com"); texts.add("Seed " + Long.toString(sudoku.getSeed(), 36)); diff --git a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java index 07cf928e7..c850a164f 100644 --- a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java @@ -39,8 +39,8 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.color.HColor; public abstract class AbstractEntityImage extends AbstractTextBlock implements IEntityImage { @@ -68,7 +68,7 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I return skinParam; } - public final HtmlColor getBackcolor() { + public final HColor getBackcolor() { return null; } diff --git a/src/net/sourceforge/plantuml/svek/Boundary.java b/src/net/sourceforge/plantuml/svek/Boundary.java index 3c920b55c..eff83f160 100644 --- a/src/net/sourceforge/plantuml/svek/Boundary.java +++ b/src/net/sourceforge/plantuml/svek/Boundary.java @@ -82,7 +82,7 @@ public class Boundary extends AbstractTextBlock { path.setDeltaShadow(symbolContext.getDeltaShadow()); ug.apply(new UTranslate(x, y)).apply(new UChangeBackColor(null)).draw(path); - // final ULine line1 = new ULine(0, radius * 2); + // final ULine line1 = ULine.dy(radius * 2); // line1.setDeltaShadow(deltaShadow); // ug.apply(new UTranslate(x, y)).draw(line1); // final ULine line2 = new ULine(left, 0); diff --git a/src/net/sourceforge/plantuml/svek/CircleInterface2.java b/src/net/sourceforge/plantuml/svek/CircleInterface2.java index ec11a992c..8f0c7bd86 100644 --- a/src/net/sourceforge/plantuml/svek/CircleInterface2.java +++ b/src/net/sourceforge/plantuml/svek/CircleInterface2.java @@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -48,6 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CircleInterface2 extends AbstractTextBlock implements TextBlock { @@ -55,13 +55,13 @@ public class CircleInterface2 extends AbstractTextBlock implements TextBlock { private final double radius = 8; - private final HtmlColor backgroundColor; - private final HtmlColor foregroundColor; + private final HColor backgroundColor; + private final HColor foregroundColor; private final float thickness = 2; private final double deltaShadow; - public CircleInterface2(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow) { + public CircleInterface2(HColor backgroundColor, HColor foregroundColor, double deltaShadow) { this.backgroundColor = backgroundColor; this.foregroundColor = foregroundColor; this.deltaShadow = deltaShadow; diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index ab5681e45..8afce16cf 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -68,8 +68,6 @@ import net.sourceforge.plantuml.cucadiagram.MethodsOrFieldsArea; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; @@ -92,6 +90,8 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; import net.sourceforge.plantuml.utils.UniqueSequence; public class Cluster implements Moveable { @@ -303,7 +303,7 @@ public class Cluster implements Moveable { this.yTitle = y; } - private static HtmlColor getColor(ColorParam colorParam, ISkinParam skinParam, Stereotype stereotype) { + private static HColor getColor(ColorParam colorParam, ISkinParam skinParam, Stereotype stereotype) { return SkinParamUtils.getColor(skinParam, stereotype, colorParam); } @@ -320,7 +320,7 @@ public class Cluster implements Moveable { ug.draw(new UComment("cluster " + fullName)); } final Stereotype stereotype = group.getStereotype(); - HtmlColor borderColor; + HColor borderColor; if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); borderColor = style.value(PName.LineColor).asColor(skinParam2.getIHtmlColorSet()); @@ -363,7 +363,7 @@ public class Cluster implements Moveable { packageStyle = skinParam2.getPackageStyle(); } if (border != null) { - final HtmlColor tmp = skinParam2.getHtmlColor(border, group.getStereotype(), false); + final HColor tmp = skinParam2.getHtmlColor(border, group.getStereotype(), false); if (tmp != null) { borderColor = tmp; } @@ -382,7 +382,7 @@ public class Cluster implements Moveable { : 0; } } - HtmlColor backColor = getBackColor(umlDiagramType); + HColor backColor = getBackColor(umlDiagramType); backColor = getBackColor(backColor, skinParam2, group.getStereotype()); if (ztitle != null || zstereo != null) { final double roundCorner = group.getUSymbol() == null ? 0 @@ -452,22 +452,22 @@ public class Cluster implements Moveable { xTitle = minX + ((maxX - minX - widthTitle) / 2); } - private void drawSwinLinesState(UGraphic ug, HtmlColor borderColor) { + private void drawSwinLinesState(UGraphic ug, HColor borderColor) { if (ztitle != null) { - ztitle.drawU(ug.apply(new UTranslate(xTitle, 0))); + ztitle.drawU(ug.apply(UTranslate.dx(xTitle))); } - final ULine line = new ULine(0, maxY - minY); + final ULine line = ULine.vline(maxY - minY); ug = ug.apply(new UChangeColor(borderColor)); - ug.apply(new UTranslate(minX, 0)).draw(line); - ug.apply(new UTranslate(maxX, 0)).draw(line); + ug.apply(UTranslate.dx(minX)).draw(line); + ug.apply(UTranslate.dx(maxX)).draw(line); } - private HtmlColor getColor(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) { + private HColor getColor(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) { return new Rose().getHtmlColor(skinParam, stereo, colorParam); } - private void drawUState(UGraphic ug, HtmlColor borderColor, ISkinParam skinParam2, UStroke stroke, + private void drawUState(UGraphic ug, HColor borderColor, ISkinParam skinParam2, UStroke stroke, UmlDiagramType umlDiagramType) { final Dimension2D total = new Dimension2DDouble(maxX - minX, maxY - minY); final double suppY; @@ -478,11 +478,11 @@ public class Cluster implements Moveable { + IEntityImage.MARGIN_LINE; } - HtmlColor stateBack = getBackColor(umlDiagramType); + HColor stateBack = getBackColor(umlDiagramType); if (stateBack == null) { stateBack = getColor(skinParam2, ColorParam.stateBackground, group.getStereotype()); } - final HtmlColor background = getColor(skinParam2, ColorParam.background, null); + final HColor background = getColor(skinParam2, ColorParam.background, null); final TextBlockWidth attribute = getTextBlockAttribute(skinParam2); final double attributeHeight = attribute.calculateDimension(ug.getStringBounder()).getHeight(); final RoundedContainer r = new RoundedContainer(total, suppY, @@ -856,11 +856,11 @@ public class Cluster implements Moveable { return colorTitle; } - private final HtmlColor getBackColor(final UmlDiagramType umlDiagramType) { + private final HColor getBackColor(final UmlDiagramType umlDiagramType) { if (EntityUtils.groupRoot(group)) { return null; } - final HtmlColor result = group.getColors(skinParam).getColor(ColorType.BACK); + final HColor result = group.getColors(skinParam).getColor(ColorType.BACK); if (result != null) { return result; } @@ -868,7 +868,7 @@ public class Cluster implements Moveable { final USymbol sym = group.getUSymbol() == null ? USymbol.PACKAGE : group.getUSymbol(); final ColorParam backparam = umlDiagramType == UmlDiagramType.ACTIVITY ? ColorParam.partitionBackground : sym.getColorParamBack(); - final HtmlColor c1 = skinParam.getHtmlColor(backparam, stereo, false); + final HColor c1 = skinParam.getHtmlColor(backparam, stereo, false); if (c1 != null) { return c1; } @@ -885,14 +885,14 @@ public class Cluster implements Moveable { return group == ent; } - public static HtmlColor getBackColor(HtmlColor backColor, ISkinParam skinParam, Stereotype stereotype) { + public static HColor getBackColor(HColor backColor, ISkinParam skinParam, Stereotype stereotype) { if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); if (backColor == null) { backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); } if (backColor == null /* || stateBack instanceof HtmlColorTransparent */) { - backColor = new HtmlColorTransparent(); + backColor = new HColorBackground(skinParam.getBackgroundColor()); } return backColor; } @@ -903,7 +903,7 @@ public class Cluster implements Moveable { backColor = skinParam.getHtmlColor(ColorParam.background, stereotype, false); } if (backColor == null /* || stateBack instanceof HtmlColorTransparent */) { - backColor = new HtmlColorTransparent(); + backColor = new HColorBackground(skinParam.getBackgroundColor()); } return backColor; } diff --git a/src/net/sourceforge/plantuml/svek/ClusterDecoration.java b/src/net/sourceforge/plantuml/svek/ClusterDecoration.java index c41cd2cb4..c8d233580 100644 --- a/src/net/sourceforge/plantuml/svek/ClusterDecoration.java +++ b/src/net/sourceforge/plantuml/svek/ClusterDecoration.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.svek; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ClusterDecoration { @@ -83,7 +83,7 @@ public class ClusterDecoration { public final static int marginTitleY1 = 3; public final static int marginTitleY2 = 3; - public void drawU(UGraphic ug, HtmlColor backColor, HtmlColor borderColor, double shadowing, double roundCorner, + public void drawU(UGraphic ug, HColor backColor, HColor borderColor, double shadowing, double roundCorner, HorizontalAlignment titleAlignment, HorizontalAlignment stereoAlignment) { final SymbolContext biColor = new SymbolContext(backColor, borderColor); if (symbol == null) { diff --git a/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java b/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java index e0720ca89..abecb94b0 100644 --- a/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java +++ b/src/net/sourceforge/plantuml/svek/ConcurrentStateImage.java @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -52,13 +51,14 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class ConcurrentStateImage extends AbstractTextBlock implements IEntityImage { private final List inners = new ArrayList(); private final Separator separator; private final ISkinParam skinParam; - private final HtmlColor backColor; + private final HColor backColor; static enum Separator { VERTICAL, HORIZONTAL; @@ -75,9 +75,9 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn UTranslate move(Dimension2D dim) { if (this == VERTICAL) { - return new UTranslate(dim.getWidth(), 0); + return UTranslate.dx(dim.getWidth()); } - return new UTranslate(0, dim.getHeight()); + return UTranslate.dy(dim.getHeight()); } Dimension2D add(Dimension2D orig, Dimension2D other) { @@ -94,20 +94,20 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn final int DASH = 8; ug = ug.apply(new UStroke(DASH, 10, THICKNESS_BORDER)); if (this == VERTICAL) { - ug.draw(new ULine(0, dimTotal.getHeight() + DASH)); + ug.draw(ULine.vline(dimTotal.getHeight() + DASH)); } else { - ug.draw(new ULine(dimTotal.getWidth() + DASH, 0)); + ug.draw(ULine.hline(dimTotal.getWidth() + DASH)); } } } - private HtmlColor getColor(ColorParam colorParam) { + private HColor getColor(ColorParam colorParam) { return new Rose().getHtmlColor(skinParam, colorParam); } public ConcurrentStateImage(Collection images, char concurrentSeparator, ISkinParam skinParam, - HtmlColor backColor) { + HColor backColor) { this.separator = Separator.fromChar(concurrentSeparator); this.skinParam = skinParam; this.backColor = skinParam.getBackgroundColor(); @@ -116,7 +116,7 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn public void drawU(UGraphic ug) { System.err.println("drawing " + inners.size()); - final HtmlColor dotColor = getColor(ColorParam.stateBorder); + final HColor dotColor = getColor(ColorParam.stateBorder); final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimTotal = calculateDimension(stringBounder); @@ -141,7 +141,7 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn return result; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java index c99d58655..002324356 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -51,6 +50,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBlock implements IEntityImage { @@ -74,9 +74,9 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl UTranslate move(Dimension2D dim) { if (this == VERTICAL) { - return new UTranslate(dim.getWidth(), 0); + return UTranslate.dx(dim.getWidth()); } - return new UTranslate(0, dim.getHeight()); + return UTranslate.dy(dim.getHeight()); } Dimension2D add(Dimension2D orig, Dimension2D other) { @@ -93,15 +93,15 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl final int DASH = 8; ug = ug.apply(new UStroke(DASH, 10, THICKNESS_BORDER)); if (this == VERTICAL) { - ug.draw(new ULine(0, dimTotal.getHeight() + DASH)); + ug.draw(ULine.vline(dimTotal.getHeight() + DASH)); } else { - ug.draw(new ULine(dimTotal.getWidth() + DASH, 0)); + ug.draw(ULine.hline(dimTotal.getWidth() + DASH)); } } } - private HtmlColor getColor(ColorParam colorParam, Stereotype stereotype) { + private HColor getColor(ColorParam colorParam, Stereotype stereotype) { return new Rose().getHtmlColor(skinParam, stereotype, colorParam); } @@ -114,7 +114,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl } public void drawU(UGraphic ug) { - final HtmlColor dotColor = getColor(ColorParam.stateBorder, stereotype); + final HColor dotColor = getColor(ColorParam.stateBorder, stereotype); final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimTotal = calculateDimension(stringBounder); @@ -139,7 +139,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl return result; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return skinParam.getBackgroundColor(); } diff --git a/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java b/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java index ec12e7f2a..b53f710e7 100644 --- a/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java @@ -40,13 +40,13 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DecorateEntityImage extends AbstractTextBlock implements TextBlockBackcolored { @@ -103,7 +103,7 @@ public class DecorateEntityImage extends AbstractTextBlock implements TextBlockB if (text1 != null) { final double xText1 = getTextX(dimText1, dimTotal, horizontal1); - text1.drawU(ug.apply(new UTranslate(xText1, 0))); + text1.drawU(ug.apply(UTranslate.dx(xText1))); } original.drawU(ug.apply(new UTranslate(xImage, yImage))); deltaX = xImage; @@ -133,7 +133,7 @@ public class DecorateEntityImage extends AbstractTextBlock implements TextBlockB } } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { if (original instanceof TextBlockBackcolored) { return ((TextBlockBackcolored) original).getBackcolor(); } diff --git a/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java b/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java index ece543cd9..76c52b09f 100644 --- a/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java +++ b/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java @@ -38,17 +38,17 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DecorateEntityImage3 extends AbstractTextBlock implements TextBlockBackcolored { private final TextBlock original; - private final HtmlColor color; + private final HColor color; - public DecorateEntityImage3(TextBlock original, HtmlColor color) { + public DecorateEntityImage3(TextBlock original, HColor color) { this.original = original; this.color = color; } @@ -61,7 +61,7 @@ public class DecorateEntityImage3 extends AbstractTextBlock implements TextBloc original.drawU(ug); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return color; } diff --git a/src/net/sourceforge/plantuml/svek/EntityDomain.java b/src/net/sourceforge/plantuml/svek/EntityDomain.java index 8aa9cee70..75ea5bfea 100644 --- a/src/net/sourceforge/plantuml/svek/EntityDomain.java +++ b/src/net/sourceforge/plantuml/svek/EntityDomain.java @@ -68,7 +68,7 @@ public class EntityDomain extends AbstractTextBlock implements TextBlock { final UEllipse circle = new UEllipse(radius * 2, radius * 2); circle.setDeltaShadow(symbolContext.getDeltaShadow()); ug.apply(new UTranslate(x, y)).draw(circle); - ug.apply(new UTranslate(x, y + 2 * radius + suppY)).draw(new ULine(2 * radius, 0)); + ug.apply(new UTranslate(x, y + 2 * radius + suppY)).draw(ULine.hline(2 * radius)); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/svek/EntityImageProtected.java b/src/net/sourceforge/plantuml/svek/EntityImageProtected.java index 5be9388db..2a71cb0c8 100644 --- a/src/net/sourceforge/plantuml/svek/EntityImageProtected.java +++ b/src/net/sourceforge/plantuml/svek/EntityImageProtected.java @@ -41,11 +41,11 @@ import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageProtected extends AbstractTextBlock implements IEntityImage, Untranslated { @@ -70,7 +70,7 @@ public class EntityImageProtected extends AbstractTextBlock implements IEntityIm return orig.isHidden(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return orig.getBackcolor(); } diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java index a0025f320..608fe88bf 100644 --- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java +++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java @@ -92,7 +92,6 @@ import net.sourceforge.plantuml.descdiagram.EntityImageRequirement; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -131,6 +130,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageTips; import net.sourceforge.plantuml.svek.image.EntityImageUseCase; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class GeneralImageBuilder { @@ -227,7 +227,7 @@ public final class GeneralImageBuilder { if (leaf.getLeafType() == LeafType.EMPTY_PACKAGE) { if (leaf.getUSymbol() != null) { // final HtmlColor black = HtmlColorUtils.BLACK; - final HtmlColor black = SkinParamUtils.getColor(skinParam, leaf.getStereotype(), + final HColor black = SkinParamUtils.getColor(skinParam, leaf.getStereotype(), leaf.getUSymbol().getColorParamBorder()); return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, black), portionShower, links); @@ -305,7 +305,7 @@ public final class GeneralImageBuilder { return false; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } diff --git a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java index 70af5589a..35a1054be 100644 --- a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java +++ b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java @@ -52,13 +52,13 @@ import net.sourceforge.plantuml.fun.IconLoader; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.QuoteUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.version.Version; public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { @@ -167,8 +167,8 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { return false; } - public HtmlColor getBackcolor() { - return HtmlColorUtils.WHITE; + public HColor getBackcolor() { + return HColorUtils.WHITE; } public Dimension2D calculateDimension(StringBounder stringBounder) { @@ -184,7 +184,7 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { graphicStrings.drawU(ug); if (flashCode != null) { final double h = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); - ug = ug.apply(new UTranslate(0, h)); + ug = ug.apply(UTranslate.dy(h)); ug.draw(new UImage(flashCode).scaleNearestNeighbor(3)); } } diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java index 4ac245131..d6337112a 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java @@ -55,7 +55,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.SuperGroup; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; @@ -64,6 +63,7 @@ import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.image.EntityImageState; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class GroupPngMakerActivity { @@ -139,8 +139,8 @@ public final class GroupPngMakerActivity { if (group.getGroupType() == GroupType.INNER_ACTIVITY) { final Stereotype stereo = group.getStereotype(); - final HtmlColor borderColor = getColor(ColorParam.activityBorder, stereo); - final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null + final HColor borderColor = getColor(ColorParam.activityBorder, stereo); + final HColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor(ColorParam.background, stereo) : group.getColors(skinParam).getColor(ColorType.BACK); final double shadowing; @@ -159,7 +159,7 @@ public final class GroupPngMakerActivity { private final Rose rose = new Rose(); - protected final HtmlColor getColor(ColorParam colorParam, Stereotype stereo) { + protected final HColor getColor(ColorParam colorParam, Stereotype stereo) { final ISkinParam skinParam = diagram.getSkinParam(); return rose.getHtmlColor(skinParam, stereo, colorParam); } diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java index 5368d1e04..a7b15b6ce 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java @@ -58,7 +58,6 @@ import net.sourceforge.plantuml.cucadiagram.SuperGroup; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; @@ -68,6 +67,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.EntityImageState; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class GroupPngMakerState { @@ -149,12 +149,12 @@ public final class GroupPngMakerState { throw new UnsupportedOperationException(group.getGroupType().toString()); } - HtmlColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE); + HColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE); if (borderColor == null) { borderColor = getColor(ColorParam.stateBorder, group.getStereotype()); } final Stereotype stereo = group.getStereotype(); - final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null + final HColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor(ColorParam.stateBackground, stereo) : group.getColors(skinParam).getColor(ColorType.BACK); final TextBlockWidth attribute = getAttributes(skinParam); @@ -219,7 +219,7 @@ public final class GroupPngMakerState { private final Rose rose = new Rose(); - private HtmlColor getColor(ColorParam colorParam, Stereotype stereo) { + private HColor getColor(ColorParam colorParam, Stereotype stereo) { final ISkinParam skinParam = diagram.getSkinParam(); return rose.getHtmlColor(skinParam, stereo, colorParam); } diff --git a/src/net/sourceforge/plantuml/svek/IEntityImageMoved.java b/src/net/sourceforge/plantuml/svek/IEntityImageMoved.java index db7f2f544..a810a7be2 100644 --- a/src/net/sourceforge/plantuml/svek/IEntityImageMoved.java +++ b/src/net/sourceforge/plantuml/svek/IEntityImageMoved.java @@ -39,12 +39,12 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class IEntityImageMoved implements IEntityImage { @@ -59,7 +59,7 @@ public class IEntityImageMoved implements IEntityImage { return orig.isHidden(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return orig.getBackcolor(); } diff --git a/src/net/sourceforge/plantuml/svek/InnerActivity.java b/src/net/sourceforge/plantuml/svek/InnerActivity.java index 2517b739d..90e36cc3a 100644 --- a/src/net/sourceforge/plantuml/svek/InnerActivity.java +++ b/src/net/sourceforge/plantuml/svek/InnerActivity.java @@ -38,22 +38,22 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class InnerActivity extends AbstractTextBlock implements IEntityImage { private final IEntityImage im; - private final HtmlColor borderColor; + private final HColor borderColor; private final double shadowing; - private final HtmlColor backColor; + private final HColor backColor; - public InnerActivity(final IEntityImage im, HtmlColor borderColor, HtmlColor backColor, double shadowing) { + public InnerActivity(final IEntityImage im, HColor borderColor, HColor backColor, double shadowing) { this.im = im; this.backColor = backColor; this.borderColor = borderColor; @@ -67,15 +67,14 @@ public final class InnerActivity extends AbstractTextBlock implements IEntityIma ug = ug.apply(new UChangeBackColor(backColor)).apply(new UChangeColor(borderColor)) .apply(new UStroke(THICKNESS_BORDER)); - final URectangle rect = new URectangle(total.getWidth(), total.getHeight(), IEntityImage.CORNER, - IEntityImage.CORNER); + final URectangle rect = new URectangle(total.getWidth(), total.getHeight()).rounded(IEntityImage.CORNER); rect.setDeltaShadow(shadowing); ug.draw(rect); ug = ug.apply(new UStroke()); im.drawU(ug); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return im.getBackcolor(); } @@ -95,10 +94,9 @@ public final class InnerActivity extends AbstractTextBlock implements IEntityIma public boolean isHidden() { return im.isHidden(); } - + public double getOverscanX(StringBounder stringBounder) { return 0; } - } diff --git a/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java b/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java index 19f225d91..837ee82bb 100644 --- a/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java +++ b/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java @@ -40,7 +40,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockWidth; @@ -49,21 +48,22 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class InnerStateAutonom extends AbstractTextBlock implements IEntityImage { private final IEntityImage im; private final TextBlock title; private final TextBlockWidth attribute; - private final HtmlColor borderColor; - private final HtmlColor backColor; + private final HColor borderColor; + private final HColor backColor; private final boolean shadowing; private final Url url; private final boolean withSymbol; private final UStroke stroke; public InnerStateAutonom(final IEntityImage im, final TextBlock title, TextBlockWidth attribute, - HtmlColor borderColor, HtmlColor backColor, boolean shadowing, Url url, boolean withSymbol, UStroke stroke) { + HColor borderColor, HColor backColor, boolean shadowing, Url url, boolean withSymbol, UStroke stroke) { this.im = im; this.withSymbol = withSymbol; this.title = title; @@ -93,7 +93,7 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit title.drawU(ug.apply(new UTranslate((total.getWidth() - text.getWidth()) / 2, IEntityImage.MARGIN))); attribute.asTextBlock(total.getWidth()).drawU( ug.apply(new UTranslate(0 + IEntityImage.MARGIN, IEntityImage.MARGIN + text.getHeight() - + IEntityImage.MARGIN))); + + IEntityImage.MARGIN))); final double spaceYforURL = getSpaceYforURL(ug.getStringBounder()); im.drawU(ug.apply(new UTranslate(IEntityImage.MARGIN, spaceYforURL))); @@ -117,7 +117,7 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit return suppY + IEntityImage.MARGIN_LINE; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index 9e321e755..949e75340 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -70,8 +70,6 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockArrow; @@ -101,6 +99,8 @@ import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Line implements Moveable, Hideable { @@ -141,10 +141,10 @@ public class Line implements Moveable, Hideable { private Cluster projectionCluster; private final Pragma pragma; - private final HtmlColor backgroundColor; + private final HColor backgroundColor; private final boolean useRankSame; private final UStroke defaultThickness; - private HtmlColor arrowLollipopColor; + private HColor arrowLollipopColor; private final ISkinParam skinParam; // private final UmlDiagramType umlType; @@ -252,7 +252,7 @@ public class Line implements Moveable, Hideable { this.defaultThickness = skinParam.getThickness(LineParam.arrow, null); this.arrowLollipopColor = skinParam.getHtmlColor(ColorParam.arrowLollipop, null, false); if (arrowLollipopColor == null) { - this.arrowLollipopColor = HtmlColorUtils.WHITE; + this.arrowLollipopColor = HColorUtils.WHITE; } this.pragma = pragma; this.bibliotekon = bibliotekon; @@ -349,7 +349,7 @@ public class Line implements Moveable, Hideable { // final HtmlColor back = visibilityModifier.getBackground() == null ? null : // rose.getHtmlColor(skinParam, // visibilityModifier.getBackground()); - final HtmlColor fore = rose.getHtmlColor(skinParam, visibilityModifier.getForeground()); + final HColor fore = rose.getHtmlColor(skinParam, visibilityModifier.getForeground()); TextBlock visibility = visibilityModifier.getUBlock(skinParam.classAttributeIconSize(), fore, null, false); visibility = TextBlockUtils.withMargin(visibility, 0, 1, 2, 0); label = TextBlockUtils.mergeLR(visibility, label, VerticalAlignment.CENTER); @@ -661,7 +661,7 @@ public class Line implements Moveable, Hideable { } - public void drawU(UGraphic ug, HtmlColor color, Set ids) { + public void drawU(UGraphic ug, HColor color, Set ids) { if (opale) { return; } @@ -689,7 +689,7 @@ public class Line implements Moveable, Hideable { } if (this.link.getColors() != null) { - final HtmlColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); + final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); if (newColor != null) { color = newColor; } @@ -823,7 +823,7 @@ public class Line implements Moveable, Hideable { } } - private void drawRainbow(UGraphic ug, HtmlColor color, DotPath todraw, List supplementaryColors, + private void drawRainbow(UGraphic ug, HColor color, DotPath todraw, List supplementaryColors, UStroke stroke) { ug.draw(todraw); final LinkType linkType = link.getType(); diff --git a/src/net/sourceforge/plantuml/svek/PackageStyle.java b/src/net/sourceforge/plantuml/svek/PackageStyle.java index 62829207c..9aaa9ca77 100644 --- a/src/net/sourceforge/plantuml/svek/PackageStyle.java +++ b/src/net/sourceforge/plantuml/svek/PackageStyle.java @@ -136,12 +136,12 @@ public enum PackageStyle { polygon.setDeltaShadow(3.0); } ug.draw(polygon); - ug.apply(new UTranslate(width - cornersize, 0)).draw(new ULine(0, cornersize)); - ug.apply(new UTranslate(width, cornersize)).draw(new ULine(-cornersize, 0)); + ug.apply(UTranslate.dx(width - cornersize)).draw(ULine.vline(cornersize)); + ug.apply(new UTranslate(width, cornersize)).draw(ULine.hline(-cornersize)); } private void drawStorage(UGraphic ug, double width, double height, boolean shadowing) { - final URectangle shape = new URectangle(width, height, 70, 70); + final URectangle shape = new URectangle(width, height).rounded(70); if (shadowing) { shape.setDeltaShadow(3.0); } @@ -272,7 +272,7 @@ public enum PackageStyle { shape.setDeltaShadow(3.0); } ug.draw(shape); - ug.apply(new UTranslate(0, htitle)).draw(new ULine(wtitle + marginTitleX3, 0)); + ug.apply(UTranslate.dy(htitle)).draw(ULine.hline(wtitle + marginTitleX3)); } private void drawDatabase(UGraphic ug, double width, double height, boolean shadowing) { diff --git a/src/net/sourceforge/plantuml/svek/RoundedContainer.java b/src/net/sourceforge/plantuml/svek/RoundedContainer.java index 96f8bc908..ad948703b 100644 --- a/src/net/sourceforge/plantuml/svek/RoundedContainer.java +++ b/src/net/sourceforge/plantuml/svek/RoundedContainer.java @@ -37,7 +37,6 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -45,19 +44,20 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public final class RoundedContainer { private final Dimension2D dim; private final double titleHeight; private final double attributeHeight; - private final HtmlColor borderColor; - private final HtmlColor backColor; - private final HtmlColor imgBackcolor; + private final HColor borderColor; + private final HColor backColor; + private final HColor imgBackcolor; private final UStroke stroke; - public RoundedContainer(Dimension2D dim, double titleHeight, double attributeHeight, HtmlColor borderColor, - HtmlColor backColor, HtmlColor imgBackcolor, UStroke stroke) { + public RoundedContainer(Dimension2D dim, double titleHeight, double attributeHeight, HColor borderColor, + HColor backColor, HColor imgBackcolor, UStroke stroke) { if (dim.getWidth() == 0) { throw new IllegalArgumentException(); } @@ -73,8 +73,7 @@ public final class RoundedContainer { public void drawU(UGraphic ug, boolean shadowing) { ug = ug.apply(new UChangeBackColor(backColor)).apply(new UChangeColor(borderColor)); - final URectangle rect = new URectangle(dim.getWidth(), dim.getHeight(), IEntityImage.CORNER, - IEntityImage.CORNER); + final URectangle rect = new URectangle(dim.getWidth(), dim.getHeight()).rounded(IEntityImage.CORNER); if (shadowing) { rect.setDeltaShadow(3.0); } @@ -86,17 +85,17 @@ public final class RoundedContainer { final double thickness = stroke.getThickness(); - final URectangle inner = new URectangle(dim.getWidth() - 4 * thickness, dim.getHeight() - titleHeight - 4 - * thickness - attributeHeight, IEntityImage.CORNER, IEntityImage.CORNER); + final URectangle inner = new URectangle(dim.getWidth() - 4 * thickness, + dim.getHeight() - titleHeight - 4 * thickness - attributeHeight).rounded(IEntityImage.CORNER); ug.apply(new UChangeColor(imgBackcolor)).apply(new UTranslate(2 * thickness, yLine + 2 * thickness)) .draw(inner); if (titleHeight > 0) { - ug.apply(stroke).apply(new UTranslate(0, yLine)).draw(new ULine(dim.getWidth(), 0)); + ug.apply(stroke).apply(UTranslate.dy(yLine)).draw(ULine.hline(dim.getWidth())); } if (attributeHeight > 0) { - ug.apply(stroke).apply(new UTranslate(0, yLine - attributeHeight)).draw(new ULine(dim.getWidth(), 0)); + ug.apply(stroke).apply(UTranslate.dy(yLine - attributeHeight)).draw(ULine.hline(dim.getWidth())); } } diff --git a/src/net/sourceforge/plantuml/svek/SvekResult.java b/src/net/sourceforge/plantuml/svek/SvekResult.java index da89ae854..fe9795448 100644 --- a/src/net/sourceforge/plantuml/svek/SvekResult.java +++ b/src/net/sourceforge/plantuml/svek/SvekResult.java @@ -44,8 +44,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.Moveable; import net.sourceforge.plantuml.skin.rose.Rose; @@ -58,6 +56,8 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHidden; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public final class SvekResult extends AbstractTextBlock implements IEntityImage, Moveable { @@ -79,12 +79,12 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage, cluster.drawU(ug, new UStroke(1.5), dotData.getUmlDiagramType(), dotData.getSkinParam()); } - HtmlColor color = rose.getHtmlColor(dotData.getSkinParam(), null, getArrowColorParam()); + HColor color = rose.getHtmlColor(dotData.getSkinParam(), null, getArrowColorParam()); if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinition().getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder()); color = style.value(PName.LineColor).asColor(dotData.getSkinParam().getIHtmlColorSet()); } - color = HtmlColorUtils.noGradient(color); + color = HColorUtils.noGradient(color); for (Node node : dotStringFactory.getBibliotekon().allNodes()) { final double minX = node.getMinX(); @@ -137,7 +137,7 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage, throw new IllegalStateException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return dotData.getSkinParam().getBackgroundColor(); } diff --git a/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java b/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java index 1e01e8df2..f3e3c8c03 100644 --- a/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java +++ b/src/net/sourceforge/plantuml/svek/TextBlockBackcolored.java @@ -35,11 +35,11 @@ */ package net.sourceforge.plantuml.svek; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface TextBlockBackcolored extends TextBlock { - HtmlColor getBackcolor(); + HColor getBackcolor(); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java index 918408261..d03bcea2a 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityArrowAndCircle.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremityArrowAndCircle extends Extremity { @@ -78,7 +78,7 @@ class ExtremityArrowAndCircle extends Extremity { public void drawU(UGraphic ug) { ug.apply(new UChangeBackColor(ug.getParam().getColor())).draw(polygon); - ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new UEllipse(radius * 2, radius * 2)); + ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HColorUtils.WHITE)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new UEllipse(radius * 2, radius * 2)); } } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java index 5b6cf33ad..3868c388b 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircle.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremityCircle extends Extremity { @@ -74,7 +74,7 @@ class ExtremityCircle extends Extremity { if (fill) { ug = ug.apply(new UChangeBackColor(ug.getParam().getColor())); } else { - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)); + ug = ug.apply(new UChangeBackColor(HColorUtils.WHITE)); } ug = ug.apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)); diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java index 87bf4115c..20f94a9e1 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleConnect.java @@ -37,12 +37,12 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremityCircleConnect extends Extremity { @@ -66,7 +66,7 @@ class ExtremityCircleConnect extends Extremity { } public void drawU(UGraphic ug) { - ug = ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)); + ug = ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HColorUtils.WHITE)); ug.apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new UEllipse(radius * 2, radius * 2)); final double deg = -ortho * 180 / Math.PI + 90 - 45; diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java index 34a7cd062..7266fa220 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityCircleCross.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremityCircleCross extends Extremity { @@ -64,7 +64,7 @@ class ExtremityCircleCross extends Extremity { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)); + ug = ug.apply(new UChangeBackColor(HColorUtils.WHITE)); ug.apply(new UStroke(1.5)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new UEllipse(radius * 2, radius * 2)); drawLine(ug, 0, 0, getPointOnCircle(Math.PI / 4), getPointOnCircle(Math.PI + Math.PI / 4)); drawLine(ug, 0, 0, getPointOnCircle(-Math.PI / 4), getPointOnCircle(Math.PI - Math.PI / 4)); diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java index 031ebe360..4c608a2eb 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java @@ -37,24 +37,24 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; +import net.sourceforge.plantuml.ugraphic.color.HColor; class ExtremityDiamond extends Extremity { private UPolygon polygon = new UPolygon(); private final boolean fill; private final Point2D contact; - private final HtmlColor backgroundColor; + private final HColor backgroundColor; @Override public Point2D somePoint() { return contact; } - public ExtremityDiamond(Point2D p1, double angle, boolean fill, HtmlColor backgroundColor) { + public ExtremityDiamond(Point2D p1, double angle, boolean fill, HColor backgroundColor) { this.fill = fill; this.backgroundColor = backgroundColor; this.contact = new Point2D.Double(p1.getX(), p1.getY()); diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java index 48005cf85..6f24decb5 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtends.java @@ -37,15 +37,15 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; +import net.sourceforge.plantuml.ugraphic.color.HColor; class ExtremityExtends extends Extremity { private UPolygon polygon = new UPolygon(); - private final HtmlColor fill; + private final HColor fill; private final Point2D contact; @Override @@ -53,7 +53,7 @@ class ExtremityExtends extends Extremity { return contact; } - public ExtremityExtends(Point2D p1, double angle, HtmlColor backgroundColor) { + public ExtremityExtends(Point2D p1, double angle, HColor backgroundColor) { this.fill = backgroundColor; this.contact = new Point2D.Double(p1.getX(), p1.getY()); angle = manageround(angle); diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java index 885496963..a2c7fbaa0 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java @@ -37,22 +37,22 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.svek.AbstractExtremityFactory; import net.sourceforge.plantuml.svek.Side; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ExtremityFactoryDiamond extends AbstractExtremityFactory implements ExtremityFactory { private final boolean fill; - private final HtmlColor backgroundColor; + private final HColor backgroundColor; @Override public UDrawable createUDrawable(Point2D p0, double angle, Side side) { return new ExtremityDiamond(p0, angle - Math.PI / 2, fill, backgroundColor); } - public ExtremityFactoryDiamond(boolean fill, HtmlColor backgroundColor) { + public ExtremityFactoryDiamond(boolean fill, HColor backgroundColor) { this.fill = fill; this.backgroundColor = backgroundColor; } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java index e7318bb08..93c8b1633 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtends.java @@ -37,16 +37,16 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.svek.AbstractExtremityFactory; import net.sourceforge.plantuml.svek.Side; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ExtremityFactoryExtends extends AbstractExtremityFactory implements ExtremityFactory { - private final HtmlColor backgroundColor; + private final HColor backgroundColor; - public ExtremityFactoryExtends(HtmlColor backgroundColor) { + public ExtremityFactoryExtends(HColor backgroundColor) { this.backgroundColor = backgroundColor; } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java index 1bb187987..ce46a5d68 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityPlus.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremityPlus extends Extremity { @@ -73,7 +73,7 @@ class ExtremityPlus extends Extremity { } public void drawU(UGraphic ug) { - ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UTranslate(px + 0, py + 0)).draw(circle); + ug.apply(new UChangeBackColor(HColorUtils.WHITE)).apply(new UTranslate(px + 0, py + 0)).draw(circle); drawLine(ug, 0, 0, getPointOnCircle(angle - Math.PI / 2), getPointOnCircle(angle + Math.PI / 2)); drawLine(ug, 0, 0, getPointOnCircle(angle), getPointOnCircle(angle + Math.PI)); } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java index 6470466ea..b74f5f50c 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremitySquarre.java @@ -37,12 +37,12 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremitySquarre extends Extremity { @@ -59,7 +59,7 @@ class ExtremitySquarre extends Extremity { } public void drawU(UGraphic ug) { - ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new URectangle(radius * 2, radius * 2)); + ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HColorUtils.WHITE)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new URectangle(radius * 2, radius * 2)); } } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java index 7cdcd2577..7b05854f1 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine1.java @@ -37,7 +37,6 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -45,6 +44,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremityStateLine1 extends Extremity { @@ -76,7 +76,7 @@ class ExtremityStateLine1 extends Extremity { public void drawU(UGraphic ug) { ug.apply(new UChangeBackColor(ug.getParam().getColor())).apply(new UTranslate(-radius * Math.cos(angle), -radius * Math.sin(angle))).draw(polygon); - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)); + ug = ug.apply(new UChangeBackColor(HColorUtils.WHITE)); ug.apply(new UStroke(1.5)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new UEllipse(radius * 2, radius * 2)); drawLine(ug, getPointOnCircle(dest.getX(), dest.getY(), Math.PI / 4), getPointOnCircle(dest.getX(), dest.getY(), Math.PI + Math.PI / 4)); diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java index 80e59428a..c56cb4665 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityStateLine2.java @@ -37,13 +37,13 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class ExtremityStateLine2 extends Extremity { @@ -75,7 +75,7 @@ class ExtremityStateLine2 extends Extremity { public void drawU(UGraphic ug) { ug.apply(new UChangeBackColor(ug.getParam().getColor())).apply(new UTranslate(-radius * Math.cos(angle), -radius * Math.sin(angle))).draw(polygon); - ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new UEllipse(radius * 2, radius * 2)); + ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HColorUtils.WHITE)).apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)).draw(new UEllipse(radius * 2, radius * 2)); } } diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java index 0cf129989..ac217bd68 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircle.java @@ -37,20 +37,20 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class MiddleCircle extends Extremity { private final double radius = 6; private final UEllipse circle = new UEllipse(2 * radius, 2 * radius); - private final HtmlColor backColor; + private final HColor backColor; - public MiddleCircle(HtmlColor backColor) { + public MiddleCircle(HColor backColor) { this.backColor = backColor; } diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java index 78f87dfb7..36be21c70 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java @@ -37,18 +37,18 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class MiddleCircleCircled extends Extremity { - private final HtmlColor diagramBackColor = HtmlColorUtils.WHITE; + private final HColor diagramBackColor = HColorUtils.WHITE; private final double angle; private final MiddleCircleCircledMode mode; private final double radius1 = 6; @@ -56,9 +56,9 @@ class MiddleCircleCircled extends Extremity { private final double radius2 = 10; private final UEllipse bigcircle = new UEllipse(2 * radius2, 2 * radius2); - private final HtmlColor backColor; + private final HColor backColor; - public MiddleCircleCircled(double angle, MiddleCircleCircledMode mode, HtmlColor backColor) { + public MiddleCircleCircled(double angle, MiddleCircleCircledMode mode, HColor backColor) { this.angle = angle; this.mode = mode; this.backColor = backColor; diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java index 78663f361..ac5913ea1 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircle.java @@ -35,14 +35,14 @@ */ package net.sourceforge.plantuml.svek.extremity; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class MiddleFactoryCircle implements MiddleFactory { - private final HtmlColor backColor; + private final HColor backColor; - public MiddleFactoryCircle(HtmlColor backColor) { + public MiddleFactoryCircle(HColor backColor) { this.backColor = backColor; } diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java index e14a5f6a3..aed6ead1e 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java +++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleFactoryCircleCircled.java @@ -35,15 +35,15 @@ */ package net.sourceforge.plantuml.svek.extremity; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class MiddleFactoryCircleCircled implements MiddleFactory { private final MiddleCircleCircledMode mode; - private final HtmlColor backColor; + private final HColor backColor; - public MiddleFactoryCircleCircled(MiddleCircleCircledMode mode, HtmlColor backColor) { + public MiddleFactoryCircleCircled(MiddleCircleCircledMode mode, HColor backColor) { this.mode = mode; this.backColor = backColor; } diff --git a/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java b/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java index a49a78e5a..e3559c749 100644 --- a/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/ConnectedCircle.java @@ -39,13 +39,13 @@ import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ConnectedCircle implements UDrawable { @@ -65,7 +65,7 @@ public class ConnectedCircle implements UDrawable { final UEllipse part = new UEllipse(2 * radius, 2 * radius, angle - delta, 2 * delta); ug.draw(part); } - ug = ug.apply(new UChangeColor(HtmlColorUtils.GREEN)).apply(new UChangeBackColor(HtmlColorUtils.GREEN)); + ug = ug.apply(new UChangeColor(HColorUtils.GREEN)).apply(new UChangeBackColor(HColorUtils.GREEN)); for (Point2D pt : points) { final UTranslate tr = new UTranslate(pt); // ug.apply(tr).draw(new UEllipse(2, 2)); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java b/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java index 3fd49b074..338cad21c 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -67,6 +66,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageActivity extends AbstractEntityImage { @@ -138,7 +138,7 @@ public class EntityImageActivity extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER); + final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(CORNER); rect.setDeltaShadow(shadowing); ug = applyColors(ug); @@ -158,8 +158,8 @@ public class EntityImageActivity extends AbstractEntityImage { } private UGraphic applyColors(UGraphic ug) { - HtmlColor borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBorder); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBorder); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBackground); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java index f5b5d157a..88e523284 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java @@ -104,7 +104,7 @@ public class EntityImageArcCircle extends AbstractEntityImage { if (stereo != null) { final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2; - stereo.drawU(ug.apply(new UTranslate(stereoX, 0))); + stereo.drawU(ug.apply(UTranslate.dx(stereoX))); } } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java b/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java index f7f776bdc..3898b5c46 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageAssociationPoint.java @@ -40,7 +40,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class EntityImageAssociationPoint extends AbstractEntityImage { @@ -64,7 +64,7 @@ public class EntityImageAssociationPoint extends AbstractEntityImage { final public void drawU(UGraphic ug) { final UShape circle = new UEllipse(SIZE, SIZE); - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(circle); + ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(HColorUtils.BLACK)).draw(circle); } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java b/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java index bee424b6a..be9cbde39 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageBranch.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; @@ -56,6 +55,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageBranch extends AbstractEntityImage { @@ -82,9 +82,9 @@ public class EntityImageBranch extends AbstractEntityImage { diams.addPoint(0, SIZE); diams.addPoint(SIZE, 0); - HtmlColor border = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityDiamondBorder, + HColor border = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityDiamondBorder, ColorParam.activityBorder); - HtmlColor back = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityDiamondBackground, + HColor back = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityDiamondBackground, ColorParam.activityBackground); UStroke stroke = new UStroke(1.5); if (SkinParam.USE_STYLES()) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java index ad97af3a1..010966759 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; @@ -57,6 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageCircleEnd extends AbstractEntityImage { @@ -82,7 +82,7 @@ public class EntityImageCircleEnd extends AbstractEntityImage { if (getSkinParam().shadowing(getEntity().getStereotype())) { shadowing = 3; } - HtmlColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), param); + HColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), param); if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinitionCircle().getMergedStyle( getSkinParam().getCurrentStyleBuilder()); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java index 672f32bd7..249f6cc1d 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageCircleStart extends AbstractEntityImage { @@ -80,7 +80,7 @@ public class EntityImageCircleStart extends AbstractEntityImage { if (getSkinParam().shadowing(getEntity().getStereotype())) { shadowing = 3; } - HtmlColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), colorParam); + HColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), colorParam); if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinitionCircle().getMergedStyle( getSkinParam().getCurrentStyleBuilder()); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java index f4e2724b8..1bedbe3ee 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -72,6 +71,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageClass extends AbstractEntityImage implements Stencil, WithPorts { @@ -120,7 +120,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi return result; } final Dimension2D dimHeader = header.calculateDimension(stringBounder); - final UTranslate translate = new UTranslate(0, dimHeader.getHeight()); + final UTranslate translate = UTranslate.dy(dimHeader.getHeight()); return translate.apply(result); } @@ -143,18 +143,18 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner, getEntity() - .getCodeGetName()); + final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner) + .withComment(getEntity().getCodeGetName()); if (getSkinParam().shadowing(getEntity().getStereotype())) { rect.setDeltaShadow(4); } - HtmlColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); + HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); if (classBorder == null) { classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder); } ug = ug.apply(new UChangeColor(classBorder)); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { if (leafType == LeafType.ENUM) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.enumBackground, @@ -168,13 +168,13 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi final UStroke stroke = getStroke(); ug.apply(stroke).draw(rect); - HtmlColor headerBackcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.HEADER); + HColor headerBackcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.HEADER); if (headerBackcolor == null) { headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false); } UGraphic ugHeader = ug; if (headerBackcolor != null && roundCorner == 0) { - final Shadowable rect2 = new URectangle(widthTotal, dimHeader.getHeight(), roundCorner, roundCorner); + final Shadowable rect2 = new URectangle(widthTotal, dimHeader.getHeight()).rounded(roundCorner); ugHeader = ugHeader.apply(new UChangeBackColor(headerBackcolor)); ugHeader.apply(stroke).draw(rect2); } @@ -182,7 +182,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi if (body != null) { final UGraphic ug2 = UGraphicStencil.create(ug, this, stroke); - final UTranslate translate = new UTranslate(0, dimHeader.getHeight()); + final UTranslate translate = UTranslate.dy(dimHeader.getHeight()); body.drawU(ug2.apply(translate)); } } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java index 47d10ffdd..c6ef521ee 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.CircledCharacter; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockGeneric; @@ -64,6 +63,7 @@ import net.sourceforge.plantuml.svek.HeaderLayout; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageClassHeader2 extends AbstractEntityImage { @@ -92,8 +92,8 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { name = TextBlockUtils.withMargin(name, 3, 3, 0, 0); } else { final Rose rose = new Rose(); - final HtmlColor back = rose.getHtmlColor(skinParam, modifier.getBackground()); - final HtmlColor fore = rose.getHtmlColor(skinParam, modifier.getForeground()); + final HColor back = rose.getHtmlColor(skinParam, modifier.getBackground()); + final HColor fore = rose.getHtmlColor(skinParam, modifier.getForeground()); final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), fore, back, false); name = TextBlockUtils.mergeLR(uBlock, name, VerticalAlignment.CENTER); @@ -119,10 +119,10 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam); genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1); - final HtmlColor classBackground = SkinParamUtils + final HColor classBackground = SkinParamUtils .getColor(getSkinParam(), stereotype, ColorParam.background); - final HtmlColor classBorder = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS_STEREOTYPE, + final HColor classBorder = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype); genericBlock = new TextBlockGeneric(genericBlock, classBackground, classBorder); genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1); @@ -143,15 +143,15 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { return stereotype.getSprite(skinParam); } final UFont font = SkinParamUtils.getFont(getSkinParam(), FontParam.CIRCLED_CHARACTER, null); - final HtmlColor classBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.classBorder); - final HtmlColor fontColor = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CIRCLED_CHARACTER, null); + final HColor classBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.classBorder); + final HColor fontColor = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CIRCLED_CHARACTER, null); if (stereotype != null && stereotype.getCharacter() != 0) { return new CircledCharacter(stereotype.getCharacter(), getSkinParam().getCircledCharacterRadius(), font, stereotype.getHtmlColor(), classBorder, fontColor); } final LeafType leafType = entity.getLeafType(); - final HtmlColor spotBackColor = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBackground(leafType)); - HtmlColor spotBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBorder(leafType)); + final HColor spotBackColor = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBackground(leafType)); + HColor spotBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBorder(leafType)); if (spotBorder == null) { spotBorder = classBorder; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index 5ef80535f..18a624519 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -58,7 +58,6 @@ import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; @@ -74,6 +73,7 @@ import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class EntityImageDescription extends AbstractEntityImage { @@ -131,13 +131,13 @@ public class EntityImageDescription extends AbstractEntityImage { this.url = entity.getUrl99(); final Colors colors = entity.getColors(skinParam); - HtmlColor backcolor = colors.getColor(ColorType.BACK); + HColor backcolor = colors.getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBack()); } assert getStereo() == stereotype; - final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), stereotype, symbol.getColorParamBorder()); + final HColor forecolor = SkinParamUtils.getColor(getSkinParam(), stereotype, symbol.getColorParamBorder()); final double roundCorner = symbol.getSkinParameter().getRoundCorner(getSkinParam(), stereotype); final double diagonalCorner = symbol.getSkinParameter().getDiagonalCorner(getSkinParam(), stereotype); final UStroke stroke = colors.muteStroke(symbol.getSkinParameter().getStroke(getSkinParam(), stereotype)); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java index 5ed55557d..a31e37af5 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -64,12 +63,13 @@ import net.sourceforge.plantuml.svek.ClusterDecoration; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageEmptyPackage extends AbstractEntityImage { private final TextBlock desc; private final static int MARGIN = 10; - private final HtmlColor specificBackColor; + private final HColor specificBackColor; private final ISkinParam skinParam; private final Stereotype stereotype; private final TextBlock stereoBlock; @@ -123,7 +123,7 @@ public class EntityImageEmptyPackage extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final HtmlColor back = Cluster.getBackColor(specificBackColor, skinParam, stereotype); + final HColor back = Cluster.getBackColor(specificBackColor, skinParam, stereotype); final double roundCorner = 0; final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().getPackageStyle(), null, desc, diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java index b66943e4c..f014039c9 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -63,6 +62,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage { @@ -87,12 +87,12 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage { this.url = entity.getUrl99(); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBack()); } // backcolor = HtmlColorUtils.BLUE; - final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); + final HColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); this.ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow( getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java index 6ea5297ea..e35cf94c8 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -59,7 +59,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graph2.GeomUtils; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; @@ -82,11 +81,12 @@ import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageNote extends AbstractEntityImage implements Stencil { - private final HtmlColor noteBackgroundColor; - private final HtmlColor borderColor; + private final HColor noteBackgroundColor; + private final HColor borderColor; private final double shadowing; private final int marginX1 = 6; private final int marginX2 = 15; @@ -141,7 +141,7 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { static ISkinParam getSkin(ISkinParam skinParam, IEntity entity) { final Stereotype stereotype = entity.getStereotype(); - HtmlColor back = entity.getColors(skinParam).getColor(ColorType.BACK); + HColor back = entity.getColors(skinParam).getColor(ColorType.BACK); if (back != null) { return new SkinParamBackcolored(skinParam, back); } @@ -152,7 +152,7 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { return skinParam; } - private static HtmlColor getColorStatic(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) { + private static HColor getColorStatic(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) { final Rose rose = new Rose(); return rose.getHtmlColor(skinParam, stereo, colorParam); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java index 0d226dd5c..7181a430f 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.Area; @@ -55,6 +54,7 @@ import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.Margins; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageNoteLink extends AbstractTextBlock implements IEntityImage { @@ -81,7 +81,7 @@ public class EntityImageNoteLink extends AbstractTextBlock implements IEntityIma return ShapeType.RECTANGLE; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java index 01736a1f3..1454088f6 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java @@ -55,7 +55,6 @@ import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; @@ -74,6 +73,7 @@ import net.sourceforge.plantuml.ugraphic.ULayoutGroup; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageObject extends AbstractEntityImage implements Stencil { @@ -136,13 +136,13 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner); if (getSkinParam().shadowing(getEntity().getStereotype())) { rect.setDeltaShadow(4); } ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBackground); } @@ -162,7 +162,7 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight()); final UGraphic ug2 = UGraphicStencil.create(ug, this, stroke); - fields.drawU(ug2.apply(new UTranslate(0, dimTitle.getHeight()))); + fields.drawU(ug2.apply(UTranslate.dy(dimTitle.getHeight()))); if (url != null) { ug.closeAction(); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java index 310929aef..502e609be 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.cucadiagram.Member; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -66,6 +65,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageState extends AbstractEntityImage { @@ -127,17 +127,17 @@ public class EntityImageState extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER); + final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(CORNER); if (getSkinParam().shadowing(getEntity().getStereotype())) { rect.setDeltaShadow(4); } - HtmlColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); + HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); if (classBorder == null) { classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder); } ug = ug.apply(getStroke()).apply(new UChangeColor(classBorder)); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } @@ -146,7 +146,7 @@ public class EntityImageState extends AbstractEntityImage { ug.draw(rect); final double yLine = MARGIN + dimDesc.getHeight() + MARGIN_LINE; - ug.apply(new UTranslate(0, yLine)).draw(new ULine(widthTotal, 0)); + ug.apply(UTranslate.dy(yLine)).draw(ULine.hline(widthTotal)); ug = ug.apply(new UStroke()); @@ -183,7 +183,7 @@ public class EntityImageState extends AbstractEntityImage { final UEllipse small = new UEllipse(2 * smallRadius, 2 * smallRadius); ug.apply(new UTranslate(xSymbol, ySymbol)).draw(small); ug.apply(new UTranslate(xSymbol + smallLine + 2 * smallRadius, ySymbol)).draw(small); - ug.apply(new UTranslate(xSymbol + 2 * smallRadius, ySymbol + smallLine)).draw(new ULine(smallLine, 0)); + ug.apply(new UTranslate(xSymbol + 2 * smallRadius, ySymbol + smallLine)).draw(ULine.hline(smallLine)); } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java index 9d41ddc47..7da11dcc6 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Member; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -58,6 +57,7 @@ import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageState2 extends AbstractEntityImage { @@ -79,12 +79,12 @@ public class EntityImageState2 extends AbstractEntityImage { final USymbol symbol = USymbol.FRAME; - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBack()); } // backcolor = HtmlColorUtils.BLUE; - final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); + final HColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow( getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java index e9b8fd36c..07d9a0ced 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -62,6 +61,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageStateBorder extends AbstractEntityImage { @@ -116,7 +116,7 @@ public class EntityImageStateBorder extends AbstractEntityImage { ug = ug.apply(new UStroke(1.5)).apply( new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java index 639c46ba9..6fd453b82 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.Member; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -63,6 +62,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageStateEmptyDescription extends AbstractEntityImage { @@ -104,14 +104,14 @@ public class EntityImageStateEmptyDescription extends AbstractEntityImage { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER); + final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(CORNER); if (getSkinParam().shadowing(getEntity().getStereotype())) { rect.setDeltaShadow(4); } - ug = ug.apply(new UStroke(1.5)).apply( - new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + ug = ug.apply(new UStroke(1.5)) + .apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder))); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java b/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java index bbca8cea6..ce379acea 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Rankdir; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; @@ -57,6 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageSynchroBar extends AbstractEntityImage { @@ -82,7 +82,7 @@ public class EntityImageSynchroBar extends AbstractEntityImage { if (getSkinParam().shadowing(getEntity().getStereotype())) { shadowing = 4; } - HtmlColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBar); + HColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBar); if (SkinParam.USE_STYLES()) { final Style style = getDefaultStyleDefinitionBar().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java index 60d17a2fc..79a8efa79 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -65,14 +64,15 @@ import net.sourceforge.plantuml.svek.Node; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageTips extends AbstractEntityImage { final private Rose rose = new Rose(); private final ISkinParam skinParam; - private final HtmlColor noteBackgroundColor; - private final HtmlColor borderColor; + private final HColor noteBackgroundColor; + private final HColor borderColor; private final Bibliotekon bibliotekon; @@ -151,7 +151,7 @@ public class EntityImageTips extends AbstractEntityImage { final Point2D pp2 = new Point2D.Double(x, y); opale.setOpale(direction, pp1, pp2); opale.drawU(ug); - ug = ug.apply(new UTranslate(0, dim.getHeight() + ySpacing)); + ug = ug.apply(UTranslate.dy(dim.getHeight() + ySpacing)); height += dim.getHeight(); height += ySpacing; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java index f62b3dd84..c5f77e579 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java @@ -53,7 +53,6 @@ import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -70,6 +69,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageUseCase extends AbstractEntityImage { @@ -127,12 +127,12 @@ public class EntityImageUseCase extends AbstractEntityImage { } ug = ug.apply(getStroke()); - HtmlColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); + HColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); if (linecolor == null) { linecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBorder); } ug = ug.apply(new UChangeColor(linecolor)); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.usecaseBackground); } diff --git a/src/net/sourceforge/plantuml/svek/image/Footprint.java b/src/net/sourceforge/plantuml/svek/image/Footprint.java index cb2156f62..bdc0762bf 100644 --- a/src/net/sourceforge/plantuml/svek/image/Footprint.java +++ b/src/net/sourceforge/plantuml/svek/image/Footprint.java @@ -43,8 +43,6 @@ import java.util.List; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -58,6 +56,8 @@ import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class Footprint { diff --git a/src/net/sourceforge/plantuml/svek/image/Opale.java b/src/net/sourceforge/plantuml/svek/image/Opale.java index 17ee60199..af9d81be1 100644 --- a/src/net/sourceforge/plantuml/svek/image/Opale.java +++ b/src/net/sourceforge/plantuml/svek/image/Opale.java @@ -41,7 +41,6 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -49,13 +48,14 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class Opale extends AbstractTextBlock implements TextBlock { private static final int cornersize = 10; - private final HtmlColor noteBackgroundColor; - private final HtmlColor borderColor; + private final HColor noteBackgroundColor; + private final HColor borderColor; private final int marginX1 = 6; private final int marginX2 = 15; private final int marginY = 5; @@ -68,7 +68,7 @@ public class Opale extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; - public Opale(double shadowing, HtmlColor borderColor, HtmlColor noteBackgroundColor, TextBlock textBlock, + public Opale(double shadowing, HColor borderColor, HColor noteBackgroundColor, TextBlock textBlock, boolean withLink) { this.noteBackgroundColor = noteBackgroundColor; this.withLink = withLink; diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java index 3ff140f66..04fe14999 100644 --- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java +++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java @@ -63,12 +63,12 @@ import net.sourceforge.plantuml.SignatureUtils; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.SvgString; import net.sourceforge.plantuml.code.Base64Coder; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.USegment; import net.sourceforge.plantuml.ugraphic.USegmentType; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; @@ -174,7 +174,7 @@ public class SvgGraphics { private Element pendingBackground; - public void paintBackcolorGradient(ColorMapper mapper, HtmlColorGradient gr) { + public void paintBackcolorGradient(ColorMapper mapper, HColorGradient gr) { final String id = createSvgGradient(StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor1())), StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor2())), gr.getPolicy()); setFillColor("url(#" + id + ")"); @@ -543,7 +543,7 @@ public class SvgGraphics { // .forName("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); // xformFactory = (TransformerFactory) factoryClass.newInstance(); // } catch (Exception e) { - xformFactory = TransformerFactory.newInstance(); + xformFactory = TransformerFactory.newInstance(); // } Log.info("TransformerFactory=" + xformFactory.getClass()); @@ -569,8 +569,8 @@ public class SvgGraphics { createXmlInternal(baos); String s = new String(baos.toByteArray()); for (Map.Entry ent : images.entrySet()) { - final String k = "\\<" + ent.getKey() + "/\\>"; - s = s.replaceAll(k, ent.getValue()); + final String k = "<" + ent.getKey() + "/>"; + s = s.replace(k, ent.getValue()); } os.write(s.getBytes()); } @@ -750,7 +750,7 @@ public class SvgGraphics { String svg = manageScale(image); final String pos = ""; svg = pos + svg.substring(5); - final String key = "imagesvginlined" + images.size(); + final String key = "imagesvginlined" + image.getMD5Hex() + images.size(); final Element elt = (Element) document.createElement(key); getG().appendChild(elt); images.put(key, svg); @@ -793,8 +793,8 @@ public class SvgGraphics { addFilter(filter, "feGaussianBlur", "result", "blurOut", "stdDeviation", "" + (2 * scale)); addFilter(filter, "feColorMatrix", "type", "matrix", "in", "blurOut", "result", "blurOut2", "values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"); - addFilter(filter, "feOffset", "result", "blurOut3", "in", "blurOut2", "dx", "" + (4 * scale), "dy", "" - + (4 * scale)); + addFilter(filter, "feOffset", "result", "blurOut3", "in", "blurOut2", "dx", "" + (4 * scale), "dy", + "" + (4 * scale)); addFilter(filter, "feBlend", "in", "SourceGraphic", "in2", "blurOut3", "mode", "normal"); defs.appendChild(filter); diff --git a/src/net/sourceforge/plantuml/swing/ImageWindow2.java b/src/net/sourceforge/plantuml/swing/ImageWindow2.java index 3b92fa63b..421f034a8 100644 --- a/src/net/sourceforge/plantuml/swing/ImageWindow2.java +++ b/src/net/sourceforge/plantuml/swing/ImageWindow2.java @@ -75,8 +75,8 @@ import net.sourceforge.plantuml.GeneratedImage; import net.sourceforge.plantuml.ImageSelection; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.version.PSystemVersion; class ImageWindow2 extends JFrame { diff --git a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java index 00e6785ac..e88840050 100644 --- a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java +++ b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java @@ -42,7 +42,7 @@ import java.util.Set; import java.util.TreeSet; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.utils.Cypher; public class LanguageDescriptor { @@ -158,6 +158,8 @@ public class LanguageDescriptor { keyword.add("allowmixing"); keyword.add("mainframe"); keyword.add("accross"); + keyword.add("stereotype"); + keyword.add("split"); preproc.add("!exit"); preproc.add("!include"); @@ -187,7 +189,7 @@ public class LanguageDescriptor { for (String s : SkinParam.getPossibleValues()) { cypher.addException(s); } - for (String s : new HtmlColorSetSimple().names()) { + for (String s : HColorSet.instance().names()) { cypher.addException(s); } cypher.addException("o"); @@ -199,7 +201,7 @@ public class LanguageDescriptor { print(ps, "keyword", keyword); print(ps, "preprocessor", preproc); print(ps, "skinparameter", SkinParam.getPossibleValues()); - print(ps, "color", new HtmlColorSetSimple().names()); + print(ps, "color", HColorSet.instance().names()); ps.println(";EOF"); } diff --git a/src/net/sourceforge/plantuml/tim/TContext.java b/src/net/sourceforge/plantuml/tim/TContext.java index d1a25e86e..29ed3c0af 100644 --- a/src/net/sourceforge/plantuml/tim/TContext.java +++ b/src/net/sourceforge/plantuml/tim/TContext.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.io.Reader; import java.net.URL; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -116,6 +117,10 @@ public class TContext { // private final Set usedFiles = new HashSet(); private final Set filesUsedCurrent = new HashSet(); + public Set getFilesUsedCurrent() { + return Collections.unmodifiableSet(filesUsedCurrent); + } + private void addStandardFunctions(Defines defines) { functionsSet.addFunction(new Strlen()); functionsSet.addFunction(new Substr()); diff --git a/src/net/sourceforge/plantuml/tim/TimLoader.java b/src/net/sourceforge/plantuml/tim/TimLoader.java index 64d3f0017..d0851f6c4 100644 --- a/src/net/sourceforge/plantuml/tim/TimLoader.java +++ b/src/net/sourceforge/plantuml/tim/TimLoader.java @@ -35,10 +35,12 @@ package net.sourceforge.plantuml.tim; import java.util.List; +import java.util.Set; import net.sourceforge.plantuml.DefinitionsContainer; import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.ImportedFiles; public class TimLoader { @@ -58,7 +60,7 @@ public class TimLoader { } } - public void load(List list) { + public Set load(List list) { // CodeIteratorImpl.indentNow(list); try { context.executeLines(global, list, null); @@ -68,6 +70,7 @@ public class TimLoader { this.preprocessorError = true; } this.resultList = context.getResultList(); + return context.getFilesUsedCurrent(); } private void changeLastLine(List list, String message) { diff --git a/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java b/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java index 05d026e39..bb3f21514 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java +++ b/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java @@ -35,12 +35,12 @@ */ package net.sourceforge.plantuml.timingdiagram; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ChangeState implements Comparable { @@ -79,16 +79,16 @@ public class ChangeState implements Comparable { return comment; } - public final HtmlColor getBackColor() { + public final HColor getBackColor() { if (colors == null || colors.getColor(ColorType.BACK) == null) { - return HtmlColorUtils.COL_D7E0F2; + return HColorUtils.COL_D7E0F2; } return colors.getColor(ColorType.BACK); } - private final HtmlColor getLineColor() { + private final HColor getLineColor() { if (colors == null || colors.getColor(ColorType.LINE) == null) { - return HtmlColorUtils.COL_038048; + return HColorUtils.COL_038048; } return colors.getColor(ColorType.LINE); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/Highlight.java b/src/net/sourceforge/plantuml/timingdiagram/Highlight.java index 75f4cc1db..aa7776852 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Highlight.java +++ b/src/net/sourceforge/plantuml/timingdiagram/Highlight.java @@ -39,8 +39,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -51,6 +49,8 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Highlight { @@ -66,18 +66,18 @@ public class Highlight { this.colors = colors; } - private HtmlColor getBackColor() { - final HtmlColor result = colors.getColor(ColorType.BACK); + private HColor getBackColor() { + final HColor result = colors.getColor(ColorType.BACK); if (result == null) { - return HtmlColorUtils.COL_A9DCDF; + return HColorUtils.COL_A9DCDF; } return result; } - private HtmlColor getLineColor() { - final HtmlColor result = colors.getColor(ColorType.LINE); + private HColor getLineColor() { + final HColor result = colors.getColor(ColorType.LINE); if (result == null) { - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } return result; } @@ -104,17 +104,17 @@ public class Highlight { final double start = ruler.getPosInPixel(this.getTickFrom()); final double end = ruler.getPosInPixel(this.getTickTo()); final URectangle rect = new URectangle(end - start, height); - ug.apply(new UTranslate(start, 0)).draw(rect); + ug.apply(UTranslate.dx(start)).draw(rect); } public void drawHighlightsLines(UGraphic ug, TimingRuler ruler, double height) { ug = ug.apply(new UStroke(4, 4, 2)); ug = ug.apply(new UChangeColor(getLineColor())); - final ULine line = new ULine(0, height); + final ULine line = ULine.vline(height); final double start = ruler.getPosInPixel(this.getTickFrom()); final double end = ruler.getPosInPixel(this.getTickTo()); - ug.apply(new UTranslate(start, 0)).draw(line); - ug.apply(new UTranslate(end, 0)).draw(line); + ug.apply(UTranslate.dx(start)).draw(line); + ug.apply(UTranslate.dx(end)).draw(line); } } diff --git a/src/net/sourceforge/plantuml/timingdiagram/Player.java b/src/net/sourceforge/plantuml/timingdiagram/Player.java index ce739e67f..6a8e4e164 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Player.java +++ b/src/net/sourceforge/plantuml/timingdiagram/Player.java @@ -34,32 +34,53 @@ */ package net.sourceforge.plantuml.timingdiagram; +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrame; import net.sourceforge.plantuml.ugraphic.UGraphic; -public interface Player extends TimeProjected { +public abstract class Player implements TimeProjected { - public void addNote(TimeTick now, Display note, Position position); + protected final ISkinParam skinParam; + protected final TimingRuler ruler; + private final Display title; - public void defineState(String stateCode, String label); + public Player(String title, ISkinParam skinParam, TimingRuler ruler) { + this.skinParam = skinParam; + this.ruler = ruler; + this.title = Display.getWithNewlines(title); + } - public void setState(TimeTick now, String comment, Colors color, String... states); + final protected FontConfiguration getFontConfiguration() { + return new FontConfiguration(skinParam, FontParam.TIMING, null); + } - public void createConstraint(TimeTick tick1, TimeTick tick2, String message); + final protected TextBlock getTitle() { + return title.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); + } - public PlayerFrame getPlayerFrame(); + public abstract void addNote(TimeTick now, Display note, Position position); - public void drawContent(UGraphic ug); + public abstract void defineState(String stateCode, String label); - public void drawLeftHeader(UGraphic ug); + public abstract void setState(TimeTick now, String comment, Colors color, String... states); - public double getWidthHeader(StringBounder stringBounder); + public abstract void createConstraint(TimeTick tick1, TimeTick tick2, String message); - public double getHeight(StringBounder stringBounder); + public abstract PlayerFrame getPlayerFrame(); - public double getFirstColumnWidth(StringBounder stringBounder); + public abstract TextBlock getPart1(); + + public abstract UDrawable getPart2(); + + public abstract double getFullHeight(StringBounder stringBounder); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java index eed664c7a..71db567d8 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java @@ -39,34 +39,40 @@ import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; +import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrame; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrameEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; -public class PlayerBinary extends ReallyAbstractPlayer implements Player { +public class PlayerBinary extends Player { private static final int HEIGHT = 30; private final SortedMap values = new TreeMap(); - public PlayerBinary(TitleStrategy titleStrategy, String code, ISkinParam skinParam, TimingRuler ruler) { - super(titleStrategy, code, skinParam, ruler); + public PlayerBinary(String code, ISkinParam skinParam, TimingRuler ruler) { + super(code, skinParam, ruler); } - public double getHeight(StringBounder stringBounder) { + public double getFullHeight(StringBounder stringBounder) { return HEIGHT; } private SymbolContext getContext() { - return new SymbolContext(HtmlColorUtils.COL_D7E0F2, HtmlColorUtils.COL_038048).withStroke(new UStroke(1.5)); + return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); } public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { @@ -97,42 +103,49 @@ public class PlayerBinary extends ReallyAbstractPlayer implements Player { private final double ymargin = 8; public PlayerFrame getPlayerFrame() { - return new PlayerFrame() { - public void drawFrameTitle(UGraphic ug) { - } - }; + return new PlayerFrameEmpty(); } private double getYpos(boolean state) { return state ? ymargin : HEIGHT - ymargin; } - public void drawContent(UGraphic ug) { - ug = getContext().apply(ug); - double lastx = 0; - boolean lastValue = false; - for (Map.Entry ent : values.entrySet()) { - final double x = ruler.getPosInPixel(ent.getKey()); - ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(new ULine(x - lastx, 0)); - if (lastValue != ent.getValue()) { - ug.apply(new UTranslate(x, ymargin)).draw(new ULine(0, HEIGHT - 2 * ymargin)); + public TextBlock getPart1() { + return new AbstractTextBlock() { + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + final TextBlock title = getTitle(); + final Dimension2D dim = title.calculateDimension(stringBounder); + final double y = (getFullHeight(stringBounder) - dim.getHeight()) / 2; + title.drawU(ug.apply(UTranslate.dy(y))); } - lastx = x; - lastValue = ent.getValue(); - } - ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(new ULine(ruler.getWidth() - lastx, 0)); + + public Dimension2D calculateDimension(StringBounder stringBounder) { + final Dimension2D dim = getTitle().calculateDimension(stringBounder); + return Dimension2DDouble.delta(dim, 5, 0); + } + }; } - public void drawLeftHeader(UGraphic ug) { - final StringBounder stringBounder = ug.getStringBounder(); - final TextBlock title = getTitle(); - final Dimension2D dim = title.calculateDimension(stringBounder); - final double y = (getHeight(stringBounder) - dim.getHeight()) / 2; - title.drawU(ug.apply(new UTranslate(0, y))); - } - - public double getWidthHeader(StringBounder stringBounder) { - return getTitle().calculateDimension(stringBounder).getWidth() + 5; + public UDrawable getPart2() { + return new UDrawable() { + public void drawU(UGraphic ug) { + ug = getContext().apply(ug); + double lastx = 0; + boolean lastValue = false; + for (Map.Entry ent : values.entrySet()) { + final double x = ruler.getPosInPixel(ent.getKey()); + ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(ULine.hline(x - lastx)); + if (lastValue != ent.getValue()) { + ug.apply(new UTranslate(x, ymargin)).draw(ULine.vline(HEIGHT - 2 * ymargin)); + } + lastx = x; + lastValue = ent.getValue(); + } + ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(ULine.hline(ruler.getWidth() - lastx)); + } + }; } } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java index dce4824f8..124e59cbd 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java @@ -39,32 +39,38 @@ import java.math.BigDecimal; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrame; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrameEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; -public class PlayerClock extends ReallyAbstractPlayer implements Player { +public class PlayerClock extends Player { private final int period; private final int pulse; - public PlayerClock(TitleStrategy titleStrategy, ISkinParam skinParam, TimingRuler ruler, int period, int pulse) { - super(titleStrategy, "", skinParam, ruler); + public PlayerClock(ISkinParam skinParam, TimingRuler ruler, int period, int pulse) { + super("", skinParam, ruler); this.period = period; this.pulse = pulse; } - public double getHeight(StringBounder striWngBounder) { + public double getFullHeight(StringBounder striWngBounder) { return 30; } private SymbolContext getContext() { - return new SymbolContext(HtmlColorUtils.COL_D7E0F2, HtmlColorUtils.COL_038048).withStroke(new UStroke(1.5)); + return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); } public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { @@ -90,35 +96,7 @@ public class PlayerClock extends ReallyAbstractPlayer implements Player { private final double ymargin = 8; public PlayerFrame getPlayerFrame() { - return new PlayerFrame() { - public void drawFrameTitle(UGraphic ug) { - } - }; - } - - public void drawContent(UGraphic ug) { - ug = getContext().apply(ug); - final ULine vline = new ULine(0, getHeight(ug.getStringBounder()) - 2 * ymargin); - int i = 0; - double lastx = -Double.MAX_VALUE; - while (i < 1000) { - final double x = ruler.getPosInPixel(new TimeTick(new BigDecimal(i * period), TimingFormat.DECIMAL)); - if (x > ruler.getWidth()) { - return; - } - i++; - if (x > lastx) { - final double dx = x - lastx; - final ULine hline1 = new ULine(dx * getPulseCoef(), 0); - final ULine hline2 = new ULine(dx * (1 - getPulseCoef()), 0); - ug.apply(new UTranslate(lastx, ymargin)).draw(vline); - ug.apply(new UTranslate(lastx, ymargin)).draw(hline1); - final double x2 = lastx + dx * getPulseCoef(); - ug.apply(new UTranslate(x2, ymargin)).draw(vline); - ug.apply(new UTranslate(x2, ymargin + vline.getDY())).draw(hline2); - } - lastx = x; - } + return new PlayerFrameEmpty(); } private double getPulseCoef() { @@ -128,16 +106,42 @@ public class PlayerClock extends ReallyAbstractPlayer implements Player { return 1.0 * pulse / period; } - public void drawLeftHeader(UGraphic ug) { - - } - - public double getWidthHeader(StringBounder stringBounder) { - return 0; - } - public final int getPeriod() { return period; } + public TextBlock getPart1() { + return TextBlockUtils.empty(0, 0); + } + + public UDrawable getPart2() { + return new UDrawable() { + public void drawU(UGraphic ug) { + ug = getContext().apply(ug); + final ULine vline = ULine.vline(getFullHeight(ug.getStringBounder()) - 2 * ymargin); + int i = 0; + double lastx = -Double.MAX_VALUE; + while (i < 1000) { + final double x = ruler + .getPosInPixel(new TimeTick(new BigDecimal(i * period), TimingFormat.DECIMAL)); + if (x > ruler.getWidth()) { + return; + } + i++; + if (x > lastx) { + final double dx = x - lastx; + final ULine hline1 = ULine.hline(dx * getPulseCoef()); + final ULine hline2 = ULine.hline(dx * (1 - getPulseCoef())); + ug.apply(new UTranslate(lastx, ymargin)).draw(vline); + ug.apply(new UTranslate(lastx, ymargin)).draw(hline1); + final double x2 = lastx + dx * getPulseCoef(); + ug.apply(new UTranslate(x2, ymargin)).draw(vline); + ug.apply(new UTranslate(x2, ymargin + vline.getDY())).draw(hline2); + } + lastx = x; + } + } + }; + } + } diff --git a/src/net/sourceforge/plantuml/timingdiagram/AbstractPlayer.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java similarity index 53% rename from src/net/sourceforge/plantuml/timingdiagram/AbstractPlayer.java rename to src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java index cd272d0e6..65f56ce4b 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/AbstractPlayer.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java @@ -45,78 +45,95 @@ import java.util.TreeSet; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.graphic.Histogram; +import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerDrawing; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrame; +import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrame2; +import net.sourceforge.plantuml.timingdiagram.graphic.Ribbon; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public abstract class AbstractPlayer extends ReallyAbstractPlayer implements Player { - - private String initialState; +public final class PlayerRobustConcise extends Player { private final Set changes = new TreeSet(); private final List constraints = new ArrayList(); - protected final List notes = new ArrayList(); - protected final Map statesLabel = new LinkedHashMap(); + private final List notes = new ArrayList(); + private final Map statesLabel = new LinkedHashMap(); + private final TimingStyle type; - public AbstractPlayer(TitleStrategy titleStrategy, String full, ISkinParam skinParam, TimingRuler ruler) { - super(titleStrategy, full, skinParam, ruler); + private String initialState; + private PlayerDrawing cached; + private Colors initialColors; + + public PlayerRobustConcise(TimingStyle type, String full, ISkinParam skinParam, TimingRuler ruler) { + super(full, skinParam, ruler); + this.type = type; } - protected abstract TimeDrawing buildDrawing(); - - public PlayerFrame getPlayerFrame() { - return new PlayerFrame2(titleStrategy, getTitle()); - } - - public void drawContent(UGraphic ug) { - ug = ug.apply(getTranslateForTimeDrawing(ug.getStringBounder())); - getTimeDrawing().drawU(ug); - } - - public void drawLeftHeader(UGraphic ug) { - if (titleStrategy == TitleStrategy.IN_LEFT_HEADER) { - final StringBounder stringBounder = ug.getStringBounder(); - final TextBlock title = getTitle(); - final Dimension2D dim = title.calculateDimension(stringBounder); - final double y = (getHeight(stringBounder) - dim.getHeight()) / 2; - title.drawU(ug.apply(new UTranslate(0, y))); - ug = ug.apply(new UTranslate(dim.getWidth() + 5, 0)); + private PlayerDrawing buildPlayerDrawing() { + if (type == TimingStyle.CONCISE) { + return new Ribbon(ruler, skinParam, notes); } - ug = ug.apply(getTranslateForTimeDrawing(ug.getStringBounder())); - getTimeDrawing().getWidthHeader(ug.getStringBounder()).drawU(ug); + if (type == TimingStyle.ROBUST) { + return new Histogram(ruler, skinParam, statesLabel.values()); + } + throw new IllegalStateException(); } - public double getWidthHeader(StringBounder stringBounder) { - final Dimension2D dimHeader1 = getTimeDrawing().getWidthHeader(stringBounder).calculateDimension(stringBounder); - if (titleStrategy == TitleStrategy.IN_LEFT_HEADER) { - final Dimension2D dimTitle = getTitle().calculateDimension(stringBounder); - return dimTitle.getWidth() + 5 + dimHeader1.getWidth(); - } - return dimHeader1.getWidth(); + public final PlayerFrame getPlayerFrame() { + return new PlayerFrame2(getTitle()); + } + + public final TextBlock getPart1() { + return new AbstractTextBlock() { + + public void drawU(UGraphic ug) { + ug = ug.apply(getTranslateForTimeDrawing(ug.getStringBounder())); + getTimeDrawing().getPart1().drawU(ug); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return getTimeDrawing().getPart1().calculateDimension(stringBounder); + } + }; + } + + public UDrawable getPart2() { + return new UDrawable() { + public void drawU(UGraphic ug) { + ug = ug.apply(getTranslateForTimeDrawing(ug.getStringBounder())); + getTimeDrawing().getPart2().drawU(ug); + } + }; } private UTranslate getTranslateForTimeDrawing(StringBounder stringBounder) { - if (titleStrategy == TitleStrategy.IN_FRAME) { - final TextBlock title = getTitle(); - return new UTranslate(0, title.calculateDimension(stringBounder).getHeight() * 2); - } - return new UTranslate(0, 12); + return UTranslate.dy(getTitleHeight(stringBounder)); } - private TimeDrawing cached; - private Colors initialColors; + public final double getFullHeight(StringBounder stringBounder) { + return getTitleHeight(stringBounder) + getZoneHeight(stringBounder); + } - private TimeDrawing getTimeDrawing() { + private double getTitleHeight(StringBounder stringBounder) { + return getTitle().calculateDimension(stringBounder).getHeight() + 6; + } + + private PlayerDrawing getTimeDrawing() { if (cached == null) { cached = computeTimeDrawing(); } return cached; } - private TimeDrawing computeTimeDrawing() { - final TimeDrawing result = buildDrawing(); + private PlayerDrawing computeTimeDrawing() { + final PlayerDrawing result = buildPlayerDrawing(); result.setInitialState(initialState, initialColors); for (ChangeState change : changes) { result.addChange(change); @@ -127,20 +144,11 @@ public abstract class AbstractPlayer extends ReallyAbstractPlayer implements Pla return result; } - public double getHeight(StringBounder stringBounder) { - final double zoneHeight = getZoneHeight(stringBounder); - if (titleStrategy == TitleStrategy.IN_LEFT_HEADER) { - return zoneHeight; - } - final TextBlock title = getTitle(); - return title.calculateDimension(stringBounder).getHeight() * 2 + zoneHeight; - } - private double getZoneHeight(StringBounder stringBounder) { - return getTimeDrawing().getHeight(stringBounder); + return getTimeDrawing().getFullHeight(stringBounder); } - public void setState(TimeTick now, String comment, Colors color, String... states) { + public final void setState(TimeTick now, String comment, Colors color, String... states) { for (int i = 0; i < states.length; i++) { states[i] = decodeState(states[i]); } @@ -161,7 +169,7 @@ public abstract class AbstractPlayer extends ReallyAbstractPlayer implements Pla return label; } - public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { + public final IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { final IntricatedPoint point = getTimeDrawing().getTimeProjection(stringBounder, tick); if (point == null) { return null; @@ -170,15 +178,15 @@ public abstract class AbstractPlayer extends ReallyAbstractPlayer implements Pla return point.translated(translation); } - public void createConstraint(TimeTick tick1, TimeTick tick2, String message) { - this.constraints.add(new TimeConstraint(tick1, tick2, message)); + public final void createConstraint(TimeTick tick1, TimeTick tick2, String message) { + this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam)); } - public void addNote(TimeTick now, Display note, Position position) { + public final void addNote(TimeTick now, Display note, Position position) { this.notes.add(new TimingNote(now, this, note, position, skinParam)); } - public void defineState(String stateCode, String label) { + public final void defineState(String stateCode, String label) { statesLabel.put(stateCode, label); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/ReallyAbstractPlayer.java b/src/net/sourceforge/plantuml/timingdiagram/ReallyAbstractPlayer.java deleted file mode 100644 index 63ae5fab5..000000000 --- a/src/net/sourceforge/plantuml/timingdiagram/ReallyAbstractPlayer.java +++ /dev/null @@ -1,80 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2020, Arnaud Roques - * - * Project Info: http://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * http://plantuml.com/patreon (only 1$ per month!) - * http://plantuml.com/paypal - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * - * Original Author: Arnaud Roques - * - */ -package net.sourceforge.plantuml.timingdiagram; - -import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; - -public abstract class ReallyAbstractPlayer implements Player { - - protected final ISkinParam skinParam; - protected final TimingRuler ruler; - protected final TitleStrategy titleStrategy; - private final Display title; - - public ReallyAbstractPlayer(TitleStrategy titleStrategy, String title, ISkinParam skinParam, TimingRuler ruler) { - this.skinParam = skinParam; - this.ruler = ruler; - this.titleStrategy = titleStrategy; - this.title = Display.getWithNewlines(title); - } - - public double getFirstColumnWidth(StringBounder stringBounder) { - return 40; - } - - - - final protected FontConfiguration getFontConfiguration() { - return new FontConfiguration(skinParam, FontParam.TIMING, null); - } - - final protected TextBlock getTitle() { - return title.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); - } - -// private TextBlock createTextBlock(String value) { -// final Display display = Display.getWithNewlines(value); -// return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); -// } - - - -} diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java index b64ff6daf..90a2812c0 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java @@ -36,13 +36,15 @@ package net.sourceforge.plantuml.timingdiagram; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; +import java.util.List; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.timingdiagram.graphic.TimeArrow; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; @@ -50,17 +52,20 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimeConstraint { private final TimeTick tick1; private final TimeTick tick2; private final Display label; + private final ISkinParam skinParam; - public TimeConstraint(TimeTick tick1, TimeTick tick2, String label) { + public TimeConstraint(TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam) { this.tick1 = tick1; this.tick2 = tick2; this.label = Display.getWithNewlines(label); + this.skinParam = skinParam; } public final TimeTick getTick1() { @@ -75,33 +80,40 @@ public class TimeConstraint { return label; } - private TextBlock getTextBlock(Display display, ISkinParam skinParam) { + private TextBlock getTextBlock(Display display) { return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); } private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(14); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLUE, false); } - public void drawU(UGraphic ug, TimingRuler ruler, ISkinParam skinParam) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.RED)).apply(new UChangeBackColor(HtmlColorUtils.RED)); + public void drawU(UGraphic ug, TimingRuler ruler) { + ug = ug.apply(new UChangeColor(HColorUtils.RED)).apply(new UChangeBackColor(HColorUtils.RED)); final double x1 = ruler.getPosInPixel(tick1); final double x2 = ruler.getPosInPixel(tick2); - final ULine line = new ULine(x2 - x1, 0); - - ug = ug.apply(new UTranslate(x1, 0)); - ug.draw(line); + ug = ug.apply(UTranslate.dx(x1)); + ug.draw(ULine.hline(x2 - x1)); ug.draw(getPolygon(-Math.PI / 2, new Point2D.Double(0, 0))); ug.draw(getPolygon(Math.PI / 2, new Point2D.Double(x2 - x1, 0))); - final TextBlock text = getTextBlock(label, skinParam); + final TextBlock text = getTextBlock(label); final Dimension2D dimText = text.calculateDimension(ug.getStringBounder()); final double x = (x2 - x1 - dimText.getWidth()) / 2; - final UTranslate tr = new UTranslate(x, -5 - dimText.getHeight()); - text.drawU(ug.apply(tr)); + text.drawU(ug.apply(new UTranslate(x, -getConstraintHeight(ug.getStringBounder())))); + } + public double getConstraintHeight(StringBounder stringBounder) { + final TextBlock text = getTextBlock(label); + final Dimension2D dimText = text.calculateDimension(stringBounder); + return dimText.getHeight() + getTopMargin(); + + } + + public static double getTopMargin() { + return 5; } private UPolygon getPolygon(final double angle, final Point2D end) { @@ -117,4 +129,16 @@ public class TimeConstraint { return polygon; } + public static double getHeightForConstraints(StringBounder stringBounder, List constraints) { + if (constraints.size() == 0) { + return 0; + } + double result = 0; + for (TimeConstraint constraint : constraints) { + result = Math.max(result, constraint.getConstraintHeight(stringBounder)); + + } + return result; + } + } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java b/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java index 63bb3b9b2..7753ff9c7 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java @@ -38,7 +38,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.WithLinkType; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimeMessage extends WithLinkType { @@ -50,7 +50,7 @@ public class TimeMessage extends WithLinkType { this.tickInPlayer1 = tickInPlayer1; this.tickInPlayer2 = tickInPlayer2; this.label = Display.getWithNewlines(label); - this.setSpecificColor(HtmlColorUtils.BLUE); + this.setSpecificColor(HColorUtils.BLUE); this.type = new LinkType(LinkDecor.NONE, LinkDecor.NONE); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeProjected.java b/src/net/sourceforge/plantuml/timingdiagram/TimeProjected.java index 05470455c..72829a4e7 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeProjected.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeProjected.java @@ -35,6 +35,7 @@ package net.sourceforge.plantuml.timingdiagram; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; public interface TimeProjected { diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java index 7fc7d65da..ff87f2d8a 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java @@ -55,33 +55,28 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.svek.TextBlockBackcolored; +import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; +import net.sourceforge.plantuml.timingdiagram.graphic.TimeArrow; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; -import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimingDiagram extends UmlDiagram implements Clocks { public static final double marginX1 = 5; private final double marginX2 = 5; - private TitleStrategy getTitleStrategy() { - // return TitleStrategy.IN_LEFT_HEADER; - return TitleStrategy.IN_FRAME; - } - private final Map players = new LinkedHashMap(); private final Map clocks = new HashMap(); private final List messages = new ArrayList(); @@ -129,7 +124,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks { } public Dimension2D calculateDimension(StringBounder stringBounder) { - final double withBeforeRuler = getWidthBeforeRuler(stringBounder); + final double withBeforeRuler = getPart1MaxWidth(stringBounder); final double totalWith = withBeforeRuler + ruler.getWidth() + marginX1 + marginX2; return new Dimension2DDouble(totalWith, getHeightTotal(stringBounder)); } @@ -138,7 +133,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks { throw new UnsupportedOperationException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } }; @@ -147,10 +142,10 @@ public class TimingDiagram extends UmlDiagram implements Clocks { private void drawInternal(UGraphic ug) { ruler.ensureNotEmpty(); final StringBounder stringBounder = ug.getStringBounder(); - final UTranslate beforeRuler = new UTranslate(getWidthBeforeRuler(stringBounder), 0); + final UTranslate beforeRuler = UTranslate.dx(getPart1MaxWidth(stringBounder)); drawBorder(ug); - ug = ug.apply(new UTranslate(marginX1, 0)); + ug = ug.apply(UTranslate.dx(marginX1)); drawHighlightsBack(ug.apply(beforeRuler)); ruler.draw0(ug.apply(beforeRuler), getHeightInner(stringBounder)); @@ -159,8 +154,8 @@ public class TimingDiagram extends UmlDiagram implements Clocks { drawHorizontalSeparator(ug.apply(getUTranslateForFrame(player, stringBounder))); player.getPlayerFrame().drawFrameTitle(ug.apply(getUTranslateForFrame(player, stringBounder))); final UGraphic ug2 = ug.apply(getUTranslateForPlayer(player, stringBounder)); - player.drawContent(ug2.apply(beforeRuler)); - player.drawLeftHeader(ug2); + player.getPart2().drawU(ug2.apply(beforeRuler)); + player.getPart1().drawU(ug2); } ug = ug.apply(beforeRuler); if (this.drawTimeAxis) { @@ -174,18 +169,18 @@ public class TimingDiagram extends UmlDiagram implements Clocks { private void drawHorizontalSeparator(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); ug = ug.apply(getBorderStroke()); - ug = ug.apply(new UTranslate(-marginX1, 0)); - ug.draw(new ULine(getWidthTotal(stringBounder), 0)); + ug = ug.apply(UTranslate.dx(-marginX1)); + ug.draw(ULine.hline(getWidthTotal(stringBounder))); } private void drawBorder(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final ULine border = new ULine(0, getLastTranslate(stringBounder).getDy()); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(getBorderStroke()); + final ULine border = ULine.vline(getLastTranslate(stringBounder).getDy()); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(getBorderStroke()); ug.draw(border); - ug.apply(new UTranslate(getWidthTotal(stringBounder), 0)).draw(border); + ug.apply(UTranslate.dx(getWidthTotal(stringBounder))).draw(border); } private UStroke getBorderStroke() { @@ -230,26 +225,18 @@ public class TimingDiagram extends UmlDiagram implements Clocks { } private double getWidthTotal(final StringBounder stringBounder) { - return getWidthBeforeRuler(stringBounder) + ruler.getWidth() + marginX1 + marginX2; + return getPart1MaxWidth(stringBounder) + ruler.getWidth() + marginX1 + marginX2; } - private double getWidthBeforeRuler(StringBounder stringBounder) { + private double getPart1MaxWidth(StringBounder stringBounder) { double width = 0; for (Player player : players.values()) { - width = Math.max(width, player.getWidthHeader(stringBounder)); + width = Math.max(width, player.getPart1().calculateDimension(stringBounder).getWidth()); } return width; } -// private double getWidthFirstColumn(StringBounder stringBounder) { -// double width = 0; -// for (Player player : players.values()) { -// width = Math.max(width, player.getFirstColumnWidth(stringBounder)); -// } -// return width; -// } - private void drawMessages(UGraphic ug, TimeMessage message) { final Player player1 = message.getPlayer1(); final Player player2 = message.getPlayer2(); @@ -274,15 +261,15 @@ public class TimingDiagram extends UmlDiagram implements Clocks { double y = 0; for (Player player : players.values()) { if (candidat == player) { - return new UTranslate(0, y); + return UTranslate.dy(y); } if (y == 0) { y += getHeightHighlights(stringBounder); } - y += player.getHeight(stringBounder); + y += player.getFullHeight(stringBounder); } if (candidat == null) { - return new UTranslate(0, y); + return UTranslate.dy(y); } throw new IllegalArgumentException(); } @@ -291,25 +278,25 @@ public class TimingDiagram extends UmlDiagram implements Clocks { double y = getHeightHighlights(stringBounder); for (Player player : players.values()) { if (candidat == player) { - return new UTranslate(0, y); + return UTranslate.dy(y); } - y += player.getHeight(stringBounder); + y += player.getFullHeight(stringBounder); } if (candidat == null) { - return new UTranslate(0, y); + return UTranslate.dy(y); } throw new IllegalArgumentException(); } public CommandExecutionResult createRobustConcise(String code, String full, TimingStyle type) { - final Player player = type.createPlayer(getTitleStrategy(), full, getSkinParam(), ruler); + final Player player = new PlayerRobustConcise(type, full, getSkinParam(), ruler); players.put(code, player); lastPlayer = player; return CommandExecutionResult.ok(); } public CommandExecutionResult createClock(String code, String full, int period, int pulse) { - final PlayerClock player = new PlayerClock(getTitleStrategy(), getSkinParam(), ruler, period, pulse); + final PlayerClock player = new PlayerClock(getSkinParam(), ruler, period, pulse); players.put(code, player); clocks.put(code, player); final TimeTick tick = new TimeTick(new BigDecimal(period), TimingFormat.DECIMAL); @@ -318,7 +305,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks { } public CommandExecutionResult createBinary(String code, String full) { - final Player player = new PlayerBinary(getTitleStrategy(), code, getSkinParam(), ruler); + final Player player = new PlayerBinary(code, getSkinParam(), ruler); players.put(code, player); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java index 004c45c6c..50863f66f 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java @@ -41,6 +41,22 @@ import java.util.List; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.UmlDiagramFactory; +import net.sourceforge.plantuml.timingdiagram.command.CommandAtPlayer; +import net.sourceforge.plantuml.timingdiagram.command.CommandAtTime; +import net.sourceforge.plantuml.timingdiagram.command.CommandBinary; +import net.sourceforge.plantuml.timingdiagram.command.CommandChangeStateByPlayerCode; +import net.sourceforge.plantuml.timingdiagram.command.CommandChangeStateByTime; +import net.sourceforge.plantuml.timingdiagram.command.CommandClock; +import net.sourceforge.plantuml.timingdiagram.command.CommandConstraint; +import net.sourceforge.plantuml.timingdiagram.command.CommandDefineStateLong; +import net.sourceforge.plantuml.timingdiagram.command.CommandDefineStateShort; +import net.sourceforge.plantuml.timingdiagram.command.CommandHideTimeAxis; +import net.sourceforge.plantuml.timingdiagram.command.CommandHighlight; +import net.sourceforge.plantuml.timingdiagram.command.CommandNote; +import net.sourceforge.plantuml.timingdiagram.command.CommandNoteLong; +import net.sourceforge.plantuml.timingdiagram.command.CommandRobustConcise; +import net.sourceforge.plantuml.timingdiagram.command.CommandScalePixel; +import net.sourceforge.plantuml.timingdiagram.command.CommandTimeMessage; public class TimingDiagramFactory extends UmlDiagramFactory { diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java b/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java index eeb4a2676..4ab0f04be 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java @@ -46,11 +46,12 @@ import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TimingNote { @@ -69,8 +70,10 @@ public class TimingNote { } public void drawU(UGraphic ug) { - final Opale opale = createOpale(); - opale.drawU(ug); + if (position == Position.BOTTOM) { + ug = ug.apply(UTranslate.dy(getMarginY() / 2)); + } + createOpale().drawU(ug); } @@ -78,19 +81,24 @@ public class TimingNote { final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + final HColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + final HColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), - skinParam, CreoleMode.FULL).createSheet(note); + final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, + CreoleMode.FULL).createSheet(note); final SheetBlock1 sheet1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); - final double shadowing;shadowing = skinParam.shadowing(null)?4:0; + final double shadowing; + shadowing = skinParam.shadowing(null) ? 4 : 0; final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, sheet1, false); return opale; } public double getHeight(StringBounder stringBounder) { - return createOpale().calculateDimension(stringBounder).getHeight(); + return createOpale().calculateDimension(stringBounder).getHeight() + getMarginY(); + } + + private double getMarginY() { + return 10; } public TimeTick getWhen() { diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java index f2127894b..a8aecad2e 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java @@ -45,9 +45,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -55,6 +52,9 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimingRuler { @@ -69,7 +69,7 @@ public class TimingRuler { private UGraphic applyForVLines(UGraphic ug) { final UStroke stroke = new UStroke(3, 5, 0.5); - final HtmlColor color = new HtmlColorSetSimple().getColorIfValid("#AAA"); + final HColor color = HColorSet.instance().getColorIfValid("#AAA"); return ug.apply(stroke).apply(new UChangeColor(color)); } @@ -154,14 +154,14 @@ public class TimingRuler { } public void drawTimeAxis(UGraphic ug) { - ug = ug.apply(new UStroke(2.0)).apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UStroke(2.0)).apply(new UChangeColor(HColorUtils.BLACK)); final double tickHeight = 5; - final ULine line = new ULine(0, tickHeight); + final ULine line = ULine.vline(tickHeight); final int nb = getNbTick(true); for (int i = 0; i <= nb; i++) { - ug.apply(new UTranslate(tickIntervalInPixels * i, 0)).draw(line); + ug.apply(UTranslate.dx(tickIntervalInPixels * i)).draw(line); } - ug.draw(new ULine(nb * tickIntervalInPixels, 0)); + ug.draw(ULine.hline(nb * tickIntervalInPixels)); for (long round : roundValues()) { final TextBlock text = getTimeTextBlock(round); @@ -192,10 +192,10 @@ public class TimingRuler { public void draw0(UGraphic ug, double height) { ug = applyForVLines(ug); - final ULine line = new ULine(0, height); + final ULine line = ULine.vline(height); final int nb = getNbTick(true); for (int i = 0; i <= nb; i++) { - ug.apply(new UTranslate(tickIntervalInPixels * i, 0)).draw(line); + ug.apply(UTranslate.dx(tickIntervalInPixels * i)).draw(line); } } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingStyle.java b/src/net/sourceforge/plantuml/timingdiagram/TimingStyle.java index 7ee519b0e..0e9643e1b 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingStyle.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingStyle.java @@ -34,20 +34,8 @@ */ package net.sourceforge.plantuml.timingdiagram; -import net.sourceforge.plantuml.ISkinParam; - public enum TimingStyle { - ROBUST, CONCISE; - - public Player createPlayer(TitleStrategy titleStrategy, String full, ISkinParam skinParam, TimingRuler ruler) { - if (this == ROBUST) { - return new PlayerRobust(titleStrategy, full, skinParam, ruler); - } - if (this == CONCISE) { - return new PlayerConcise(titleStrategy, full, skinParam, ruler); - } - throw new UnsupportedOperationException(); - } + ROBUST, CONCISE } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TitleStrategy.java b/src/net/sourceforge/plantuml/timingdiagram/TitleStrategy.java deleted file mode 100644 index c492fb556..000000000 --- a/src/net/sourceforge/plantuml/timingdiagram/TitleStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2020, Arnaud Roques - * - * Project Info: http://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * http://plantuml.com/patreon (only 1$ per month!) - * http://plantuml.com/paypal - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * - * Original Author: Arnaud Roques - * - */ -package net.sourceforge.plantuml.timingdiagram; - -public enum TitleStrategy { - IN_FRAME, IN_LEFT_HEADER -} diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandAtPlayer.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandAtPlayer.java similarity index 93% rename from src/net/sourceforge/plantuml/timingdiagram/CommandAtPlayer.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandAtPlayer.java index 269b32de4..d1a8430c6 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandAtPlayer.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandAtPlayer.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandAtPlayer extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandAtTime.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandAtTime.java similarity index 93% rename from src/net/sourceforge/plantuml/timingdiagram/CommandAtTime.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandAtTime.java index 043ff17cb..2507feb8c 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandAtTime.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandAtTime.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandAtTime extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandBinary.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandBinary.java similarity index 95% rename from src/net/sourceforge/plantuml/timingdiagram/CommandBinary.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandBinary.java index 9584b8be9..6d8b492bd 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandBinary.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandBinary.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandBinary extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandChangeState.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeState.java similarity index 93% rename from src/net/sourceforge/plantuml/timingdiagram/CommandChangeState.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeState.java index 4fd63baae..e0fcebc1f 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandChangeState.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeState.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -44,6 +44,9 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; abstract class CommandChangeState extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandChangeStateByPlayerCode.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeStateByPlayerCode.java similarity index 92% rename from src/net/sourceforge/plantuml/timingdiagram/CommandChangeStateByPlayerCode.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeStateByPlayerCode.java index bbaf52d93..700c3f2cf 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandChangeStateByPlayerCode.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeStateByPlayerCode.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandChangeStateByPlayerCode extends CommandChangeState { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandChangeStateByTime.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeStateByTime.java similarity index 92% rename from src/net/sourceforge/plantuml/timingdiagram/CommandChangeStateByTime.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeStateByTime.java index f77db0718..8b1f0d0b9 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandChangeStateByTime.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandChangeStateByTime.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandChangeStateByTime extends CommandChangeState { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandClock.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandClock.java similarity index 96% rename from src/net/sourceforge/plantuml/timingdiagram/CommandClock.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandClock.java index f03482282..d13c0514d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandClock.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandClock.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandClock extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java similarity index 93% rename from src/net/sourceforge/plantuml/timingdiagram/CommandConstraint.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java index cba9e6f33..2362f8b2d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandConstraint.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -43,6 +43,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandConstraint extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandDefineStateLong.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandDefineStateLong.java similarity index 94% rename from src/net/sourceforge/plantuml/timingdiagram/CommandDefineStateLong.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandDefineStateLong.java index 3ca4e6497..4b935b157 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandDefineStateLong.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandDefineStateLong.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandDefineStateLong extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandDefineStateShort.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandDefineStateShort.java similarity index 94% rename from src/net/sourceforge/plantuml/timingdiagram/CommandDefineStateShort.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandDefineStateShort.java index 539fb2496..440af81f2 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandDefineStateShort.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandDefineStateShort.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import java.util.StringTokenizer; @@ -44,6 +44,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandDefineStateShort extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandHideTimeAxis.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandHideTimeAxis.java similarity index 95% rename from src/net/sourceforge/plantuml/timingdiagram/CommandHideTimeAxis.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandHideTimeAxis.java index 16db5de60..6de06914e 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandHideTimeAxis.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandHideTimeAxis.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandHideTimeAxis extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandHighlight.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java similarity index 95% rename from src/net/sourceforge/plantuml/timingdiagram/CommandHighlight.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java index 81546bf3d..2c2502d4b 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandHighlight.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java @@ -33,11 +33,10 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -48,6 +47,8 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandHighlight extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandNote.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandNote.java similarity index 93% rename from src/net/sourceforge/plantuml/timingdiagram/CommandNote.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandNote.java index 18ee99d81..4039cc95f 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandNote.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandNote.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -44,6 +44,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandNote extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandNoteLong.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandNoteLong.java similarity index 93% rename from src/net/sourceforge/plantuml/timingdiagram/CommandNoteLong.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandNoteLong.java index 7064cfaea..d5e42af62 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandNoteLong.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandNoteLong.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -45,6 +45,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandNoteLong extends CommandMultilines2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandRobustConcise.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandRobustConcise.java similarity index 93% rename from src/net/sourceforge/plantuml/timingdiagram/CommandRobustConcise.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandRobustConcise.java index 1c2b57f47..85223a7c7 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandRobustConcise.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandRobustConcise.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; +import net.sourceforge.plantuml.timingdiagram.TimingStyle; public class CommandRobustConcise extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandScalePixel.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandScalePixel.java similarity index 95% rename from src/net/sourceforge/plantuml/timingdiagram/CommandScalePixel.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandScalePixel.java index 86aa93b05..a2ca0898d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandScalePixel.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandScalePixel.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandScalePixel extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/CommandTimeMessage.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandTimeMessage.java similarity index 92% rename from src/net/sourceforge/plantuml/timingdiagram/CommandTimeMessage.java rename to src/net/sourceforge/plantuml/timingdiagram/command/CommandTimeMessage.java index d2e2d1843..89c55df16 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/CommandTimeMessage.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandTimeMessage.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -44,6 +44,10 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; +import net.sourceforge.plantuml.timingdiagram.Player; +import net.sourceforge.plantuml.timingdiagram.TimeMessage; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; public class CommandTimeMessage extends SingleLineCommand2 { diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeTickBuilder.java b/src/net/sourceforge/plantuml/timingdiagram/command/TimeTickBuilder.java similarity index 94% rename from src/net/sourceforge/plantuml/timingdiagram/TimeTickBuilder.java rename to src/net/sourceforge/plantuml/timingdiagram/command/TimeTickBuilder.java index 2c0a86505..42c47d137 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeTickBuilder.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/TimeTickBuilder.java @@ -32,7 +32,7 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.command; import java.math.BigDecimal; @@ -42,6 +42,9 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.timingdiagram.Clocks; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingFormat; public class TimeTickBuilder { diff --git a/src/net/sourceforge/plantuml/timingdiagram/HexaShape.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/HexaShape.java similarity index 97% rename from src/net/sourceforge/plantuml/timingdiagram/HexaShape.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/HexaShape.java index 81f19dc48..cb85df979 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/HexaShape.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/HexaShape.java @@ -32,7 +32,7 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.UDrawable; diff --git a/src/net/sourceforge/plantuml/timingdiagram/Histogram.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java similarity index 71% rename from src/net/sourceforge/plantuml/timingdiagram/Histogram.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java index b96019c0d..290ea34c0 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Histogram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java @@ -32,11 +32,10 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -47,23 +46,27 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; -import net.sourceforge.plantuml.ugraphic.MinMax; +import net.sourceforge.plantuml.timingdiagram.ChangeState; +import net.sourceforge.plantuml.timingdiagram.TimeConstraint; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingRuler; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; -public class Histogram implements TimeDrawing { +public class Histogram implements PlayerDrawing { private final List changes = new ArrayList(); private final List constraints = new ArrayList(); @@ -88,21 +91,18 @@ public class Histogram implements TimeDrawing { if (states.size() == 0) { return null; } + final double heightForConstraints = getHeightForConstraints(stringBounder); if (states.size() == 1) { - final double y = getStateYFor(states.get(0)); + final double y = yOfState(states.get(0)) + heightForConstraints; return new IntricatedPoint(new Point2D.Double(x, y), new Point2D.Double(x, y)); } assert states.size() == 2; - final double y1 = getStateYFor(states.get(0)); - final double y2 = getStateYFor(states.get(1)); + final double y1 = yOfState(states.get(0)) + heightForConstraints; + final double y2 = yOfState(states.get(1)) + heightForConstraints; assert y1 != y2; return new IntricatedPoint(new Point2D.Double(x, y1), new Point2D.Double(x, y2)); } - private double getStateYFor(String state) { - return (allStates.size() - 1 - allStates.indexOf(state)) * stepHeight; - } - private List getStatesAt(TimeTick tick) { if (changes.size() == 0) { return Collections.emptyList(); @@ -121,7 +121,8 @@ public class Histogram implements TimeDrawing { if (tickWithCurrentChangeTimeComparisonResult > 0) { final int changeIndex; if (i == 0) { - // if this time tick was not yet defined in any place, and is less then the first one, + // if this time tick was not yet defined in any place, and is less then the + // first one, // assume it's the leftmost changeIndex = 0; } else { @@ -175,31 +176,65 @@ public class Histogram implements TimeDrawing { return yOfState(states[0]); } - private double yOfState(String state) { - // if (state.equals("{?}")) { - // throw new IllegalArgumentException(); - // } - return -stepHeight * allStates.indexOf(state); - } - - // private SortedSet getAllYofStates() { - // final SortedSet result = new TreeSet(); - // for (String state : allStates) { - // result.add(yOfState(state)); - // } - // return result; - // } - private SymbolContext getContext() { - return new SymbolContext(HtmlColorUtils.COL_D7E0F2, HtmlColorUtils.COL_038048).withStroke(new UStroke(1.5)); + return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); } - public void drawU(UGraphic ug) { - ug = getContext().apply(ug); - final UTranslate deltaY = new UTranslate(0, getFullDeltaY()); + public TextBlock getPart1() { + return new AbstractTextBlock() { + public void drawU(UGraphic ug) { + drawPart1(ug); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return calculateDimensionPart1(stringBounder); + } + }; + } + + public UDrawable getPart2() { + return new UDrawable() { + public void drawU(UGraphic ug) { + drawPart2(ug); + } + }; + } + + private Dimension2D calculateDimensionPart1(StringBounder stringBounder) { + double width = 0; + for (String state : allStates) { + final TextBlock label = getTextBlock(state); + final Dimension2D dim = label.calculateDimension(stringBounder); + width = Math.max(width, dim.getWidth()); + } + if (initialState != null) { + width += getInitialWidth(); + } + return new Dimension2DDouble(width, getFullHeight(stringBounder)); + } + + private void drawPart1(UGraphic ug) { + ug = ug.apply(UTranslate.dy(getHeightForConstraints(ug.getStringBounder()))); + for (String state : allStates) { + final TextBlock label = getTextBlock(state); + final Dimension2D dim = label.calculateDimension(ug.getStringBounder()); + label.drawU(ug.apply(UTranslate.dy(yOfState(state) - dim.getHeight() / 2 + 1))); + } + } + + private void drawPart2(UGraphic ug) { if (changes.size() == 0) { return; } + ug = getContext().apply(ug); + ug = ug.apply(UTranslate.dy(getHeightForConstraints(ug.getStringBounder()))); + drawHlines(ug); + drawVlines(ug); + drawLabels(ug); + drawConstraints(ug.apply(UTranslate.dy(-TimeConstraint.getTopMargin()))); + } + + private void drawHlines(UGraphic ug) { if (initialState != null) { for (Point2D pt : getPoints(0)) { drawHLine(ug, getInitialPoint(), getInitialWidth() + pt.getX()); @@ -222,18 +257,38 @@ public class Histogram implements TimeDrawing { final double len = ruler.getWidth() - pt.getX(); drawHLine(ug, pt, len); } + } + private void drawHBlock(UGraphic ug, Point2D pt1, Point2D pt2, double len) { + final double minY = Math.min(pt1.getY(), pt2.getY()); + final double maxY = Math.max(pt1.getY(), pt2.getY()); + final Point2D pt = new Point2D.Double(pt1.getX(), minY); + ug = ug.apply(new UTranslate(pt)); + ug.draw(new URectangle(len, maxY - minY)); + for (double x = 0; x < len; x += 5) { + ug.apply(UTranslate.dx(x)).draw(ULine.vline(maxY - minY)); + } + + } + + private void drawHLine(UGraphic ug, final Point2D pt, final double len) { + ug.apply(new UTranslate(pt)).draw(ULine.hline(len)); + } + + private void drawVlines(UGraphic ug) { if (initialState != null) { final Point2D before = getInitialPoint(); final Point2D current = getPoints(0)[0]; - ug.apply(new UTranslate(current).compose(deltaY)).draw(new ULine(0, before.getY() - current.getY())); + ug.apply(new UTranslate(current)).draw(ULine.vline(before.getY() - current.getY())); } for (int i = 1; i < changes.size(); i++) { final double minY = Math.min(getPointMinY(i), getPointMinY(i - 1)); final double maxY = Math.max(getPointMaxY(i), getPointMaxY(i - 1)); - ug.apply(new UTranslate(getPointx(i), minY).compose(deltaY)).draw(new ULine(0, maxY - minY)); + ug.apply(new UTranslate(getPointx(i), minY)).draw(ULine.vline(maxY - minY)); } + } + private void drawLabels(UGraphic ug) { for (int i = 0; i < changes.size(); i++) { final Point2D ptLabel = getPoints(i)[0]; final String comment = changes.get(i).getComment(); @@ -242,17 +297,19 @@ public class Histogram implements TimeDrawing { } final TextBlock label = getTextBlock(comment); final Dimension2D dim = label.calculateDimension(ug.getStringBounder()); - label.drawU(ug.apply(new UTranslate(ptLabel).compose(deltaY).compose(new UTranslate(2, -dim.getHeight())))); + label.drawU(ug.apply(new UTranslate(ptLabel).compose(new UTranslate(2, -dim.getHeight())))); } + } + private void drawConstraints(UGraphic ug) { for (TimeConstraint constraint : constraints) { final String state1 = last(getStatesAt(constraint.getTick1())); final String state2 = getStatesAt(constraint.getTick2()).get(0); - final double y1 = getStateYFor(state1); - final double y2 = getStateYFor(state2); - constraint.drawU(ug.apply(new UTranslate(0, y1 - stepHeight / 2)), ruler, skinParam); + final double y1 = yOfState(state1); + final double y2 = yOfState(state2); + // constraint.drawU(ug.apply(UTranslate.dy(y1 - stepHeight / 2)), ruler); + constraint.drawU(ug.apply(UTranslate.dy(y1)), ruler); } - } private static String last(List list) { @@ -263,29 +320,21 @@ public class Histogram implements TimeDrawing { return new Point2D.Double(-getInitialWidth(), yOfState(initialState)); } - private void drawHBlock(UGraphic ug, Point2D pt1, Point2D pt2, double len) { - final double minY = Math.min(pt1.getY(), pt2.getY()); - final double maxY = Math.max(pt1.getY(), pt2.getY()); - final Point2D pt = new Point2D.Double(pt1.getX(), minY); - final UTranslate deltaY = new UTranslate(0, getFullDeltaY()); - final UTranslate pos = new UTranslate(pt).compose(deltaY); - ug = ug.apply(pos); - ug.draw(new URectangle(len, maxY - minY)); - for (double x = 0; x < len; x += 5) { - ug.apply(new UTranslate(x, 0)).draw(new ULine(0, maxY - minY)); - } - + private double getHeightForConstraints(StringBounder stringBounder) { + return TimeConstraint.getHeightForConstraints(stringBounder, constraints); } - private void drawHLine(UGraphic ug, final Point2D pt, final double len) { - final UTranslate deltaY = new UTranslate(0, getFullDeltaY()); - final UTranslate pos = new UTranslate(pt).compose(deltaY); - ug = ug.apply(pos); - ug.draw(new ULine(len, 0)); + public double getFullHeight(StringBounder stringBounder) { + return getHeightForConstraints(stringBounder) + stepHeight * (allStates.size() - 1) + getBottomMargin(); } - private double getFullDeltaY() { - return stepHeight * (allStates.size() - 1); + private double getBottomMargin() { + return 12; + } + + private double yOfState(String state) { + final int nb = allStates.size() - 1 - allStates.indexOf(state); + return stepHeight * nb; } private FontConfiguration getFontConfiguration() { @@ -297,54 +346,15 @@ public class Histogram implements TimeDrawing { return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); } - public double getHeight(StringBounder stringBounder) { - return stepHeight * allStates.size() + 10; - } - - public TextBlock getWidthHeader(StringBounder stringBounder) { - return new TextBlock() { - - public void drawU(UGraphic ug) { - for (String state : allStates) { - final TextBlock label = getTextBlock(state); - final Dimension2D dim = label.calculateDimension(ug.getStringBounder()); - label.drawU(ug.apply(new UTranslate(0, getFullDeltaY() + yOfState(state) - dim.getHeight()))); - } - } - - public Dimension2D calculateDimension(StringBounder stringBounder) { - double width = 0; - for (String state : allStates) { - final TextBlock label = getTextBlock(state); - final Dimension2D dim = label.calculateDimension(stringBounder); - width = Math.max(width, dim.getWidth()); - } - if (initialState != null) { - width += getInitialWidth(); - } - return new Dimension2DDouble(width, getFullDeltaY()); - } - - public MinMax getMinMax(StringBounder stringBounder) { - throw new UnsupportedOperationException(); - } - - public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { - return null; - } - - }; - } - public void setInitialState(String initialState, Colors initialColors) { this.initialState = initialState; - if (initialState != null) { + if (initialState != null && allStates.contains(initialState) == false) { allStates.add(initialState); } } private double getInitialWidth() { - return stepHeight * 2; + return 40; } public void addConstraint(TimeConstraint constraint) { diff --git a/src/net/sourceforge/plantuml/timingdiagram/IntricatedPoint.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/IntricatedPoint.java similarity index 96% rename from src/net/sourceforge/plantuml/timingdiagram/IntricatedPoint.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/IntricatedPoint.java index ac4566e2b..433b6e537 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/IntricatedPoint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/IntricatedPoint.java @@ -32,7 +32,7 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import java.awt.geom.Point2D; diff --git a/src/net/sourceforge/plantuml/timingdiagram/PentaAShape.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/PentaAShape.java similarity index 97% rename from src/net/sourceforge/plantuml/timingdiagram/PentaAShape.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/PentaAShape.java index b8006e243..5f7bfd10e 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PentaAShape.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/PentaAShape.java @@ -32,7 +32,7 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.UDrawable; diff --git a/src/net/sourceforge/plantuml/timingdiagram/PentaBShape.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/PentaBShape.java similarity index 97% rename from src/net/sourceforge/plantuml/timingdiagram/PentaBShape.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/PentaBShape.java index f2cbbdfe5..3063831f2 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PentaBShape.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/PentaBShape.java @@ -32,7 +32,7 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.UDrawable; diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeDrawing.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerDrawing.java similarity index 79% rename from src/net/sourceforge/plantuml/timingdiagram/TimeDrawing.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerDrawing.java index 540eddebd..b87796f6c 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeDrawing.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerDrawing.java @@ -32,20 +32,25 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.ChangeState; +import net.sourceforge.plantuml.timingdiagram.TimeConstraint; +import net.sourceforge.plantuml.timingdiagram.TimeProjected; -public interface TimeDrawing extends TimeProjected, UDrawable { +public interface PlayerDrawing extends TimeProjected { - public double getHeight(StringBounder stringBounder); + public double getFullHeight(StringBounder stringBounder); public void addChange(ChangeState change); - public TextBlock getWidthHeader(StringBounder stringBounder); + public TextBlock getPart1(); + + public UDrawable getPart2(); public void setInitialState(String initialState, Colors initialColors); diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerFrame.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java similarity index 89% rename from src/net/sourceforge/plantuml/timingdiagram/PlayerFrame.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java index 6aac664ad..50d7f4e89 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerFrame.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java @@ -32,11 +32,14 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; +import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; public interface PlayerFrame { public void drawFrameTitle(UGraphic ug); + + public double getHeight(StringBounder stringBounder); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerFrame2.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame2.java similarity index 71% rename from src/net/sourceforge/plantuml/timingdiagram/PlayerFrame2.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame2.java index 409814710..78b456489 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerFrame2.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame2.java @@ -32,36 +32,35 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.timingdiagram.TimingDiagram; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PlayerFrame2 implements PlayerFrame { - private final TitleStrategy titleStrategy; private final TextBlock title; - public PlayerFrame2(TitleStrategy titleStrategy, TextBlock title) { + public PlayerFrame2(TextBlock title) { this.title = title; - this.titleStrategy = titleStrategy; } public void drawFrameTitle(UGraphic ug) { - if (titleStrategy == TitleStrategy.IN_FRAME) { - title.drawU(ug); - final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UStroke(1.0)); - drawLine(ug, -TimingDiagram.marginX1, dimTitle.getHeight() + 1, dimTitle.getWidth() + 1, - dimTitle.getHeight() + 1, dimTitle.getWidth() + 1 + 10, 0); - } + title.drawU(ug); + final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)).apply(new UStroke(1.0)); + final double widthTmp = dimTitle.getWidth() + 1; + final double height = getHeight(ug.getStringBounder()); + drawLine(ug, -TimingDiagram.marginX1, height, widthTmp, height, widthTmp + 10, 0); } private void drawLine(UGraphic ug, double... coord) { @@ -74,4 +73,9 @@ public class PlayerFrame2 implements PlayerFrame { } } + public double getHeight(StringBounder stringBounder) { + final Dimension2D dimTitle = title.calculateDimension(stringBounder); + return dimTitle.getHeight() + 1; + } + } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorSet.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrameEmpty.java similarity index 79% rename from src/net/sourceforge/plantuml/graphic/HtmlColorSet.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrameEmpty.java index 850d0c468..7412dc7b9 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorSet.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrameEmpty.java @@ -30,17 +30,19 @@ * * * Original Author: Arnaud Roques - * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.timingdiagram.graphic; -public class HtmlColorSet { +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.UGraphic; - private final static IHtmlColorSet singleton = new HtmlColorSetSimple(); +public class PlayerFrameEmpty implements PlayerFrame { - public static IHtmlColorSet getInstance() { - return singleton; + public void drawFrameTitle(UGraphic ug) { } + public double getHeight(StringBounder stringBounder) { + return 0; + } } diff --git a/src/net/sourceforge/plantuml/timingdiagram/Ribbon.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java similarity index 57% rename from src/net/sourceforge/plantuml/timingdiagram/Ribbon.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java index 209c80814..f27543f41 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Ribbon.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java @@ -32,36 +32,43 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.List; +import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.timingdiagram.ChangeState; +import net.sourceforge.plantuml.timingdiagram.TimeConstraint; +import net.sourceforge.plantuml.timingdiagram.TimeTick; +import net.sourceforge.plantuml.timingdiagram.TimingNote; +import net.sourceforge.plantuml.timingdiagram.TimingRuler; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; -public class Ribbon implements TimeDrawing { +public class Ribbon implements PlayerDrawing { private final List changes = new ArrayList(); private final List constraints = new ArrayList(); - private final double delta = 12; private final ISkinParam skinParam; private final TimingRuler ruler; private String initialState; @@ -76,13 +83,14 @@ public class Ribbon implements TimeDrawing { public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { final double x = ruler.getPosInPixel(tick); - final double y = delta * 0.5 + getHeightForConstraints(); + final double y = getHeightForConstraints(stringBounder) + getRibbonHeight() / 2; for (ChangeState change : changes) { if (change.getWhen().compareTo(tick) == 0) { return new IntricatedPoint(new Point2D.Double(x, y), new Point2D.Double(x, y)); } } - return new IntricatedPoint(new Point2D.Double(x, y - delta), new Point2D.Double(x, y + delta)); + return new IntricatedPoint(new Point2D.Double(x, y - getRibbonHeight() / 2), + new Point2D.Double(x, y + getRibbonHeight() / 2)); } public void addChange(ChangeState change) { @@ -102,92 +110,33 @@ public class Ribbon implements TimeDrawing { return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); } - public void drawU(UGraphic ug) { - - final StringBounder stringBounder = ug.getStringBounder(); - final double halfDelta = delta / 2; - drawNotes(ug.apply(new UTranslate(0, -delta)), Position.TOP); - - final double ribbonHeight = getRibbonHeight(); - UGraphic ugDown = ug.apply(new UTranslate(0, getHeightForConstraints() - + getHeightForNotes(stringBounder, Position.TOP))); - - final TextBlock initial; + public TextBlock getPart1() { if (initialState == null) { - initial = null; - } else { - initial = createTextBlock(initialState); - if (changes.size() > 0) { - final double a = getPosInPixel(changes.get(0)); - drawPentaA(ugDown.apply(new UTranslate(-getInitialWidth(stringBounder), -halfDelta)), - getInitialWidth(stringBounder) + a, changes.get(0)); + return TextBlockUtils.empty(0, 0); + } + return new AbstractTextBlock() { + public void drawU(UGraphic ug) { } - } - for (int i = 0; i < changes.size() - 1; i++) { - final double a = getPosInPixel(changes.get(i)); - final double b = getPosInPixel(changes.get(i + 1)); - assert b > a; - if (changes.get(i).isFlat()) { - drawFlat(ugDown.apply(new UTranslate(a, -halfDelta)), b - a, changes.get(i)); - } else if (changes.get(i).isCompletelyHidden() == false) { - drawHexa(ugDown.apply(new UTranslate(a, -halfDelta)), b - a, changes.get(i)); + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(getInitialWidth(stringBounder), getRibbonHeight()); } - } - if (changes.size() >= 1) { - final ChangeState last = changes.get(changes.size() - 1); - final double a = getPosInPixel(last); - if (last.isFlat()) { - drawFlat(ugDown.apply(new UTranslate(a, -halfDelta)), ruler.getWidth() - a, last); - } else if (last.isCompletelyHidden() == false) { - drawPentaB(ugDown.apply(new UTranslate(a, -halfDelta)), ruler.getWidth() - a, last); + }; + } + + public UDrawable getPart2() { + return new UDrawable() { + public void drawU(UGraphic ug) { + drawPart2(ug); } - } - - ugDown = ugDown.apply(new UTranslate(0, halfDelta)); - - if (initial != null) { - final Dimension2D dimInital = initial.calculateDimension(stringBounder); - initial.drawU(ugDown.apply(new UTranslate(-getDelta() - dimInital.getWidth(), -dimInital.getHeight() / 2))); - } - for (int i = 0; i < changes.size(); i++) { - final ChangeState change = changes.get(i); - final double x = ruler.getPosInPixel(change.getWhen()); - if (change.isBlank() == false && change.isCompletelyHidden() == false && change.isFlat() == false) { - final TextBlock state = createTextBlock(change.getState()); - final Dimension2D dim = state.calculateDimension(stringBounder); - final double xtext; - if (i == changes.size() - 1) { - xtext = x + getDelta(); - } else { - final double x2 = ruler.getPosInPixel(changes.get(i + 1).getWhen()); - xtext = (x + x2) / 2 - dim.getWidth() / 2; - } - state.drawU(ugDown.apply(new UTranslate(xtext, -dim.getHeight() / 2))); - } - final String commentString = change.getComment(); - if (commentString != null) { - final TextBlock comment = createTextBlock(commentString); - final Dimension2D dimComment = comment.calculateDimension(stringBounder); - comment.drawU(ugDown.apply(new UTranslate(x + getDelta(), -delta - dimComment.getHeight()))); - } - } - - for (TimeConstraint constraint : constraints) { - constraint.drawU(ug.apply(new UTranslate(0, getHeightForConstraints() / 2)), ruler, skinParam); - } - - drawNotes( - ug.apply(new UTranslate(0, getHeightForConstraints() + getHeightForNotes(stringBounder, Position.TOP) - + ribbonHeight)), Position.BOTTOM); - + }; } private void drawNotes(UGraphic ug, final Position position) { for (TimingNote note : notes) { if (note.getPosition() == position) { final double x = ruler.getPosInPixel(note.getWhen()); - note.drawU(ug.apply(new UTranslate(x, 0))); + note.drawU(ug.apply(UTranslate.dx(x))); } } } @@ -202,12 +151,12 @@ public class Ribbon implements TimeDrawing { } private void drawFlat(UGraphic ug, double len, ChangeState change) { - final ULine line = new ULine(len, 0); - change.getContext().apply(ug).apply(new UTranslate(0, getRibbonHeight() / 2)).draw(line); + final ULine line = ULine.hline(len); + change.getContext().apply(ug).apply(UTranslate.dy(getRibbonHeight() / 2)).draw(line); } private double getRibbonHeight() { - return 2 * delta; + return 24; } private void drawPentaB(UGraphic ug, double len, ChangeState change) { @@ -217,7 +166,7 @@ public class Ribbon implements TimeDrawing { private void drawPentaA(UGraphic ug, double len, ChangeState change) { SymbolContext context = change.getContext(); - final HtmlColor back = initialColors.getColor(ColorType.BACK); + final HColor back = initialColors.getColor(ColorType.BACK); if (back != null) { context = context.withBackColor(back); } @@ -225,16 +174,8 @@ public class Ribbon implements TimeDrawing { shape.drawU(ug); } - private double getHeightForConstraints() { - if (constraints.size() == 0) { - return 0; - } - return 30; - } - - public double getHeight(StringBounder stringBounder) { - return 3 * delta + getHeightForConstraints() + getHeightForNotes(stringBounder, Position.TOP) - + getHeightForNotes(stringBounder, Position.BOTTOM); + private double getHeightForConstraints(StringBounder stringBounder) { + return TimeConstraint.getHeightForConstraints(stringBounder, constraints); } private double getHeightForNotes(StringBounder stringBounder, Position position) { @@ -247,15 +188,8 @@ public class Ribbon implements TimeDrawing { return height; } - public double getDelta() { - return delta; - } - - public TextBlock getWidthHeader(StringBounder stringBounder) { - if (initialState != null) { - return TextBlockUtils.empty(getInitialWidth(stringBounder), getRibbonHeight()); - } - return TextBlockUtils.empty(0, 0); + private double getMarginX() { + return 12; } public void setInitialState(String initialState, Colors initialColors) { @@ -267,4 +201,117 @@ public class Ribbon implements TimeDrawing { this.constraints.add(constraint); } + public double getFullHeight(StringBounder stringBounder) { + return getHeightForConstraints(stringBounder) + getHeightForTopComment(stringBounder) + + getHeightForNotes(stringBounder, Position.TOP) + getRibbonHeight() + + getHeightForNotes(stringBounder, Position.BOTTOM) + getBottomMargin(); + } + + private double getBottomMargin() { + return 10; + } + + private void drawPart2(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + + final UGraphic ugRibbon = ug.apply(UTranslate.dy(getHeightForConstraints(stringBounder) + + getHeightForTopComment(stringBounder) + getHeightForNotes(stringBounder, Position.TOP))); + + drawBeforeZeroState(ugRibbon); + drawBeforeZeroStateLabel(ugRibbon.apply(UTranslate.dy(getRibbonHeight() / 2))); + drawStates(ugRibbon); + drawStatesLabels(ugRibbon.apply(UTranslate.dy(getRibbonHeight() / 2))); + + drawConstraints(ug.apply(UTranslate.dy(getHeightForConstraints(stringBounder) / 2))); + + drawNotes(ug, Position.TOP); + drawNotes(ug.apply(UTranslate.dy(getHeightForConstraints(stringBounder) + getRibbonHeight() + + getHeightForNotes(stringBounder, Position.TOP))), Position.BOTTOM); + } + + private void drawBeforeZeroState(UGraphic ug) { + if (initialState != null && changes.size() > 0) { + final StringBounder stringBounder = ug.getStringBounder(); + final double a = getPosInPixel(changes.get(0)); + drawPentaA(ug.apply(UTranslate.dx(-getInitialWidth(stringBounder))), getInitialWidth(stringBounder) + a, + changes.get(0)); + } + } + + private void drawBeforeZeroStateLabel(final UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + if (initialState != null) { + final TextBlock initial = createTextBlock(initialState); + final Dimension2D dimInital = initial.calculateDimension(stringBounder); + initial.drawU(ug.apply(new UTranslate(-getMarginX() - dimInital.getWidth(), -dimInital.getHeight() / 2))); + } + } + + private void drawStates(UGraphic ug) { + for (int i = 0; i < changes.size() - 1; i++) { + final double a = getPosInPixel(changes.get(i)); + final double b = getPosInPixel(changes.get(i + 1)); + assert b > a; + if (changes.get(i).isFlat()) { + drawFlat(ug.apply(UTranslate.dx(a)), b - a, changes.get(i)); + } else if (changes.get(i).isCompletelyHidden() == false) { + drawHexa(ug.apply(UTranslate.dx(a)), b - a, changes.get(i)); + } + } + if (changes.size() >= 1) { + final ChangeState last = changes.get(changes.size() - 1); + final double a = getPosInPixel(last); + if (last.isFlat()) { + drawFlat(ug.apply(UTranslate.dx(a)), ruler.getWidth() - a, last); + } else if (last.isCompletelyHidden() == false) { + drawPentaB(ug.apply(UTranslate.dx(a)), ruler.getWidth() - a, last); + } + } + } + + private void drawStatesLabels(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + for (int i = 0; i < changes.size(); i++) { + final ChangeState change = changes.get(i); + final double x = ruler.getPosInPixel(change.getWhen()); + if (change.isBlank() == false && change.isCompletelyHidden() == false && change.isFlat() == false) { + final TextBlock state = createTextBlock(change.getState()); + final Dimension2D dim = state.calculateDimension(stringBounder); + final double xtext; + if (i == changes.size() - 1) { + xtext = x + getMarginX(); + } else { + final double x2 = ruler.getPosInPixel(changes.get(i + 1).getWhen()); + xtext = (x + x2) / 2 - dim.getWidth() / 2; + } + state.drawU(ug.apply(new UTranslate(xtext, -dim.getHeight() / 2))); + } + final TextBlock commentTopBlock = getCommentTopBlock(change); + final Dimension2D dimComment = commentTopBlock.calculateDimension(stringBounder); + commentTopBlock + .drawU(ug.apply(new UTranslate(x + getMarginX(), -getRibbonHeight() / 2 - dimComment.getHeight()))); + } + } + + private TextBlock getCommentTopBlock(final ChangeState change) { + if (change.getComment() == null) { + return TextBlockUtils.empty(0, 0); + } + return createTextBlock(change.getComment()); + } + + private double getHeightForTopComment(StringBounder stringBounder) { + double result = 0; + for (ChangeState change : changes) { + result = Math.max(result, getCommentTopBlock(change).calculateDimension(stringBounder).getHeight()); + } + return result; + } + + private void drawConstraints(final UGraphic ug) { + for (TimeConstraint constraint : constraints) { + constraint.drawU(ug, ruler); + } + } + } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeArrow.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/TimeArrow.java similarity index 99% rename from src/net/sourceforge/plantuml/timingdiagram/TimeArrow.java rename to src/net/sourceforge/plantuml/timingdiagram/graphic/TimeArrow.java index 8af80a6b6..26edbe0dd 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeArrow.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/TimeArrow.java @@ -32,7 +32,7 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.timingdiagram.graphic; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java index ef6771ab3..65ba83d01 100644 --- a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java +++ b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java @@ -35,15 +35,17 @@ */ package net.sourceforge.plantuml.ugraphic; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperTransparentWrapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; public abstract class AbstractCommonUGraphic implements UGraphic { private UStroke stroke = new UStroke(); private UPattern pattern = UPattern.FULL; private boolean hidden = false; - private HtmlColor backColor = null; - private HtmlColor color = null; + private HColor backColor = null; + private HColor color = null; private boolean enlargeClip = false; private UTranslate translate = new UTranslate(); @@ -122,11 +124,11 @@ public abstract class AbstractCommonUGraphic implements UGraphic { return stroke; } - public HtmlColor getColor() { + public HColor getColor() { return color; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java index 2b5dea602..044598cae 100644 --- a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java +++ b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphic.java @@ -38,6 +38,8 @@ package net.sourceforge.plantuml.ugraphic; import java.util.HashMap; import java.util.Map; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; + public abstract class AbstractUGraphic extends AbstractCommonUGraphic { private final O graphic; diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphicHorizontalLine.java b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphicHorizontalLine.java index a29889d59..15aa5d4f2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphicHorizontalLine.java +++ b/src/net/sourceforge/plantuml/ugraphic/AbstractUGraphicHorizontalLine.java @@ -67,7 +67,7 @@ public abstract class AbstractUGraphicHorizontalLine extends UGraphicDelegator { public void draw(UShape shape) { if (shape instanceof UHorizontalLine) { - drawHline(getUg(), (UHorizontalLine) shape, new UTranslate(0, translate.getDy())); + drawHline(getUg(), (UHorizontalLine) shape, UTranslate.dy(translate.getDy())); } else { getUg().apply(translate).draw(shape); } diff --git a/src/net/sourceforge/plantuml/ugraphic/FontChecker.java b/src/net/sourceforge/plantuml/ugraphic/FontChecker.java index 3767e57c7..435fa0aa1 100644 --- a/src/net/sourceforge/plantuml/ugraphic/FontChecker.java +++ b/src/net/sourceforge/plantuml/ugraphic/FontChecker.java @@ -57,10 +57,11 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.svg.SvgGraphics; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FontChecker { @@ -173,7 +174,7 @@ public class FontChecker { final double dim = 20; imageBuilder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); ug.draw(new URectangle(dim - 1, dim - 1)); if (ug instanceof UGraphic2) { ug = (UGraphic2) ug.apply(new UTranslate(dim / 3, 2 * dim / 3)); diff --git a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java index 5fabb1ea7..5df9ac99d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java +++ b/src/net/sourceforge/plantuml/ugraphic/ImageBuilder.java @@ -74,15 +74,16 @@ import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.braille.UGraphicBraille; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.eps.EpsStrategy; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.mjpeg.MJPEGGenerator; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.crossing.UGraphicCrossing; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; @@ -97,7 +98,7 @@ public class ImageBuilder { private final ColorMapper colorMapper; private final double dpiFactor; - private final HtmlColor mybackcolor; + private final HColor mybackcolor; private final String metadata; private final String warningOrError; private final double margin1; @@ -110,13 +111,13 @@ public class ImageBuilder { private final double externalMargin1; private final double externalMargin2; private UStroke borderStroke; - private HtmlColor borderColor; + private HColor borderColor; private double borderCorner; private boolean svgDimensionStyle; private boolean randomPixel; - public ImageBuilder(ColorMapper colorMapper, double dpiFactor, HtmlColor mybackcolor, String metadata, + public ImageBuilder(ColorMapper colorMapper, double dpiFactor, HColor mybackcolor, String metadata, String warningOrError, double margin1, double margin2, Animation animation, boolean useHandwritten) { this.svgDimensionStyle = true; this.colorMapper = colorMapper; @@ -137,12 +138,12 @@ public class ImageBuilder { public ImageBuilder(ISkinParam skinParam, double dpiFactor, String metadata, String warningOrError, double margin1, double margin2, Animation animation) { - this(skinParam, dpiFactor, metadata, warningOrError, margin1, margin2, animation, skinParam - .getBackgroundColor()); + this(skinParam, dpiFactor, metadata, warningOrError, margin1, margin2, animation, + skinParam.getBackgroundColor()); } public ImageBuilder(ISkinParam skinParam, double dpiFactor, String metadata, String warningOrError, double margin1, - double margin2, Animation animation, HtmlColor backColor) { + double margin2, Animation animation, HColor backColor) { final Rose rose = new Rose(); this.borderColor = rose.getHtmlColor(skinParam, ColorParam.diagramBorder); this.borderStroke = skinParam.getThickness(LineParam.diagramBorder, null); @@ -197,8 +198,8 @@ public class ImageBuilder { if (MAX_PRICE == 0) { return 0; } - final int price = Math.min(MAX_PRICE, ((int) (dim.getHeight() * dpiFactor)) - * ((int) (dim.getWidth() * dpiFactor))); + final int price = Math.min(MAX_PRICE, + ((int) (dim.getHeight() * dpiFactor)) * ((int) (dim.getWidth() * dpiFactor))); return price; } @@ -242,10 +243,9 @@ public class ImageBuilder { ug2 = ug2.apply(new UTranslate(externalMargin1, externalMargin1)); } if (borderStroke != null) { - final HtmlColor color = borderColor == null ? HtmlColorUtils.BLACK : borderColor; - final URectangle shape = new URectangle( - dim.getWidth() - externalMargin() - borderStroke.getThickness(), dim.getHeight() - - externalMargin() - borderStroke.getThickness(), borderCorner, borderCorner); + final HColor color = borderColor == null ? HColorUtils.BLACK : borderColor; + final URectangle shape = new URectangle(dim.getWidth() - externalMargin() - borderStroke.getThickness(), + dim.getHeight() - externalMargin() - borderStroke.getThickness()).rounded(borderCorner); ug2.apply(new UChangeColor(color)).apply(borderStroke).draw(shape); } if (randomPixel) { @@ -283,7 +283,7 @@ public class ImageBuilder { final int green = rnd.nextInt(40); final int blue = rnd.nextInt(40); final Color c = new Color(red, green, blue); - final HtmlColor color = new HtmlColorSimple(c, false); + final HColor color = new HColorSimple(c, false); ug2.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)).draw(new URectangle(1, 1)); } @@ -301,8 +301,8 @@ public class ImageBuilder { udrawable.drawU(limitFinder); dim = new Dimension2DDouble(limitFinder.getMaxX(), limitFinder.getMaxY()); // } - return new Dimension2DDouble(dim.getWidth() + 1 + margin1 + margin2 + externalMargin(), dim.getHeight() + 1 - + margin1 + margin2 + externalMargin()); + return new Dimension2DDouble(dim.getWidth() + 1 + margin1 + margin2 + externalMargin(), + dim.getHeight() + 1 + margin1 + margin2 + externalMargin()); } private UGraphic handwritten(UGraphic ug) { @@ -327,8 +327,8 @@ public class ImageBuilder { final int nbframe = 100; - final MJPEGGenerator m = new MJPEGGenerator(f, getAviImage(null).getWidth(null), getAviImage(null).getHeight( - null), 12.0, nbframe); + final MJPEGGenerator m = new MJPEGGenerator(f, getAviImage(null).getWidth(null), + getAviImage(null).getHeight(null), 12.0, nbframe); for (int i = 0; i < nbframe; i++) { // AffineTransform at = AffineTransform.getRotateInstance(1.0); AffineTransform at = AffineTransform.getTranslateInstance(dim.getWidth() / 2, dim.getHeight() / 2); @@ -416,18 +416,19 @@ public class ImageBuilder { } } - private UGraphic2 createUGraphicSVG(ColorMapper colorMapper, double scale, Dimension2D dim, HtmlColor mybackcolor, + private UGraphic2 createUGraphicSVG(ColorMapper colorMapper, double scale, Dimension2D dim, HColor mybackcolor, String svgLinkTarget, String hover, long seed, String preserveAspectRatio) { Color backColor = Color.WHITE; - if (mybackcolor instanceof HtmlColorSimple) { + if (mybackcolor instanceof HColorSimple) { backColor = colorMapper.getMappedColor(mybackcolor); } final UGraphicSvg ug; - if (mybackcolor instanceof HtmlColorGradient) { - ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, (HtmlColorGradient) mybackcolor, false, scale, + if (mybackcolor instanceof HColorGradient) { + ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, (HColorGradient) mybackcolor, false, scale, svgLinkTarget, hover, seed, preserveAspectRatio); } else if (backColor == null || backColor.equals(Color.WHITE)) { - ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, false, scale, svgLinkTarget, hover, seed, preserveAspectRatio); + ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, false, scale, svgLinkTarget, hover, seed, + preserveAspectRatio); } else { ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, StringUtils.getAsHtml(backColor), false, scale, svgLinkTarget, hover, seed, preserveAspectRatio); @@ -437,17 +438,18 @@ public class ImageBuilder { } private UGraphic2 createUGraphicPNG(ColorMapper colorMapper, double dpiFactor, final Dimension2D dim, - HtmlColor mybackcolor, Animation affineTransforms, double dx, double dy) { + HColor mybackcolor, Animation affineTransforms, double dx, double dy) { Color backColor = Color.WHITE; - if (mybackcolor instanceof HtmlColorSimple) { + if (mybackcolor instanceof HColorSimple) { backColor = colorMapper.getMappedColor(mybackcolor); - } else if (mybackcolor instanceof HtmlColorTransparent) { + } else if (mybackcolor instanceof HColorBackground) { backColor = null; } /* - * if (rotation) { builder = new EmptyImageBuilder((int) (dim.getHeight() * dpiFactor), (int) (dim.getWidth() * - * dpiFactor), backColor); graphics2D = builder.getGraphics2D(); graphics2D.rotate(-Math.PI / 2); + * if (rotation) { builder = new EmptyImageBuilder((int) (dim.getHeight() * + * dpiFactor), (int) (dim.getWidth() * dpiFactor), backColor); graphics2D = + * builder.getGraphics2D(); graphics2D.rotate(-Math.PI / 2); * graphics2D.translate(-builder.getBufferedImage().getHeight(), 0); } else { */ final EmptyImageBuilder builder = new EmptyImageBuilder((int) (dim.getWidth() * dpiFactor), @@ -455,13 +457,13 @@ public class ImageBuilder { final Graphics2D graphics2D = builder.getGraphics2D(); // } - final UGraphicG2d ug = new UGraphicG2d(colorMapper, graphics2D, dpiFactor, affineTransforms == null ? null - : affineTransforms.getFirst(), dx, dy); + final UGraphicG2d ug = new UGraphicG2d(colorMapper, graphics2D, dpiFactor, + affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy); ug.setBufferedImage(builder.getBufferedImage()); final BufferedImage im = ((UGraphicG2d) ug).getBufferedImage(); - if (mybackcolor instanceof HtmlColorGradient) { - ug.apply(new UChangeBackColor(mybackcolor)).draw( - new URectangle(im.getWidth() / dpiFactor, im.getHeight() / dpiFactor)); + if (mybackcolor instanceof HColorGradient) { + ug.apply(new UChangeBackColor(mybackcolor)) + .draw(new URectangle(im.getWidth() / dpiFactor, im.getHeight() / dpiFactor)); } return ug; diff --git a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java index d38faedd9..7762a7efa 100644 --- a/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java +++ b/src/net/sourceforge/plantuml/ugraphic/LimitFinder.java @@ -41,6 +41,8 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.posimo.DotPath; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class LimitFinder implements UGraphic { diff --git a/src/net/sourceforge/plantuml/ugraphic/MinMax.java b/src/net/sourceforge/plantuml/ugraphic/MinMax.java index 7a669655a..4da00c753 100644 --- a/src/net/sourceforge/plantuml/ugraphic/MinMax.java +++ b/src/net/sourceforge/plantuml/ugraphic/MinMax.java @@ -39,8 +39,8 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class MinMax { @@ -142,10 +142,10 @@ public class MinMax { } public void drawGrey(UGraphic ug) { - draw(ug, HtmlColorUtils.GRAY); + draw(ug, HColorUtils.GRAY); } - public void draw(UGraphic ug, HtmlColor color) { + public void draw(UGraphic ug, HColor color) { ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)); ug = ug.apply(new UTranslate(minX, minY)); ug.draw(new URectangle(getWidth(), getHeight())); diff --git a/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java b/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java index 3eb0c82e3..2d8e72ce2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java +++ b/src/net/sourceforge/plantuml/ugraphic/TextLimitFinder.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class TextLimitFinder implements UGraphic { diff --git a/src/net/sourceforge/plantuml/ugraphic/UChangeBackColor.java b/src/net/sourceforge/plantuml/ugraphic/UChangeBackColor.java index 0a32e0599..cc836ba0c 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UChangeBackColor.java +++ b/src/net/sourceforge/plantuml/ugraphic/UChangeBackColor.java @@ -35,17 +35,17 @@ */ package net.sourceforge.plantuml.ugraphic; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class UChangeBackColor implements UChange { - private final HtmlColor color; + private final HColor color; - public UChangeBackColor(HtmlColor color) { + public UChangeBackColor(HColor color) { this.color = color; } - public HtmlColor getBackColor() { + public HColor getBackColor() { return color; } diff --git a/src/net/sourceforge/plantuml/ugraphic/UChangeColor.java b/src/net/sourceforge/plantuml/ugraphic/UChangeColor.java index 6972a5310..c71f597f4 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UChangeColor.java +++ b/src/net/sourceforge/plantuml/ugraphic/UChangeColor.java @@ -35,17 +35,17 @@ */ package net.sourceforge.plantuml.ugraphic; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class UChangeColor implements UChange { - private final HtmlColor color; + private final HColor color; - public UChangeColor(HtmlColor color) { + public UChangeColor(HColor color) { this.color = color; } - public HtmlColor getColor() { + public HColor getColor() { return color; } } diff --git a/src/net/sourceforge/plantuml/ugraphic/UDriver.java b/src/net/sourceforge/plantuml/ugraphic/UDriver.java index 9375e7776..3317362ca 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UDriver.java +++ b/src/net/sourceforge/plantuml/ugraphic/UDriver.java @@ -35,6 +35,8 @@ */ package net.sourceforge.plantuml.ugraphic; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; + public interface UDriver { public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, O object); diff --git a/src/net/sourceforge/plantuml/ugraphic/UFont.java b/src/net/sourceforge/plantuml/ugraphic/UFont.java index beb757cad..a745f60a3 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UFont.java +++ b/src/net/sourceforge/plantuml/ugraphic/UFont.java @@ -46,8 +46,8 @@ import java.util.Set; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class UFont { @@ -116,7 +116,7 @@ public class UFont { } @Deprecated - public FontConfiguration toFont2(HtmlColor color, boolean useUnderlineForHyperlink, HtmlColor hyperlinkColor, + public FontConfiguration toFont2(HColor color, boolean useUnderlineForHyperlink, HColor hyperlinkColor, int tabSize) { return new FontConfiguration(this, color, hyperlinkColor, useUnderlineForHyperlink, tabSize); } diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphic.java b/src/net/sourceforge/plantuml/ugraphic/UGraphic.java index fd247d1bf..450da3947 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphic.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphic.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml.ugraphic; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public interface UGraphic { diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphicNull.java b/src/net/sourceforge/plantuml/ugraphic/UGraphicNull.java index 6bdb8a877..2b95abec9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphicNull.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphicNull.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.TikzFontDistortion; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class UGraphicNull extends AbstractUGraphic implements EnsureVisible, UGraphic2 { diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java b/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java index 8cbf193e9..65f6c7e0d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphicUtils.java @@ -46,9 +46,10 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.eps.EpsStrategy; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.png.PngIO; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; @@ -56,7 +57,7 @@ import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; public abstract class UGraphicUtils { public static void writeImage(OutputStream os, String metadata, FileFormatOption fileFormatOption, long seed, - ColorMapper colorMapper, HtmlColor background, TextBlock image) throws IOException { + ColorMapper colorMapper, HColor background, TextBlock image) throws IOException { final FileFormat fileFormat = fileFormatOption.getFileFormat(); if (fileFormat == FileFormat.PNG) { final BufferedImage im = createImage(colorMapper, background, image); @@ -81,7 +82,7 @@ public abstract class UGraphicUtils { } } - private static BufferedImage createImage(ColorMapper colorMapper, HtmlColor background, TextBlock image) { + private static BufferedImage createImage(ColorMapper colorMapper, HColor background, TextBlock image) { final Dimension2D size = computeSize(colorMapper, background, image); final EmptyImageBuilder builder = new EmptyImageBuilder(size.getWidth(), size.getHeight(), @@ -95,7 +96,7 @@ public abstract class UGraphicUtils { return im; } - private static Dimension2D computeSize(ColorMapper colorMapper, HtmlColor background, TextBlock image) { + private static Dimension2D computeSize(ColorMapper colorMapper, HColor background, TextBlock image) { final EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, colorMapper.getMappedColor(background)); final Graphics2D g2d = builder.getGraphics2D(); diff --git a/src/net/sourceforge/plantuml/ugraphic/UHorizontalLine.java b/src/net/sourceforge/plantuml/ugraphic/UHorizontalLine.java index 83c967282..825be0f30 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UHorizontalLine.java +++ b/src/net/sourceforge/plantuml/ugraphic/UHorizontalLine.java @@ -141,7 +141,7 @@ public class UHorizontalLine implements UShape { private static void drawSimpleHline(UGraphic ug, Stencil stencil, double y) { final double startingX = stencil.getStartingX(ug.getStringBounder(), y); final double endingX = stencil.getEndingX(ug.getStringBounder(), y); - ug.apply(new UTranslate(startingX, y)).draw(new ULine(endingX - startingX, 0)); + ug.apply(new UTranslate(startingX, y)).draw(ULine.hline(endingX - startingX)); } // public void drawTitleInternalForFootprint(UGraphic ug, double x, double y) { diff --git a/src/net/sourceforge/plantuml/ugraphic/UImage.java b/src/net/sourceforge/plantuml/ugraphic/UImage.java index 261855154..348aae8c5 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UImage.java +++ b/src/net/sourceforge/plantuml/ugraphic/UImage.java @@ -42,6 +42,8 @@ import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.WritableRaster; +import net.sourceforge.plantuml.ugraphic.color.ColorChangerMonochrome; + public class UImage implements UShape { private final BufferedImage image; diff --git a/src/net/sourceforge/plantuml/ugraphic/ULine.java b/src/net/sourceforge/plantuml/ugraphic/ULine.java index 7c50ca71b..a8affa1f6 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ULine.java +++ b/src/net/sourceforge/plantuml/ugraphic/ULine.java @@ -60,6 +60,14 @@ public class ULine extends AbstractShadowable implements Scalable, UShapeSized { this.dy = dy; } + public static ULine hline(double dx) { + return new ULine(dx, 0); + } + + public static ULine vline(double dy) { + return new ULine(0, dy); + } + @Override public String toString() { return "ULine dx=" + dx + " dy=" + dy; diff --git a/src/net/sourceforge/plantuml/ugraphic/UParam.java b/src/net/sourceforge/plantuml/ugraphic/UParam.java index 24e45c8ff..2a9f0cf92 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UParam.java +++ b/src/net/sourceforge/plantuml/ugraphic/UParam.java @@ -35,13 +35,13 @@ */ package net.sourceforge.plantuml.ugraphic; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface UParam { - public HtmlColor getColor(); + public HColor getColor(); - public HtmlColor getBackcolor(); + public HColor getBackcolor(); public UStroke getStroke(); diff --git a/src/net/sourceforge/plantuml/ugraphic/UParamNull.java b/src/net/sourceforge/plantuml/ugraphic/UParamNull.java index b3786c306..b17d4dbbd 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UParamNull.java +++ b/src/net/sourceforge/plantuml/ugraphic/UParamNull.java @@ -35,15 +35,15 @@ */ package net.sourceforge.plantuml.ugraphic; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class UParamNull implements UParam { - public HtmlColor getColor() { + public HColor getColor() { return null; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } diff --git a/src/net/sourceforge/plantuml/ugraphic/URectangle.java b/src/net/sourceforge/plantuml/ugraphic/URectangle.java index ca4c441d5..d16cd23c9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/URectangle.java +++ b/src/net/sourceforge/plantuml/ugraphic/URectangle.java @@ -43,58 +43,86 @@ public class URectangle extends AbstractShadowable implements Scalable, UShapeSi private final double rx; private final double ry; private final String comment; + private boolean ignoreForCompression; public URectangle withHeight(double newHeight) { - final URectangle result = new URectangle(width, newHeight, rx, ry, comment); + final URectangle result = new URectangle(width, newHeight, rx, ry, comment, ignoreForCompression); result.ignoreForCompression = this.ignoreForCompression; result.setDeltaShadow(this.getDeltaShadow()); return result; } public URectangle withWidth(double newWidth) { - final URectangle result = new URectangle(newWidth, height, rx, ry, comment); + final URectangle result = new URectangle(newWidth, height, rx, ry, comment, ignoreForCompression); result.ignoreForCompression = this.ignoreForCompression; result.setDeltaShadow(this.getDeltaShadow()); return result; } + public URectangle withComment(String comment) { + return new URectangle(width, height, rx, ry, comment, ignoreForCompression); + } + + public URectangle rounded(double round) { + return new URectangle(width, height, round, round, comment, ignoreForCompression); + } + + public Shadowable diagonalCorner(double diagonalCorner) { + if (ignoreForCompression) { + throw new IllegalStateException(); + } + if (diagonalCorner == 0) { + return this; + } + final UPath result = new UPath(); + result.moveTo(diagonalCorner, 0); + result.lineTo(width - diagonalCorner, 0); + result.lineTo(width, diagonalCorner); + result.lineTo(width, height - diagonalCorner); + result.lineTo(width - diagonalCorner, height); + result.lineTo(diagonalCorner, height); + result.lineTo(0, height - diagonalCorner); + result.lineTo(0, diagonalCorner); + result.lineTo(diagonalCorner, 0); + return result; + } + + public final URectangle ignoreForCompression() { + return new URectangle(width, height, rx, ry, comment, true); + } + public UShape getScaled(double scale) { if (scale == 1) { return this; } - final AbstractShadowable result = new URectangle(width * scale, height * scale, rx * scale, ry * scale, comment); + final AbstractShadowable result = new URectangle(width * scale, height * scale, rx * scale, ry * scale, comment, + ignoreForCompression); result.setDeltaShadow(this.getDeltaShadow()); return result; } public URectangle(double width, double height) { - this(width, height, 0, 0, null); - } - - public URectangle(double width, double height, double rx, double ry) { - this(width, height, rx, ry, null); - } - - public URectangle(double width, double height, double rx, double ry, String comment) { - // if (height == 0) { - // throw new IllegalArgumentException(); - // } - if (width == 0) { - throw new IllegalArgumentException(); - } - this.comment = comment; - this.width = width; - this.height = height; - this.rx = rx; - this.ry = ry; + this(width, height, 0, 0, null, false); } public URectangle(Dimension2D dim) { this(dim.getWidth(), dim.getHeight()); } - public URectangle(Dimension2D dim, double rx, double ry) { - this(dim.getWidth(), dim.getHeight(), rx, ry); + private URectangle(double width, double height, double rx, double ry, String comment, + boolean ignoreForCompression) { + if (height == 0) { + throw new IllegalArgumentException("height=" + height); + } + if (width == 0) { + throw new IllegalArgumentException("width=" + width); + } + this.ignoreForCompression = ignoreForCompression; + this.comment = comment; + this.width = width; + this.height = height; + this.rx = rx; + this.ry = ry; } @Override @@ -130,14 +158,8 @@ public class URectangle extends AbstractShadowable implements Scalable, UShapeSi return comment; } - private boolean ignoreForCompression; - public final boolean isIgnoreForCompression() { return ignoreForCompression; } - public final void setIgnoreForCompression(boolean ignoreForCompression) { - this.ignoreForCompression = ignoreForCompression; - } - } diff --git a/src/net/sourceforge/plantuml/ugraphic/UTranslate.java b/src/net/sourceforge/plantuml/ugraphic/UTranslate.java index 61842245a..5a9d03fa1 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UTranslate.java +++ b/src/net/sourceforge/plantuml/ugraphic/UTranslate.java @@ -48,11 +48,23 @@ public class UTranslate implements UChange { return "translate dx=" + dx + " dy=" + dy; } + public static UTranslate none() { + return new UTranslate(0, 0); + } + public UTranslate(double dx, double dy) { this.dx = dx; this.dy = dy; } + public static UTranslate dx(double dx) { + return new UTranslate(dx, 0); + } + + public static UTranslate dy(double dy) { + return new UTranslate(0, dy); + } + public UTranslate(Point2D p) { this(p.getX(), p.getY()); } diff --git a/src/net/sourceforge/plantuml/ugraphic/ColorChangerMonochrome.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorChangerMonochrome.java similarity index 97% rename from src/net/sourceforge/plantuml/ugraphic/ColorChangerMonochrome.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorChangerMonochrome.java index e583cbb15..a44ffe10a 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ColorChangerMonochrome.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorChangerMonochrome.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.ugraphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; diff --git a/src/net/sourceforge/plantuml/ugraphic/ColorMapper.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapper.java similarity index 90% rename from src/net/sourceforge/plantuml/ugraphic/ColorMapper.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorMapper.java index 9fdb3df6f..05d581574 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ColorMapper.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapper.java @@ -33,13 +33,11 @@ * * */ -package net.sourceforge.plantuml.ugraphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; - public interface ColorMapper { - Color getMappedColor(HtmlColor color); + Color getMappedColor(HColor color); } diff --git a/src/net/sourceforge/plantuml/ugraphic/ColorMapperIdentity.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperIdentity.java similarity index 65% rename from src/net/sourceforge/plantuml/ugraphic/ColorMapperIdentity.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorMapperIdentity.java index bc999a9d3..0cac642a5 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ColorMapperIdentity.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperIdentity.java @@ -33,36 +33,31 @@ * * */ -package net.sourceforge.plantuml.ugraphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.graphic.HtmlColorMiddle; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; -import net.sourceforge.plantuml.graphic.HtmlColorUserDef; - public class ColorMapperIdentity implements ColorMapper { - public Color getMappedColor(HtmlColor color) { + public Color getMappedColor(HColor color) { if (color == null) { return null; } - if (color instanceof HtmlColorTransparent) { + if (color instanceof HColorBackground) { throw new UnsupportedOperationException(); } - if (color instanceof HtmlColorUserDef) { + if (color instanceof HColorUserDef) { // Impact on JCCKIT return Color.WHITE; } - if (color instanceof HtmlColorGradient) { - return getMappedColor(((HtmlColorGradient) color).getColor1()); + if (color instanceof HColorGradient) { + return getMappedColor(((HColorGradient) color).getColor1()); } - if (color instanceof HtmlColorMiddle) { - return ((HtmlColorMiddle) color).getMappedColor(this); + if (color instanceof HColorMiddle) { + return ((HColorMiddle) color).getMappedColor(this); } - return ((HtmlColorSimple) color).getColor999(); + // return ColorUtils.getReversed(((HColorSimple) color).getColor999()); + //return ColorOrder.RGB.getReverse(((HColorSimple) color).getColor999()); + return ((HColorSimple) color).getColor999(); } } diff --git a/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperLightnessInverse.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperLightnessInverse.java new file mode 100644 index 000000000..a56685a4a --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperLightnessInverse.java @@ -0,0 +1,63 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.ugraphic.color; + +import java.awt.Color; + +public class ColorMapperLightnessInverse implements ColorMapper { + + public Color getMappedColor(HColor color) { + if (color == null) { + return null; + } + if (color instanceof HColorBackground) { + throw new UnsupportedOperationException(); + } + if (color instanceof HColorUserDef) { + // Impact on JCCKIT + return Color.WHITE; + } + if (color instanceof HColorGradient) { + return getMappedColor(((HColorGradient) color).getColor1()); + } + if (color instanceof HColorMiddle) { + return ((HColorMiddle) color).getMappedColor(this); + } + return ColorUtils.getReversed(((HColorSimple) color).getColor999()); + //return ColorOrder.RGB.getReverse(((HColorSimple) color).getColor999()); + // return ((HColorSimple) color).getColor999(); + } +} diff --git a/src/net/sourceforge/plantuml/ugraphic/ColorMapperMonochrome.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperMonochrome.java similarity index 82% rename from src/net/sourceforge/plantuml/ugraphic/ColorMapperMonochrome.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorMapperMonochrome.java index 46e90673e..8a854d0f8 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ColorMapperMonochrome.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperMonochrome.java @@ -33,12 +33,10 @@ * * */ -package net.sourceforge.plantuml.ugraphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; - public class ColorMapperMonochrome implements ColorMapper { private final boolean reverse; @@ -47,15 +45,14 @@ public class ColorMapperMonochrome implements ColorMapper { this.reverse = reverse; } - public Color getMappedColor(HtmlColor htmlColor) { + public Color getMappedColor(HColor htmlColor) { if (htmlColor == null) { return null; } final Color color = new ColorMapperIdentity().getMappedColor(htmlColor); - int grayScale = (int) (color.getRed() * .3 + color.getGreen() * .59 + color.getBlue() * .11); if (reverse) { - grayScale = 255 - grayScale; + return ColorUtils.getGrayScaleColorReverse(color); } - return new Color(grayScale, grayScale, grayScale); + return ColorUtils.getGrayScaleColor(color); } } diff --git a/src/net/sourceforge/plantuml/ugraphic/ColorMapperReverse.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperReverse.java similarity index 78% rename from src/net/sourceforge/plantuml/ugraphic/ColorMapperReverse.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorMapperReverse.java index 28900bbc8..3426820b4 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ColorMapperReverse.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperReverse.java @@ -33,14 +33,10 @@ * * */ -package net.sourceforge.plantuml.ugraphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorMiddle; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; - public class ColorMapperReverse implements ColorMapper { private final ColorOrder order; @@ -49,14 +45,14 @@ public class ColorMapperReverse implements ColorMapper { this.order = order; } - public Color getMappedColor(HtmlColor color) { + public Color getMappedColor(HColor color) { if (color == null) { return null; } - if (color instanceof HtmlColorMiddle) { - return ((HtmlColorMiddle) color).getMappedColor(this); + if (color instanceof HColorMiddle) { + return ((HColorMiddle) color).getMappedColor(this); } - return getReverse(((HtmlColorSimple) color).getColor999()); + return getReverse(((HColorSimple) color).getColor999()); } private Color getReverse(Color color) { diff --git a/src/net/sourceforge/plantuml/ugraphic/ColorMapperTransparentWrapper.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperTransparentWrapper.java similarity index 85% rename from src/net/sourceforge/plantuml/ugraphic/ColorMapperTransparentWrapper.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorMapperTransparentWrapper.java index f01d4007a..165782988 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ColorMapperTransparentWrapper.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperTransparentWrapper.java @@ -33,13 +33,10 @@ * * */ -package net.sourceforge.plantuml.ugraphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; - public class ColorMapperTransparentWrapper implements ColorMapper { private final ColorMapper mapper; @@ -51,12 +48,12 @@ public class ColorMapperTransparentWrapper implements ColorMapper { this.mapper = mapper; } - public Color getMappedColor(HtmlColor color) { + public Color getMappedColor(HColor color) { if (color == null) { return null; } - if (color instanceof HtmlColorTransparent) { - return Color.WHITE; + if (color instanceof HColorBackground) { + return ((HColorBackground) color).getActualColor(mapper); } return mapper.getMappedColor(color); } diff --git a/src/net/sourceforge/plantuml/ugraphic/ColorOrder.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorOrder.java similarity index 97% rename from src/net/sourceforge/plantuml/ugraphic/ColorOrder.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorOrder.java index 349e323f6..4a6342d1c 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ColorOrder.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorOrder.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.ugraphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; diff --git a/src/net/sourceforge/plantuml/ugraphic/color/ColorUtils.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorUtils.java new file mode 100644 index 000000000..a3384df7e --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorUtils.java @@ -0,0 +1,108 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.ugraphic.color; + +import java.awt.Color; + +public class ColorUtils { + + static int getGrayScale(Color color) { + final int grayScale = (int) (color.getRed() * .3 + color.getGreen() * .59 + color.getBlue() * .11); + return grayScale; + } + + public static Color getGrayScaleColor(Color color) { + final int grayScale = getGrayScale(color); + return new Color(grayScale, grayScale, grayScale); + } + + public static Color getGrayScaleColorReverse(Color color) { + final int grayScale = 255 - getGrayScale(color); + return new Color(grayScale, grayScale, grayScale); + } + + /* + * This code is still experimental. If you can improve it, please go ahead :-) + * + * Many thanks to Alexei Boronine for the idea. + * + * Some pointer to help you: https://www.hsluv.org/ + * https://www.kuon.ch/post/2020-03-08-hsluv/ + * https://www.boronine.com/2012/03/26/Color-Spaces-for-Human-Beings/ + * + */ + public static synchronized Color getReversed(Color color) { + final int red = color.getRed(); + final int green = color.getGreen(); + final int blue = color.getBlue(); + + final double hsluv[] = HUSLColorConverter.rgbToHsluv(new double[] { red / 256.0, green / 256.0, blue / 256.0 }); + + final double h = hsluv[0]; + final double s = hsluv[1]; + double l = hsluv[2]; + + if (s > 40 && s < 60) { + if (l > 50) { + l -= 50; + } else if (l < 50) { + l += 50; + } + } else { + l = 100 - l; + } + + final double rgb[] = HUSLColorConverter.hsluvToRgb(new double[] { h, s, l }); + + final int red2 = to255(rgb[0]); + final int green2 = to255(rgb[1]); + final int blue2 = to255(rgb[2]); + + return new Color(red2, green2, blue2); + } + + private static int to255(final double value) { + final int result = (int) (255 * value); + if (result < 0) { + return 0; + } + if (result > 255) { + return 255; + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColor.java b/src/net/sourceforge/plantuml/ugraphic/color/HColor.java similarity index 94% rename from src/net/sourceforge/plantuml/graphic/HtmlColor.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColor.java index 5ba9bb5bf..053071318 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColor.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColor.java @@ -33,10 +33,10 @@ * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; -public interface HtmlColor { +public interface HColor { } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorAutomatic.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorAutomatic.java similarity index 92% rename from src/net/sourceforge/plantuml/graphic/HtmlColorAutomatic.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorAutomatic.java index 69e9b61da..6f00f25a4 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorAutomatic.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorAutomatic.java @@ -32,8 +32,8 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; -public class HtmlColorAutomatic implements HtmlColor { +public class HColorAutomatic implements HColor { } diff --git a/src/net/sourceforge/plantuml/graphic/IHtmlColorSet.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorBackground.java similarity index 68% rename from src/net/sourceforge/plantuml/graphic/IHtmlColorSet.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorBackground.java index fd64ad201..821b6cef0 100644 --- a/src/net/sourceforge/plantuml/graphic/IHtmlColorSet.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorBackground.java @@ -30,19 +30,36 @@ * * * Original Author: Arnaud Roques - * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; -import java.util.Collection; +import java.awt.Color; -public interface IHtmlColorSet { +import net.sourceforge.plantuml.StringUtils; - public Collection names(); +public class HColorBackground implements HColor { - public HtmlColor getColorIfValid(String s); + private final HColor back; - public HtmlColor getColorIfValid(String s, boolean acceptTransparent); + public HColorBackground(HColor back) { + if (back == null) { + throw new IllegalArgumentException(); + } + this.back = back; + + } + + public String getSvg(ColorMapper mapper) { + return StringUtils.getAsHtml(((HColorSimple) back).getColor999()); + } + + public HColor getNull() { + return null; + } + + public Color getActualColor(ColorMapper mapper) { + return mapper.getMappedColor(back); + } } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorGradient.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorGradient.java similarity index 79% rename from src/net/sourceforge/plantuml/graphic/HtmlColorGradient.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorGradient.java index e8e50f47f..ec53b7ed7 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorGradient.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorGradient.java @@ -32,38 +32,36 @@ * Original Author: Arnaud Roques * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +public class HColorGradient implements HColor { -public class HtmlColorGradient implements HtmlColor { - - private final HtmlColor color1; - private final HtmlColor color2; + private final HColor color1; + private final HColor color2; private final char policy; - public HtmlColorGradient(HtmlColor color1, HtmlColor color2, char policy) { + public HColorGradient(HColor color1, HColor color2, char policy) { if (color1 == null || color2 == null) { throw new IllegalArgumentException(); } - if (color1 instanceof HtmlColorGradient) { - color1 = ((HtmlColorGradient) color1).color1; + if (color1 instanceof HColorGradient) { + color1 = ((HColorGradient) color1).color1; } - if (color2 instanceof HtmlColorGradient) { - color2 = ((HtmlColorGradient) color2).color2; + if (color2 instanceof HColorGradient) { + color2 = ((HColorGradient) color2).color2; } this.color1 = color1; this.color2 = color2; this.policy = policy; } - public final HtmlColor getColor1() { + public final HColor getColor1() { return color1; } - public final HtmlColor getColor2() { + public final HColor getColor2() { return color2; } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorMiddle.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorMiddle.java similarity index 87% rename from src/net/sourceforge/plantuml/graphic/HtmlColorMiddle.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorMiddle.java index 27b386821..ef62955ea 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorMiddle.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorMiddle.java @@ -33,18 +33,16 @@ * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +public class HColorMiddle implements HColor { -public class HtmlColorMiddle implements HtmlColor { + private final HColor c1; + private final HColor c2; - private final HtmlColor c1; - private final HtmlColor c2; - - public HtmlColorMiddle(HtmlColor c1, HtmlColor c2) { + public HColorMiddle(HColor c1, HColor c2) { this.c1 = c1; this.c2 = c2; } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorSet.java similarity index 89% rename from src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorSet.java index a798a17bd..fd8605aa3 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorSet.java @@ -33,7 +33,7 @@ * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; import java.util.Collection; @@ -47,46 +47,24 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; -public class HtmlColorSetSimple implements IHtmlColorSet { +public class HColorSet { - private final Map htmlNames; - private final Set names; + private final static HColorSet singleton = new HColorSet(); + + private final Map htmlNames = new HashMap(); + private final Set names = new TreeSet(); + + public static HColorSet instance() { + return singleton; + } public Collection names() { return Collections.unmodifiableSet(names); } - public HtmlColor getColorIfValid(String s) { - return getColorIfValid(s, false); - } - - public HtmlColor getColorIfValid(String s, boolean acceptTransparent) { - if (s == null) { - return null; - } - final Matcher2 m = MyPattern.cmpile("[-\\\\|/]").matcher(s); - if (m.find()) { - final char sep = m.group(0).charAt(0); - final int idx = s.indexOf(sep); - final String s1 = s.substring(0, idx); - final String s2 = s.substring(idx + 1); - if (isValid(s1, false) == false || isValid(s2, false) == false) { - return null; - } - return new HtmlColorGradient(build(s1), build(s2), sep); - // return getColorIfValid(s2); - } - if (isValid(s, acceptTransparent) == false) { - return new HtmlColorUserDef(); - } - return build(s); - } - - public HtmlColorSetSimple() { + private HColorSet() { // Taken from http://perl.wikipedia.com/wiki/Named_colors ? // http://www.w3schools.com/HTML/html_colornames.asp - htmlNames = new HashMap(); - names = new TreeSet(); register("AliceBlue", "#F0F8FF"); register("AntiqueWhite", "#FAEBD7"); register("Aqua", "#00FFFF"); @@ -249,14 +227,43 @@ public class HtmlColorSetSimple implements IHtmlColorSet { names.add(s); } - private HtmlColor build(String s) { + public HColor getColorIfValid(String s) { + return getColorIfValid(s, null); + } + + public HColor getColorIfValid(String s, HColor background) { + if (s == null) { + return null; + } + final boolean acceptTransparent = background != null; + if (acceptTransparent && background == null) { + throw new IllegalArgumentException(); + } + final Matcher2 m = MyPattern.cmpile("[-\\\\|/]").matcher(s); + if (m.find()) { + final char sep = m.group(0).charAt(0); + final int idx = s.indexOf(sep); + final String s1 = s.substring(0, idx); + final String s2 = s.substring(idx + 1); + if (isValid(s1, false) == false || isValid(s2, false) == false) { + return null; + } + return new HColorGradient(build(s1, background), build(s2, background), sep); + } + if (isValid(s, acceptTransparent) == false) { + return new HColorUserDef(); + } + return build(s, background); + } + + private HColor build(String s, HColor background) { s = removeFirstDieseAndgoLowerCase(s); final Color color; - if (s.equalsIgnoreCase("transparent")) { - return new HtmlColorTransparent(); + if (s.equalsIgnoreCase("transparent") || s.equalsIgnoreCase("background")) { + return new HColorBackground(background); } else if (s.equalsIgnoreCase("automatic")) { - return new HtmlColorAutomatic(); + return new HColorAutomatic(); } else if (s.matches("[0-9A-Fa-f]{3}")) { s = "" + s.charAt(0) + s.charAt(0) + s.charAt(1) + s.charAt(1) + s.charAt(2) + s.charAt(2); color = new Color(Integer.parseInt(s, 16)); @@ -269,7 +276,7 @@ public class HtmlColorSetSimple implements IHtmlColorSet { } color = new Color(Integer.parseInt(value.substring(1), 16)); } - return new HtmlColorSimple(color, false); + return new HColorSimple(color, false); } private boolean isValid(String s, boolean acceptTransparent) { diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorSimple.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorSimple.java similarity index 77% rename from src/net/sourceforge/plantuml/graphic/HtmlColorSimple.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorSimple.java index b05a8381a..cac4d78c1 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorSimple.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorSimple.java @@ -33,13 +33,11 @@ * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; import java.awt.Color; -import net.sourceforge.plantuml.ugraphic.ColorChangerMonochrome; - -public class HtmlColorSimple implements HtmlColor { +public class HColorSimple implements HColor { private final Color color; private final boolean monochrome; @@ -51,13 +49,13 @@ public class HtmlColorSimple implements HtmlColor { @Override public boolean equals(Object other) { - if (other instanceof HtmlColorSimple == false) { + if (other instanceof HColorSimple == false) { return false; } - return this.color.equals(((HtmlColorSimple) other).color); + return this.color.equals(((HColorSimple) other).color); } - public HtmlColorSimple(Color c, boolean monochrome) { + public HColorSimple(Color c, boolean monochrome) { this.color = c; this.monochrome = monochrome; } @@ -66,20 +64,20 @@ public class HtmlColorSimple implements HtmlColor { return color; } - public HtmlColorSimple asMonochrome() { + public HColorSimple asMonochrome() { if (monochrome) { throw new IllegalStateException(); } - return new HtmlColorSimple(new ColorChangerMonochrome().getChangedColor(color), true); + return new HColorSimple(new ColorChangerMonochrome().getChangedColor(color), true); } - public HtmlColorSimple opposite() { + public HColorSimple opposite() { final Color mono = new ColorChangerMonochrome().getChangedColor(color); final int grayScale = 255 - mono.getGreen() > 127 ? 255 : 0; - return new HtmlColorSimple(new Color(grayScale, grayScale, grayScale), true); + return new HColorSimple(new Color(grayScale, grayScale, grayScale), true); } - public double distance(HtmlColorSimple other) { + public double distance(HColorSimple other) { final int diffRed = Math.abs(this.color.getRed() - other.color.getRed()); final int diffGreen = Math.abs(this.color.getGreen() - other.color.getGreen()); final int diffBlue = Math.abs(this.color.getBlue() - other.color.getBlue()); diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorUserDef.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorUserDef.java similarity index 92% rename from src/net/sourceforge/plantuml/graphic/HtmlColorUserDef.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorUserDef.java index 42026fdb3..5881fd2d7 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorUserDef.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorUserDef.java @@ -33,8 +33,8 @@ * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; -public class HtmlColorUserDef implements HtmlColor { +public class HColorUserDef implements HColor { } diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorUtils.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorUtils.java similarity index 62% rename from src/net/sourceforge/plantuml/graphic/HtmlColorUtils.java rename to src/net/sourceforge/plantuml/ugraphic/color/HColorUtils.java index 02c568845..fa92a8cf3 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorUtils.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorUtils.java @@ -33,48 +33,48 @@ * * */ -package net.sourceforge.plantuml.graphic; +package net.sourceforge.plantuml.ugraphic.color; -public class HtmlColorUtils { +public class HColorUtils { - public static final HtmlColor BLACK; - public static final HtmlColor WHITE; - public static final HtmlColor RED_LIGHT; - public static final HtmlColor RED_DARK; - public static final HtmlColor RED; - public static final HtmlColor GREEN; - public static final HtmlColor BLUE; - public static final HtmlColor GRAY; - public static final HtmlColor LIGHT_GRAY; - public static final HtmlColor MY_YELLOW; - public static final HtmlColor MY_RED; - public static final HtmlColor MY_GREEN; + public static final HColor BLACK; + public static final HColor WHITE; + public static final HColor RED_LIGHT; + public static final HColor RED_DARK; + public static final HColor RED; + public static final HColor GREEN; + public static final HColor BLUE; + public static final HColor GRAY; + public static final HColor LIGHT_GRAY; + public static final HColor MY_YELLOW; + public static final HColor MY_RED; + public static final HColor MY_GREEN; - public static final HtmlColor COL_C82930; - public static final HtmlColor COL_F24D5C; - public static final HtmlColor COL_1963A0; - public static final HtmlColor COL_4177AF; - public static final HtmlColor COL_B38D22; - public static final HtmlColor COL_FFFF44; - public static final HtmlColor COL_038048; - public static final HtmlColor COL_84BE84; - public static final HtmlColor COL_DDDDDD; - public static final HtmlColor COL_EEEEEE; - public static final HtmlColor COL_FBFB77; - public static final HtmlColor COL_ADD1B2; - public static final HtmlColor COL_A9DCDF; - public static final HtmlColor COL_E3664A; - public static final HtmlColor COL_EB937F; - public static final HtmlColor COL_B4A7E5; - public static final HtmlColor COL_527BC6; - public static final HtmlColor COL_D1DBEF; - public static final HtmlColor COL_D7E0F2; - public static final HtmlColor COL_989898; - public static final HtmlColor COL_BBBBBB; + public static final HColor COL_C82930; + public static final HColor COL_F24D5C; + public static final HColor COL_1963A0; + public static final HColor COL_4177AF; + public static final HColor COL_B38D22; + public static final HColor COL_FFFF44; + public static final HColor COL_038048; + public static final HColor COL_84BE84; + public static final HColor COL_DDDDDD; + public static final HColor COL_EEEEEE; + public static final HColor COL_FBFB77; + public static final HColor COL_ADD1B2; + public static final HColor COL_A9DCDF; + public static final HColor COL_E3664A; + public static final HColor COL_EB937F; + public static final HColor COL_B4A7E5; + public static final HColor COL_527BC6; + public static final HColor COL_D1DBEF; + public static final HColor COL_D7E0F2; + public static final HColor COL_989898; + public static final HColor COL_BBBBBB; static { - final IHtmlColorSet set = new HtmlColorSetSimple(); + final HColorSet set = HColorSet.instance(); BLACK = set.getColorIfValid("black"); WHITE = set.getColorIfValid("white"); @@ -113,9 +113,9 @@ public class HtmlColorUtils { } - public static HtmlColor noGradient(HtmlColor color) { - if (color instanceof HtmlColorGradient) { - return ((HtmlColorGradient) color).getColor1(); + public static HColor noGradient(HColor color) { + if (color instanceof HColorGradient) { + return ((HColorGradient) color).getColor1(); } return color; } diff --git a/src/net/sourceforge/plantuml/ugraphic/color/HUSLColorConverter.java b/src/net/sourceforge/plantuml/ugraphic/color/HUSLColorConverter.java new file mode 100644 index 000000000..29f15c02b --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/color/HUSLColorConverter.java @@ -0,0 +1,402 @@ +package net.sourceforge.plantuml.ugraphic.color; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * Taken from + * https://github.com/hsluv/hsluv-java/blob/master/src/main/java/org/hsluv/HUSLColorConverter.java + * + * Some other pointer: + * https://twitter.com/kuon_orochi/ https://www.hsluv.org/ + * https://www.kuon.ch/post/2020-03-08-hsluv/ + * + * + * @author Alexei Boronine + * + */ +public class HUSLColorConverter { + private static double[][] m = new double[][] { + new double[] { 3.240969941904521, -1.537383177570093, -0.498610760293 }, + new double[] { -0.96924363628087, 1.87596750150772, 0.041555057407175 }, + new double[] { 0.055630079696993, -0.20397695888897, 1.056971514242878 }, }; + + private static double[][] minv = new double[][] { + new double[] { 0.41239079926595, 0.35758433938387, 0.18048078840183 }, + new double[] { 0.21263900587151, 0.71516867876775, 0.072192315360733 }, + new double[] { 0.019330818715591, 0.11919477979462, 0.95053215224966 }, }; + + private static double refY = 1.0; + + private static double refU = 0.19783000664283; + private static double refV = 0.46831999493879; + + private static double kappa = 903.2962962; + private static double epsilon = 0.0088564516; + + private static List getBounds(double L) { + ArrayList result = new ArrayList(); + + double sub1 = Math.pow(L + 16, 3) / 1560896; + double sub2 = sub1 > epsilon ? sub1 : L / kappa; + + for (int c = 0; c < 3; ++c) { + double m1 = m[c][0]; + double m2 = m[c][1]; + double m3 = m[c][2]; + + for (int t = 0; t < 2; ++t) { + double top1 = (284517 * m1 - 94839 * m3) * sub2; + double top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * L * sub2 - 769860 * t * L; + double bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t; + + result.add(new double[] { top1 / bottom, top2 / bottom }); + } + } + + return result; + } + + private static double intersectLineLine(double[] lineA, double[] lineB) { + return (lineA[1] - lineB[1]) / (lineB[0] - lineA[0]); + } + + private static double distanceFromPole(double[] point) { + return Math.sqrt(Math.pow(point[0], 2) + Math.pow(point[1], 2)); + } + + private static Length lengthOfRayUntilIntersect(double theta, double[] line) { + double length = line[1] / (Math.sin(theta) - line[0] * Math.cos(theta)); + + return new Length(length); + } + + private static class Length { + final boolean greaterEqualZero; + final double length; + + private Length(double length) { + this.greaterEqualZero = length >= 0; + this.length = length; + } + } + + private static double maxSafeChromaForL(double L) { + List bounds = getBounds(L); + double min = Double.MAX_VALUE; + + for (int i = 0; i < 2; ++i) { + double m1 = bounds.get(i)[0]; + double b1 = bounds.get(i)[1]; + double[] line = new double[] { m1, b1 }; + + double x = intersectLineLine(line, new double[] { -1 / m1, 0 }); + double length = distanceFromPole(new double[] { x, b1 + x * m1 }); + + min = Math.min(min, length); + } + + return min; + } + + private static double maxChromaForLH(double L, double H) { + double hrad = H / 360 * Math.PI * 2; + + List bounds = getBounds(L); + double min = Double.MAX_VALUE; + + for (double[] bound : bounds) { + Length length = lengthOfRayUntilIntersect(hrad, bound); + if (length.greaterEqualZero) { + min = Math.min(min, length.length); + } + } + + return min; + } + + private static double dotProduct(double[] a, double[] b) { + double sum = 0; + + for (int i = 0; i < a.length; ++i) { + sum += a[i] * b[i]; + } + + return sum; + } + + private static double round(double value, int places) { + double n = Math.pow(10, places); + + return Math.round(value * n) / n; + } + + private static double fromLinear(double c) { + if (c <= 0.0031308) { + return 12.92 * c; + } else { + return 1.055 * Math.pow(c, 1 / 2.4) - 0.055; + } + } + + private static double toLinear(double c) { + if (c > 0.04045) { + return Math.pow((c + 0.055) / (1 + 0.055), 2.4); + } else { + return c / 12.92; + } + } + + private static int[] rgbPrepare(double[] tuple) { + + int[] results = new int[tuple.length]; + + for (int i = 0; i < tuple.length; ++i) { + double chan = tuple[i]; + double rounded = round(chan, 3); + + if (rounded < -0.0001 || rounded > 1.0001) { + throw new IllegalArgumentException("Illegal rgb value: " + rounded); + } + + results[i] = (int) Math.round(rounded * 255); + } + + return results; + } + + public static double[] xyzToRgb(double[] tuple) { + return new double[] { fromLinear(dotProduct(m[0], tuple)), fromLinear(dotProduct(m[1], tuple)), + fromLinear(dotProduct(m[2], tuple)), }; + } + + public static double[] rgbToXyz(double[] tuple) { + double[] rgbl = new double[] { toLinear(tuple[0]), toLinear(tuple[1]), toLinear(tuple[2]), }; + + return new double[] { dotProduct(minv[0], rgbl), dotProduct(minv[1], rgbl), dotProduct(minv[2], rgbl), }; + } + + private static double yToL(double Y) { + if (Y <= epsilon) { + return (Y / refY) * kappa; + } else { + return 116 * Math.pow(Y / refY, 1.0 / 3.0) - 16; + } + } + + private static double lToY(double L) { + if (L <= 8) { + return refY * L / kappa; + } else { + return refY * Math.pow((L + 16) / 116, 3); + } + } + + public static double[] xyzToLuv(double[] tuple) { + double X = tuple[0]; + double Y = tuple[1]; + double Z = tuple[2]; + + double varU = (4 * X) / (X + (15 * Y) + (3 * Z)); + double varV = (9 * Y) / (X + (15 * Y) + (3 * Z)); + + double L = yToL(Y); + + if (L == 0) { + return new double[] { 0, 0, 0 }; + } + + double U = 13 * L * (varU - refU); + double V = 13 * L * (varV - refV); + + return new double[] { L, U, V }; + } + + public static double[] luvToXyz(double[] tuple) { + double L = tuple[0]; + double U = tuple[1]; + double V = tuple[2]; + + if (L == 0) { + return new double[] { 0, 0, 0 }; + } + + double varU = U / (13 * L) + refU; + double varV = V / (13 * L) + refV; + + double Y = lToY(L); + double X = 0 - (9 * Y * varU) / ((varU - 4) * varV - varU * varV); + double Z = (9 * Y - (15 * varV * Y) - (varV * X)) / (3 * varV); + + return new double[] { X, Y, Z }; + } + + public static double[] luvToLch(double[] tuple) { + double L = tuple[0]; + double U = tuple[1]; + double V = tuple[2]; + + double C = Math.sqrt(U * U + V * V); + double H; + + if (C < 0.00000001) { + H = 0; + } else { + double Hrad = Math.atan2(V, U); + + // pi to more digits than they provide it in the stdlib + H = (Hrad * 180.0) / 3.1415926535897932; + + if (H < 0) { + H = 360 + H; + } + } + + return new double[] { L, C, H }; + } + + public static double[] lchToLuv(double[] tuple) { + double L = tuple[0]; + double C = tuple[1]; + double H = tuple[2]; + + double Hrad = H / 360.0 * 2 * Math.PI; + double U = Math.cos(Hrad) * C; + double V = Math.sin(Hrad) * C; + + return new double[] { L, U, V }; + } + + public static double[] hsluvToLch(double[] tuple) { + double H = tuple[0]; + double S = tuple[1]; + double L = tuple[2]; + + if (L > 99.9999999) { + return new double[] { 100d, 0, H }; + } + + if (L < 0.00000001) { + return new double[] { 0, 0, H }; + } + + double max = maxChromaForLH(L, H); + double C = max / 100 * S; + + return new double[] { L, C, H }; + } + + public static double[] lchToHsluv(double[] tuple) { + double L = tuple[0]; + double C = tuple[1]; + double H = tuple[2]; + + if (L > 99.9999999) { + return new double[] { H, 0, 100 }; + } + + if (L < 0.00000001) { + return new double[] { H, 0, 0 }; + } + + double max = maxChromaForLH(L, H); + double S = C / max * 100; + + return new double[] { H, S, L }; + } + + public static double[] hpluvToLch(double[] tuple) { + double H = tuple[0]; + double S = tuple[1]; + double L = tuple[2]; + + if (L > 99.9999999) { + return new double[] { 100, 0, H }; + } + + if (L < 0.00000001) { + return new double[] { 0, 0, H }; + } + + double max = maxSafeChromaForL(L); + double C = max / 100 * S; + + return new double[] { L, C, H }; + } + + public static double[] lchToHpluv(double[] tuple) { + double L = tuple[0]; + double C = tuple[1]; + double H = tuple[2]; + + if (L > 99.9999999) { + return new double[] { H, 0, 100 }; + } + + if (L < 0.00000001) { + return new double[] { H, 0, 0 }; + } + + double max = maxSafeChromaForL(L); + double S = C / max * 100; + + return new double[] { H, S, L }; + } + + public static String rgbToHex(double[] tuple) { + int[] prepared = rgbPrepare(tuple); + + return String.format("#%02x%02x%02x", prepared[0], prepared[1], prepared[2]); + } + + public static double[] hexToRgb(String hex) { + return new double[] { Integer.parseInt(hex.substring(1, 3), 16) / 255.0, + Integer.parseInt(hex.substring(3, 5), 16) / 255.0, Integer.parseInt(hex.substring(5, 7), 16) / 255.0, }; + } + + public static double[] lchToRgb(double[] tuple) { + return xyzToRgb(luvToXyz(lchToLuv(tuple))); + } + + public static double[] rgbToLch(double[] tuple) { + return luvToLch(xyzToLuv(rgbToXyz(tuple))); + } + + // RGB <--> HUSL(p) + + public static double[] hsluvToRgb(double[] tuple) { + return lchToRgb(hsluvToLch(tuple)); + } + + public static double[] rgbToHsluv(double[] tuple) { + return lchToHsluv(rgbToLch(tuple)); + } + + public static double[] hpluvToRgb(double[] tuple) { + return lchToRgb(hpluvToLch(tuple)); + } + + public static double[] rgbToHpluv(double[] tuple) { + return lchToHpluv(rgbToLch(tuple)); + } + + // Hex + + public static String hsluvToHex(double[] tuple) { + return rgbToHex(hsluvToRgb(tuple)); + } + + public static String hpluvToHex(double[] tuple) { + return rgbToHex(hpluvToRgb(tuple)); + } + + public static double[] hexToHsluv(String s) { + return rgbToHsluv(hexToRgb(s)); + } + + public static double[] hexToHpluv(String s) { + return rgbToHpluv(hexToRgb(s)); + } + +} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/ugraphic/comp/SlotFinder.java b/src/net/sourceforge/plantuml/ugraphic/comp/SlotFinder.java index dbe70f99a..f2352a8fb 100644 --- a/src/net/sourceforge/plantuml/ugraphic/comp/SlotFinder.java +++ b/src/net/sourceforge/plantuml/ugraphic/comp/SlotFinder.java @@ -37,8 +37,6 @@ package net.sourceforge.plantuml.ugraphic.comp; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.TextLimitFinder; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -55,6 +53,8 @@ import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class SlotFinder implements UGraphic { diff --git a/src/net/sourceforge/plantuml/ugraphic/comp/SlotSet.java b/src/net/sourceforge/plantuml/ugraphic/comp/SlotSet.java index b133b1252..6f077b9c7 100644 --- a/src/net/sourceforge/plantuml/ugraphic/comp/SlotSet.java +++ b/src/net/sourceforge/plantuml/ugraphic/comp/SlotSet.java @@ -119,7 +119,7 @@ public class SlotSet implements Iterable { public void drawDebugX(UGraphic ug, double size) { for (Slot slot : all) { final URectangle rect = new URectangle(slot.getEnd() - slot.getStart(), size); - ug.apply(new UTranslate(slot.getStart(), 0)).draw(rect); + ug.apply(UTranslate.dx(slot.getStart())).draw(rect); } } diff --git a/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java b/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java index a45d5af97..ecab1aaf7 100644 --- a/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java +++ b/src/net/sourceforge/plantuml/ugraphic/crossing/UGraphicCrossing.java @@ -42,11 +42,8 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cute.Balloon; import net.sourceforge.plantuml.cute.CrossingSegment; import net.sourceforge.plantuml.geom.LineSegmentDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -54,6 +51,9 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class UGraphicCrossing implements UGraphic { @@ -72,7 +72,7 @@ public class UGraphicCrossing implements UGraphic { this.translate = translate; } - void drawNow(HtmlColor color) { + void drawNow(HColor color) { if (color == null) { segment.draw(ug); } else { @@ -172,14 +172,14 @@ public class UGraphicCrossing implements UGraphic { // } } for (Balloon b : balloons) { - b.drawU(ug.apply(new UChangeBackColor(HtmlColorUtils.GREEN)).apply(new UChangeColor(HtmlColorUtils.GREEN))); + b.drawU(ug.apply(new UChangeBackColor(HColorUtils.GREEN)).apply(new UChangeColor(HColorUtils.GREEN))); } for (Pending p : lines) { for (Balloon b : balloons) { List pts = new CrossingSegment(b, p.segment).intersection(); for (Point2D pt : pts) { final Balloon s2 = new Balloon(pt, 2); - s2.drawU(ug.apply(new UChangeBackColor(HtmlColorUtils.BLUE)).apply(new UChangeColor(HtmlColorUtils.BLUE))); + s2.drawU(ug.apply(new UChangeBackColor(HColorUtils.BLUE)).apply(new UChangeColor(HColorUtils.BLUE))); } } } diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverCenteredCharacterEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverCenteredCharacterEps.java index 5aa68892c..314203b36 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverCenteredCharacterEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverCenteredCharacterEps.java @@ -39,12 +39,12 @@ import java.awt.font.TextLayout; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UnusedSpace; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverCenteredCharacterEps implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverDotPathEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverDotPathEps.java index da77586cd..5807e4d3d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverDotPathEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverDotPathEps.java @@ -37,10 +37,10 @@ package net.sourceforge.plantuml.ugraphic.eps; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverDotPathEps implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverEllipseEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverEllipseEps.java index 6c91db12c..c28bbac6d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverEllipseEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverEllipseEps.java @@ -36,12 +36,12 @@ package net.sourceforge.plantuml.ugraphic.eps; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverEllipseEps implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverImageEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverImageEps.java index 200b36efd..4f8c86272 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverImageEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverImageEps.java @@ -36,12 +36,12 @@ package net.sourceforge.plantuml.ugraphic.eps; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverImageEps implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverLineEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverLineEps.java index c8794cab2..1303ed187 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverLineEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverLineEps.java @@ -38,12 +38,12 @@ import java.awt.geom.Line2D; import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverLineEps implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverPathEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverPathEps.java index 2e55750fd..d057b9316 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverPathEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverPathEps.java @@ -35,11 +35,11 @@ package net.sourceforge.plantuml.ugraphic.eps; import net.sourceforge.plantuml.eps.EpsGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverPathEps implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverPolygonEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverPolygonEps.java index b22283951..75f21386f 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverPolygonEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverPolygonEps.java @@ -37,15 +37,15 @@ package net.sourceforge.plantuml.ugraphic.eps; import java.awt.geom.Point2D; import net.sourceforge.plantuml.eps.EpsGraphics; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverPolygonEps implements UDriver { @@ -79,10 +79,10 @@ public class DriverPolygonEps implements UDriver { eps.epsPolygonShadow(shape.getDeltaShadow(), points); } - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { eps.setStrokeColor(mapper.getMappedColor(param.getColor())); - eps.epsPolygon((HtmlColorGradient) back, mapper, points); + eps.epsPolygon((HColorGradient) back, mapper, points); } else { eps.setFillColor(mapper.getMappedColor(back)); diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverRectangleEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverRectangleEps.java index 37ba91879..2e448088f 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverRectangleEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverRectangleEps.java @@ -37,15 +37,15 @@ package net.sourceforge.plantuml.ugraphic.eps; import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.eps.EpsGraphics; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverRectangleEps implements UDriver { @@ -82,10 +82,10 @@ public class DriverRectangleEps implements UDriver { eps.epsRectangleShadow(x, y, width, height, rx / 2, ry / 2, rect.getDeltaShadow()); } - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { eps.setStrokeColor(mapper.getMappedColor(param.getColor())); - eps.epsRectangle(x, y, width, height, rx / 2, ry / 2, (HtmlColorGradient) back, mapper); + eps.epsRectangle(x, y, width, height, rx / 2, ry / 2, (HColorGradient) back, mapper); } else { eps.setStrokeColor(mapper.getMappedColor(param.getColor())); eps.setFillColor(mapper.getMappedColor(param.getBackcolor())); diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java index 57b420ef3..252fa68e3 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/DriverTextEps.java @@ -49,11 +49,9 @@ import net.sourceforge.plantuml.eps.EpsGraphicsMacroAndText; import net.sourceforge.plantuml.eps.EpsStrategy; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; @@ -61,6 +59,8 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DriverTextEps implements UDriver { @@ -115,7 +115,7 @@ public class DriverTextEps implements UDriver { drawPathIterator(eps, x, y, getOutline(textLayout)); if (fontConfiguration.containsStyle(FontStyle.UNDERLINE)) { - final HtmlColor extended = fontConfiguration.getExtendedColor(); + final HColor extended = fontConfiguration.getExtendedColor(); if (extended != null) { eps.setStrokeColor(mapper.getMappedColor(extended)); } @@ -131,7 +131,7 @@ public class DriverTextEps implements UDriver { dim = getMinMax(x, y, getOutline(textLayout).getPathIterator(null)); } final int ypos = (int) (y + 2.5) - 1; - final HtmlColor extended = fontConfiguration.getExtendedColor(); + final HColor extended = fontConfiguration.getExtendedColor(); if (extended != null) { eps.setStrokeColor(mapper.getMappedColor(extended)); } @@ -143,7 +143,7 @@ public class DriverTextEps implements UDriver { eps.setStrokeWidth(1, 0, 0); } if (fontConfiguration.containsStyle(FontStyle.STRIKE)) { - final HtmlColor extended = fontConfiguration.getExtendedColor(); + final HColor extended = fontConfiguration.getExtendedColor(); if (extended != null) { eps.setStrokeColor(mapper.getMappedColor(extended)); } diff --git a/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java b/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java index 0feb7ae01..669ae5796 100644 --- a/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java +++ b/src/net/sourceforge/plantuml/ugraphic/eps/UGraphicEps.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic2; @@ -58,6 +57,7 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class UGraphicEps extends AbstractUGraphic implements ClipContainer, UGraphic2 { diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverCenteredCharacterG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverCenteredCharacterG2d.java index caba0383b..5a23bd244 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverCenteredCharacterG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverCenteredCharacterG2d.java @@ -38,12 +38,12 @@ package net.sourceforge.plantuml.ugraphic.g2d; import java.awt.Graphics2D; import net.sourceforge.plantuml.graphic.UnusedSpace; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverCenteredCharacterG2d implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverDotPathG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverDotPathG2d.java index 713b60c15..7648616ed 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverDotPathG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverDotPathG2d.java @@ -39,10 +39,10 @@ import java.awt.Graphics2D; import net.sourceforge.plantuml.EnsureVisible; import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverDotPathG2d implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverEllipseG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverEllipseG2d.java index c9b078050..e73ffb02b 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverEllipseG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverEllipseG2d.java @@ -43,13 +43,13 @@ import java.awt.geom.Arc2D; import java.awt.geom.Ellipse2D; import net.sourceforge.plantuml.EnsureVisible; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverEllipseG2d extends DriverShadowedG2d implements UDriver { @@ -66,7 +66,7 @@ public class DriverEllipseG2d extends DriverShadowedG2d implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java index 379ba701a..f844a9a03 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverLineG2d.java @@ -40,13 +40,13 @@ import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.Line2D; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DriverLineG2d extends DriverShadowedG2d implements UDriver { @@ -65,7 +65,7 @@ public class DriverLineG2d extends DriverShadowedG2d implements UDriver { @@ -96,7 +96,7 @@ public class DriverPathG2d extends DriverShadowedG2d implements UDriver { @@ -119,9 +119,9 @@ public class DriverPathG2dLegacy extends DriverShadowedG2d implements UDriver { @@ -119,9 +119,9 @@ public class DriverPathOldG2d extends DriverShadowedG2d implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java index 2bfa73e73..a53afe8ce 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPolygonG2d.java @@ -42,13 +42,13 @@ import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; import net.sourceforge.plantuml.EnsureVisible; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver { @@ -88,9 +88,9 @@ public class DriverPolygonG2d extends DriverShadowedG2d implements UDriver { @@ -87,9 +87,9 @@ public class DriverRectangleG2d extends DriverShadowedG2d implements UDriver { @@ -106,7 +106,7 @@ public class DriverTextAsPathG2d implements UDriver { g2d.translate(-x, -y); if (fontConfiguration.containsStyle(FontStyle.UNDERLINE)) { - final HtmlColor extended = fontConfiguration.getExtendedColor(); + final HColor extended = fontConfiguration.getExtendedColor(); if (extended != null) { g2d.setColor(mapper.getMappedColor(extended)); } @@ -119,7 +119,7 @@ public class DriverTextAsPathG2d implements UDriver { if (fontConfiguration.containsStyle(FontStyle.WAVE)) { final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(TikzFontDistortion.getDefault()), font, shape.getText()); final int ypos = (int) (y + 2.5) - 1; - final HtmlColor extended = fontConfiguration.getExtendedColor(); + final HColor extended = fontConfiguration.getExtendedColor(); if (extended != null) { g2d.setColor(mapper.getMappedColor(extended)); } @@ -132,7 +132,7 @@ public class DriverTextAsPathG2d implements UDriver { final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(TikzFontDistortion.getDefault()), font, shape.getText()); final FontMetrics fm = g2d.getFontMetrics(font.getFont()); final int ypos = (int) (y - fm.getDescent() - 0.5); - final HtmlColor extended = fontConfiguration.getExtendedColor(); + final HColor extended = fontConfiguration.getExtendedColor(); if (extended != null) { g2d.setColor(mapper.getMappedColor(extended)); } diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java index 795fa939a..670e3842d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverTextG2d.java @@ -51,15 +51,15 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.TikzFontDistortion; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverTextG2d implements UDriver { @@ -84,11 +84,11 @@ public class DriverTextG2d implements UDriver { final UFont font = fontConfiguration.getFont().scaled(param.getScale()); final Dimension2D dimBack = calculateDimension(FileFormat.PNG.getDefaultStringBounder(TikzFontDistortion.getDefault()), font, shape.getText()); - final HtmlColor extended = fontConfiguration.getExtendedColor(); + final HColor extended = fontConfiguration.getExtendedColor(); if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) { final Rectangle2D.Double area = new Rectangle2D.Double(x, y - dimBack.getHeight() + 1.5, dimBack.getWidth(), dimBack.getHeight()); - if (extended instanceof HtmlColorGradient) { + if (extended instanceof HColorGradient) { final GradientPaint paint = DriverRectangleG2d.getPaintGradient(x, y, mapper, dimBack.getWidth(), dimBack.getHeight(), extended); g2d.setPaint(paint); diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/UGraphicG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/UGraphicG2d.java index ff3422a16..fa0eca60d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/UGraphicG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/UGraphicG2d.java @@ -59,7 +59,6 @@ import net.sourceforge.plantuml.png.PngIO; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UAntiAliasing; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UChange; @@ -75,6 +74,7 @@ import net.sourceforge.plantuml.ugraphic.UPixel; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class UGraphicG2d extends AbstractUGraphic implements EnsureVisible, UGraphic2 { diff --git a/src/net/sourceforge/plantuml/ugraphic/hand/UGraphicHandwritten.java b/src/net/sourceforge/plantuml/ugraphic/hand/UGraphicHandwritten.java index 98355cc6b..c9cdf0bf8 100644 --- a/src/net/sourceforge/plantuml/ugraphic/hand/UGraphicHandwritten.java +++ b/src/net/sourceforge/plantuml/ugraphic/hand/UGraphicHandwritten.java @@ -39,7 +39,6 @@ import java.util.Random; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; public class UGraphicHandwritten implements UGraphic { diff --git a/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java b/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java index df8c6c77b..8a1768343 100644 --- a/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java +++ b/src/net/sourceforge/plantuml/ugraphic/html5/DriverLineHtml5.java @@ -38,12 +38,12 @@ import java.awt.geom.Line2D; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverLineHtml5 implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/html5/DriverNopHtml5.java b/src/net/sourceforge/plantuml/ugraphic/html5/DriverNopHtml5.java index 7ee50ed85..46b12cf64 100644 --- a/src/net/sourceforge/plantuml/ugraphic/html5/DriverNopHtml5.java +++ b/src/net/sourceforge/plantuml/ugraphic/html5/DriverNopHtml5.java @@ -34,10 +34,10 @@ */ package net.sourceforge.plantuml.ugraphic.html5; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverNopHtml5 implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java b/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java index 8c344e0ea..f0f928823 100644 --- a/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java +++ b/src/net/sourceforge/plantuml/ugraphic/html5/DriverRectangleHtml5.java @@ -37,15 +37,15 @@ package net.sourceforge.plantuml.ugraphic.html5; import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverRectangleHtml5 implements UDriver { @@ -78,8 +78,8 @@ public class DriverRectangleHtml5 implements UDriver { // eps.epsRectangleShadow(x, y, width, height, rx / 2, ry / 2, rect.getDeltaShadow()); // } - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { // eps.setStrokeColor(mapper.getMappedColor(param.getColor())); // eps.epsRectangle(x, y, width, height, rx / 2, ry / 2, (HtmlColorGradient) back, mapper); } else { diff --git a/src/net/sourceforge/plantuml/ugraphic/html5/UGraphicHtml5.java b/src/net/sourceforge/plantuml/ugraphic/html5/UGraphicHtml5.java index 572de7467..954ded16c 100644 --- a/src/net/sourceforge/plantuml/ugraphic/html5/UGraphicHtml5.java +++ b/src/net/sourceforge/plantuml/ugraphic/html5/UGraphicHtml5.java @@ -44,12 +44,12 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic2; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class UGraphicHtml5 extends AbstractUGraphic implements ClipContainer, UGraphic2 { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java index 1633fa878..f901f9beb 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverCenteredCharacterSvg.java @@ -40,12 +40,12 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UnusedSpace; import net.sourceforge.plantuml.svg.SvgGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverCenteredCharacterSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java index 85a66f8ae..b32a70ac8 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverDotPathSvg.java @@ -38,10 +38,10 @@ package net.sourceforge.plantuml.ugraphic.svg; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.svg.SvgGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverDotPathSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java index 5c4ada7bc..3c2767886 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java @@ -35,17 +35,17 @@ package net.sourceforge.plantuml.ugraphic.svg; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverEllipseSvg implements UDriver { @@ -70,13 +70,13 @@ public class DriverEllipseSvg implements UDriver { } } - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) back; + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) back; final String id = svg.createSvgGradient(StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor1())), StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor2())), gr.getPolicy()); svg.setFillColor("url(#" + id + ")"); - } else if (back == null || back instanceof HtmlColorTransparent) { + } else if (back == null || back instanceof HColorBackground) { svg.setFillColor("none"); } else { final String backcolor = StringUtils.getAsSvg(mapper, back); diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverImagePng.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverImagePng.java index 8a17f89cb..4d3c34972 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverImagePng.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverImagePng.java @@ -39,12 +39,12 @@ import java.io.IOException; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverImagePng implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverImageSvgSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverImageSvgSvg.java index 6a5c080b8..3fb95f158 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverImageSvgSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverImageSvgSvg.java @@ -35,11 +35,11 @@ package net.sourceforge.plantuml.ugraphic.svg; import net.sourceforge.plantuml.svg.SvgGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UImageSvg; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverImageSvgSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java index 6e3bcc4f4..b66e7819e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverLineSvg.java @@ -37,16 +37,16 @@ package net.sourceforge.plantuml.ugraphic.svg; import java.awt.geom.Line2D; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverLineSvg implements UDriver { @@ -79,9 +79,9 @@ public class DriverLineSvg implements UDriver { // svg.svgLineShadow(x, y, x2, y2, shape.getDeltaShadow()); // } - final HtmlColor color = param.getColor(); - if (color instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) color; + final HColor color = param.getColor(); + if (color instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) color; svg.setStrokeColor(StringUtils.getAsSvg(mapper, gr.getColor1())); } else { svg.setStrokeColor(StringUtils.getAsSvg(mapper, color)); diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverNoneSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverNoneSvg.java index 256afaca1..c9d3095ab 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverNoneSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverNoneSvg.java @@ -35,10 +35,10 @@ package net.sourceforge.plantuml.ugraphic.svg; import net.sourceforge.plantuml.svg.SvgGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverNoneSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java index 113957a68..5454964c9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverPathSvg.java @@ -35,16 +35,16 @@ package net.sourceforge.plantuml.ugraphic.svg; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.ugraphic.g2d.DriverShadowedG2d; public class DriverPathSvg extends DriverShadowedG2d implements UDriver { @@ -69,9 +69,9 @@ public class DriverPathSvg extends DriverShadowedG2d implements UDriver { @@ -69,9 +69,9 @@ public class DriverPolygonSvg implements UDriver { } final String color = StringUtils.getAsSvg(mapper, param.getColor()); - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) back; + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) back; final String id = svg.createSvgGradient(StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor1())), StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor2())), gr.getPolicy()); svg.setFillColor("url(#" + id + ")"); diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java index 667ac9fbc..b0dacfe0a 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverRectangleSvg.java @@ -37,16 +37,16 @@ package net.sourceforge.plantuml.ugraphic.svg; import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverRectangleSvg implements UDriver { @@ -64,9 +64,9 @@ public class DriverRectangleSvg implements UDriver { double width = rect.getWidth(); double height = rect.getHeight(); - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) back; + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) back; final String id = svg.createSvgGradient(StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor1())), StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor2())), gr.getPolicy()); svg.setFillColor("url(#" + id + ")"); @@ -94,9 +94,9 @@ public class DriverRectangleSvg implements UDriver { } public static void applyColor(SvgGraphics svg, ColorMapper mapper, UParam param) { - final HtmlColor color = param.getColor(); - if (color instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) color; + final HColor color = param.getColor(); + if (color instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) color; final String id = svg.createSvgGradient(StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor1())), StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor2())), gr.getPolicy()); svg.setStrokeColor("url(#" + id + ")"); diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextAsPathSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextAsPathSvg.java index 84996f9e7..105ed534d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextAsPathSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextAsPathSvg.java @@ -41,13 +41,13 @@ import java.awt.geom.PathIterator; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverTextAsPathSvg implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java index 6b30e9611..c59c905ba 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java @@ -39,12 +39,9 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; @@ -52,6 +49,9 @@ import net.sourceforge.plantuml.ugraphic.UFontContext; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverTextSvg implements UDriver { @@ -103,9 +103,9 @@ public class DriverTextSvg implements UDriver { final double width = dim.getWidth(); final double height = dim.getHeight(); if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) { - final HtmlColor back = fontConfiguration.getExtendedColor(); - if (back instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) back; + final HColor back = fontConfiguration.getExtendedColor(); + if (back instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) back; final String id = svg.createSvgGradient(StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor1())), StringUtils.getAsHtml(mapper.getMappedColor(gr.getColor2())), gr.getPolicy()); svg.setFillColor("url(#" + id + ")"); diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java index 97aebdc93..51231eafa 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java @@ -43,7 +43,6 @@ import javax.xml.transform.TransformerException; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.TikzFontDistortion; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.posimo.DotPath; @@ -51,7 +50,6 @@ import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UEllipse; @@ -63,6 +61,8 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class UGraphicSvg extends AbstractUGraphic implements ClipContainer, UGraphic2 { @@ -99,7 +99,7 @@ public class UGraphicSvg extends AbstractUGraphic implements ClipCo textAsPath, linkTarget); } - public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper mapper, HtmlColorGradient gr, + public UGraphicSvg(boolean svgDimensionStyle, Dimension2D minDim, ColorMapper mapper, HColorGradient gr, boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio) { this(minDim, mapper, new SvgGraphics(svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio), textAsPath, linkTarget); diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverAtomTextTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverAtomTextTikz.java index 1fcd03a93..5fda236e5 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverAtomTextTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverAtomTextTikz.java @@ -34,16 +34,16 @@ */ package net.sourceforge.plantuml.ugraphic.tikz; -import net.sourceforge.plantuml.creole.AtomText; +import net.sourceforge.plantuml.creole.atom.AtomText; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DriverAtomTextTikz implements UDriver { @@ -51,7 +51,7 @@ public class DriverAtomTextTikz implements UDriver { final AtomText text = (AtomText) shape; final FontConfiguration fontConfiguration = text.getFontConfiguration(); final UFont font = fontConfiguration.getFont(); - final HtmlColor col = fontConfiguration.getColor(); + final HColor col = fontConfiguration.getColor(); tikz.setStrokeColor(mapper.getMappedColor(col)); final boolean underline = fontConfiguration.containsStyle(FontStyle.UNDERLINE); final boolean italic = font.isItalic(); diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz.java index a27f144b0..051d08925 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz.java @@ -39,12 +39,12 @@ import java.awt.font.TextLayout; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UnusedSpace; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverCenteredCharacterTikz implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz2.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz2.java index 76cbf41e7..9f6fdb513 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz2.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverCenteredCharacterTikz2.java @@ -35,11 +35,11 @@ package net.sourceforge.plantuml.ugraphic.tikz; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverCenteredCharacterTikz2 implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverDotPathTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverDotPathTikz.java index a3ad4861d..18ebe7af0 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverDotPathTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverDotPathTikz.java @@ -36,10 +36,10 @@ package net.sourceforge.plantuml.ugraphic.tikz; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverDotPathTikz implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverEllipseTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverEllipseTikz.java index be8948ac1..75a604e66 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverEllipseTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverEllipseTikz.java @@ -35,11 +35,11 @@ package net.sourceforge.plantuml.ugraphic.tikz; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverEllipseTikz implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverImageTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverImageTikz.java index 5ee37cedf..3916c10a4 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverImageTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverImageTikz.java @@ -35,11 +35,11 @@ package net.sourceforge.plantuml.ugraphic.tikz; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverImageTikz implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverLineTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverLineTikz.java index fc90b589a..1752023e7 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverLineTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverLineTikz.java @@ -35,11 +35,11 @@ package net.sourceforge.plantuml.ugraphic.tikz; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverLineTikz implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverNoneTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverNoneTikz.java index b51554a03..63435a6fe 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverNoneTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverNoneTikz.java @@ -35,10 +35,10 @@ package net.sourceforge.plantuml.ugraphic.tikz; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverNoneTikz implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverPolygonTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverPolygonTikz.java index 83eb9e75e..7e6fd0b0a 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverPolygonTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverPolygonTikz.java @@ -36,14 +36,14 @@ package net.sourceforge.plantuml.ugraphic.tikz; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverPolygonTikz implements UDriver { @@ -51,9 +51,9 @@ public class DriverPolygonTikz implements UDriver { final UPolygon poly = (UPolygon) shape; final double points[] = poly.getPointArray(x, y); - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) back; + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) back; final Color color1 = mapper.getMappedColor(gr.getColor1()); final Color color2 = mapper.getMappedColor(gr.getColor2()); tikz.setGradientColor(color1, color2, gr.getPolicy()); diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverRectangleTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverRectangleTikz.java index 9f3c19c08..40c995f5e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverRectangleTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverRectangleTikz.java @@ -36,14 +36,14 @@ package net.sourceforge.plantuml.ugraphic.tikz; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.utils.MathUtils; public class DriverRectangleTikz implements UDriver { @@ -55,9 +55,9 @@ public class DriverRectangleTikz implements UDriver { final double height = rect.getHeight(); final double r = MathUtils.min(rect.getRx(), rect.getRy(), width / 2, height / 2); - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) back; + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) back; final Color color1 = mapper.getMappedColor(gr.getColor1()); final Color color2 = mapper.getMappedColor(gr.getColor2()); tikz.setGradientColor(color1, color2, gr.getPolicy()); diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUPathTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUPathTikz.java index ffe814353..2d4d48b3a 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUPathTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUPathTikz.java @@ -36,22 +36,22 @@ package net.sourceforge.plantuml.ugraphic.tikz; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; public class DriverUPathTikz implements UDriver { public void draw(UShape shape, double x, double y, ColorMapper mapper, UParam param, TikzGraphics tikz) { final UPath path = (UPath) shape; - final HtmlColor back = param.getBackcolor(); - if (back instanceof HtmlColorGradient) { - final HtmlColorGradient gr = (HtmlColorGradient) back; + final HColor back = param.getBackcolor(); + if (back instanceof HColorGradient) { + final HColorGradient gr = (HColorGradient) back; final Color color1 = mapper.getMappedColor(gr.getColor1()); final Color color2 = mapper.getMappedColor(gr.getColor2()); tikz.setGradientColor(color1, color2, gr.getPolicy()); diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUTextTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUTextTikz.java index 5d3353f5a..fc4842522 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUTextTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/DriverUTextTikz.java @@ -36,14 +36,14 @@ package net.sourceforge.plantuml.ugraphic.tikz; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.tikz.TikzGraphics; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DriverUTextTikz implements UDriver { @@ -51,7 +51,7 @@ public class DriverUTextTikz implements UDriver { final UText shape = (UText) ushape; final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final UFont font = fontConfiguration.getFont(); - final HtmlColor col = fontConfiguration.getColor(); + final HColor col = fontConfiguration.getColor(); tikz.setStrokeColor(mapper.getMappedColor(col)); final boolean underline = fontConfiguration.containsStyle(FontStyle.UNDERLINE); final boolean italic = font.isItalic(); diff --git a/src/net/sourceforge/plantuml/ugraphic/tikz/UGraphicTikz.java b/src/net/sourceforge/plantuml/ugraphic/tikz/UGraphicTikz.java index 79a039bd9..ddf12f054 100644 --- a/src/net/sourceforge/plantuml/ugraphic/tikz/UGraphicTikz.java +++ b/src/net/sourceforge/plantuml/ugraphic/tikz/UGraphicTikz.java @@ -40,14 +40,13 @@ import java.io.OutputStream; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.TikzFontDistortion; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.creole.AtomText; +import net.sourceforge.plantuml.creole.atom.AtomText; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.tikz.TikzGraphics; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic2; @@ -58,6 +57,7 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class UGraphicTikz extends AbstractUGraphic implements ClipContainer, UGraphic2 { diff --git a/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java b/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java index 5711b0bf0..97944ffa9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java +++ b/src/net/sourceforge/plantuml/ugraphic/txt/UGraphicTxt.java @@ -49,11 +49,11 @@ import net.sourceforge.plantuml.graphic.FontStyle; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UGraphic2; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class UGraphicTxt extends AbstractCommonUGraphic implements ClipContainer, UGraphic2 { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/DriverDotPathVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/DriverDotPathVdx.java index f7ccebeeb..5f0b0aee9 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/DriverDotPathVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/DriverDotPathVdx.java @@ -35,10 +35,10 @@ package net.sourceforge.plantuml.ugraphic.visio; import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverDotPathVdx implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/DriverLineVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/DriverLineVdx.java index 084c8579a..e7a529555 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/DriverLineVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/DriverLineVdx.java @@ -34,11 +34,11 @@ */ package net.sourceforge.plantuml.ugraphic.visio; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverLineVdx implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/DriverNoneVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/DriverNoneVdx.java index d15662c37..28bd8d340 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/DriverNoneVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/DriverNoneVdx.java @@ -34,10 +34,10 @@ */ package net.sourceforge.plantuml.ugraphic.visio; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverNoneVdx implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/DriverPolygonVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/DriverPolygonVdx.java index a5c239da6..24ddd4223 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/DriverPolygonVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/DriverPolygonVdx.java @@ -34,11 +34,11 @@ */ package net.sourceforge.plantuml.ugraphic.visio; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverPolygonVdx implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/DriverRectangleVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/DriverRectangleVdx.java index 05642416c..c3bb4486b 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/DriverRectangleVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/DriverRectangleVdx.java @@ -34,11 +34,11 @@ */ package net.sourceforge.plantuml.ugraphic.visio; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverRectangleVdx implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/DriverTextVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/DriverTextVdx.java index 551c767f6..21f8a6b1a 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/DriverTextVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/DriverTextVdx.java @@ -39,13 +39,13 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFontContext; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverTextVdx implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/DriverUPathVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/DriverUPathVdx.java index 34066a25e..9e74e6230 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/DriverUPathVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/DriverUPathVdx.java @@ -34,11 +34,11 @@ */ package net.sourceforge.plantuml.ugraphic.visio; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverUPathVdx implements UDriver { diff --git a/src/net/sourceforge/plantuml/ugraphic/visio/UGraphicVdx.java b/src/net/sourceforge/plantuml/ugraphic/visio/UGraphicVdx.java index 084cf5917..19288d29e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/visio/UGraphicVdx.java +++ b/src/net/sourceforge/plantuml/ugraphic/visio/UGraphicVdx.java @@ -40,13 +40,12 @@ import java.io.OutputStream; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.TikzFontDistortion; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.creole.AtomText; +import net.sourceforge.plantuml.creole.atom.AtomText; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic2; @@ -57,6 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class UGraphicVdx extends AbstractUGraphic implements ClipContainer, UGraphic2 { diff --git a/src/net/sourceforge/plantuml/utils/Cypher.java b/src/net/sourceforge/plantuml/utils/Cypher.java index a3d28100f..6df2ea0c0 100644 --- a/src/net/sourceforge/plantuml/utils/Cypher.java +++ b/src/net/sourceforge/plantuml/utils/Cypher.java @@ -66,7 +66,7 @@ public class Cypher { private String changeWord(final String word) { final String lower = word.toLowerCase(); - if (except.contains(lower) || lower.matches("^[a-f0-9]{6}$")) { + if (except.contains(lower) || lower.matches("^([a-f0-9]{3}|[a-f0-9]{6})$")) { return word; } String res = convert.get(word); diff --git a/src/net/sourceforge/plantuml/version/License.java b/src/net/sourceforge/plantuml/version/License.java index 1bcf162e7..3cbbf9f14 100644 --- a/src/net/sourceforge/plantuml/version/License.java +++ b/src/net/sourceforge/plantuml/version/License.java @@ -305,6 +305,32 @@ public enum License { text.add(" "); text.add("Project Info: http://plantuml.com"); text.add(" "); + text.add(" CoronaVirus License :"); + text.add(" "); + text.add(" The coronavirus is coming to you."); + text.add(" It’s coming at an exponential speed: gradually, and then suddenly."); + text.add(" It’s a matter of days. Maybe a week or two."); + text.add(" When it does, your healthcare system will be overwhelmed."); + text.add(" Your fellow citizens will be treated in the hallways."); + text.add(" Exhausted healthcare workers will break down. Some will die."); + text.add(" They will have to decide which patient gets the oxygen and which one dies."); + text.add(" The only way to prevent this is social distancing today. Not tomorrow. Today."); + text.add(" That means keeping as many people home as possible, starting now."); + text.add(" "); + text.add(" To use this program, you must"); + text.add(" "); + text.add(" 1) Read the following article:"); + text.add(""); + text.add(" "); + text.add(" or go to https://plantuml.com/coronavirus"); + text.add(" "); + text.add(" 2) Apply social distancing"); + text.add(" "); + text.add(" If you live in UK, Europe, North & South America, Iran, Japan, Korea..."); + text.add(" and if you refuse to do so, please uninstall PlantUML from your system and do not use this service anymore."); + text.add(" "); + text.add(" "); + if (licenseInfo.isValid() == false) { text.add("If you like this project or if you find it useful, you can support us at:"); text.add(" "); diff --git a/src/net/sourceforge/plantuml/version/PSystemKeycheck.java b/src/net/sourceforge/plantuml/version/PSystemKeycheck.java index 95f887ccc..878d65b0e 100644 --- a/src/net/sourceforge/plantuml/version/PSystemKeycheck.java +++ b/src/net/sourceforge/plantuml/version/PSystemKeycheck.java @@ -52,14 +52,14 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.flashcode.FlashCodeFactory; import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemKeycheck extends AbstractPSystem { @@ -74,7 +74,7 @@ public class PSystemKeycheck extends AbstractPSystem { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, getMetadata(), null, 0, 0, null, false); imageBuilder.setUDrawable(new UDrawable() { @@ -128,7 +128,7 @@ public class PSystemKeycheck extends AbstractPSystem { TextBlock disp = GraphicStrings.createBlackOnWhite(strings); disp.drawU(ug); - ug = ug.apply(new UTranslate(0, disp.calculateDimension(ug.getStringBounder()).getHeight())); + ug = ug.apply(UTranslate.dy(disp.calculateDimension(ug.getStringBounder()).getHeight())); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); final BufferedImage im = utils.exportFlashcode( Version.versionString() + "\n" + SignatureUtils.toHexString(PLSSignature.signature()), Color.BLACK, @@ -136,7 +136,7 @@ public class PSystemKeycheck extends AbstractPSystem { if (im != null) { final UImage flash = new UImage(im).scaleNearestNeighbor(4); ug.draw(flash); - ug = ug.apply(new UTranslate(0, flash.getHeight())); + ug = ug.apply(UTranslate.dy(flash.getHeight())); } if (info.isNone() == false) { diff --git a/src/net/sourceforge/plantuml/version/PSystemKeygen.java b/src/net/sourceforge/plantuml/version/PSystemKeygen.java index e86a8a27f..03e6377cc 100644 --- a/src/net/sourceforge/plantuml/version/PSystemKeygen.java +++ b/src/net/sourceforge/plantuml/version/PSystemKeygen.java @@ -52,14 +52,14 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.flashcode.FlashCodeFactory; import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemKeygen extends AbstractPSystem { @@ -72,7 +72,7 @@ public class PSystemKeygen extends AbstractPSystem { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HColorUtils.WHITE, getMetadata(), null, 0, 0, null, false); imageBuilder.setUDrawable(new UDrawable() { @@ -150,14 +150,14 @@ public class PSystemKeygen extends AbstractPSystem { TextBlock disp = GraphicStrings.createBlackOnWhite(strings); disp.drawU(ug); - ug = ug.apply(new UTranslate(0, disp.calculateDimension(ug.getStringBounder()).getHeight())); + ug = ug.apply(UTranslate.dy(disp.calculateDimension(ug.getStringBounder()).getHeight())); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); final BufferedImage im = utils.exportFlashcode( Version.versionString() + "\n" + SignatureUtils.toHexString(PLSSignature.signature()), Color.BLACK, Color.WHITE); if (im != null) { final UImage flash = new UImage(im).scaleNearestNeighbor(4); ug.draw(flash); - ug = ug.apply(new UTranslate(0, flash.getHeight())); + ug = ug.apply(UTranslate.dy(flash.getHeight())); } if (info.isNone() == false) { diff --git a/src/net/sourceforge/plantuml/version/PSystemLicense.java b/src/net/sourceforge/plantuml/version/PSystemLicense.java index e4c141c21..af50fe9f0 100644 --- a/src/net/sourceforge/plantuml/version/PSystemLicense.java +++ b/src/net/sourceforge/plantuml/version/PSystemLicense.java @@ -47,11 +47,11 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemLicense extends AbstractPSystem implements UDrawable { @@ -95,11 +95,11 @@ public class PSystemLicense extends AbstractPSystem implements UDrawable { final TextBlockBackcolored result1 = getGraphicStrings(strings1); result1.drawU(ug); - ug = ug.apply(new UTranslate(0, 4 + result1.calculateDimension(ug.getStringBounder()).getHeight())); + ug = ug.apply(UTranslate.dy(4 + result1.calculateDimension(ug.getStringBounder()).getHeight())); UImage im = new UImage(logo); - ug.apply(new UTranslate(20, 0)).draw(im); + ug.apply(UTranslate.dx(20)).draw(im); - ug = ug.apply(new UTranslate(0, im.getHeight())); + ug = ug.apply(UTranslate.dy(im.getHeight())); final TextBlockBackcolored result2 = getGraphicStrings(strings2); result2.drawU(ug); } diff --git a/src/net/sourceforge/plantuml/version/PSystemVersion.java b/src/net/sourceforge/plantuml/version/PSystemVersion.java index 26abb5df8..5ed32cd98 100644 --- a/src/net/sourceforge/plantuml/version/PSystemVersion.java +++ b/src/net/sourceforge/plantuml/version/PSystemVersion.java @@ -67,8 +67,8 @@ import net.sourceforge.plantuml.preproc.ImportedFiles; import net.sourceforge.plantuml.preproc.Stdlib; import net.sourceforge.plantuml.preproc2.PreprocessorUtils; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemVersion extends AbstractPSystem { diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 996cb46d7..0de34526e 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -43,7 +43,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1202002; + return 1202003; } public static int versionPatched() { @@ -92,7 +92,7 @@ public class Version { } public static long compileTime() { - return 1583058127051L; + return 1584464373093L; } public static String compileTimeString() { diff --git a/src/net/sourceforge/plantuml/wbs/Fork.java b/src/net/sourceforge/plantuml/wbs/Fork.java index da85d2681..3bafa0af7 100644 --- a/src/net/sourceforge/plantuml/wbs/Fork.java +++ b/src/net/sourceforge/plantuml/wbs/Fork.java @@ -71,7 +71,7 @@ class Fork extends WBSTextBlock { final Dimension2D fullDim = calculateDimension(stringBounder); final Dimension2D mainDim = main.calculateDimension(stringBounder); final double dx = (fullDim.getWidth() - mainDim.getWidth()) / 2; - main.drawU(ug.apply(new UTranslate(dx, 0))); + main.drawU(ug.apply(UTranslate.dx(dx))); drawLine(ug, dx + mainDim.getWidth() / 2, mainDim.getHeight(), dx + mainDim.getWidth() / 2, mainDim.getHeight() + deltay / 2); double x = 0; diff --git a/src/net/sourceforge/plantuml/wbs/ITFComposed.java b/src/net/sourceforge/plantuml/wbs/ITFComposed.java index 2b5007d2e..f367ac360 100644 --- a/src/net/sourceforge/plantuml/wbs/ITFComposed.java +++ b/src/net/sourceforge/plantuml/wbs/ITFComposed.java @@ -131,7 +131,7 @@ class ITFComposed extends WBSTextBlock implements ITF { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D mainDim = main.calculateDimension(stringBounder); final double wx = getw1(stringBounder) - mainDim.getWidth() / 2; - main.drawU(ug.apply(new UTranslate(wx, 0))); + main.drawU(ug.apply(UTranslate.dx(wx))); final double x = getw1(stringBounder); double y = mainDim.getHeight(); double lastY1 = y; diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java index c022b3875..d2701539b 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java @@ -54,7 +54,6 @@ import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -63,6 +62,7 @@ import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class WBSDiagram extends UmlDiagram { @@ -113,7 +113,7 @@ public class WBSDiagram extends UmlDiagram { throw new UnsupportedOperationException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } }; diff --git a/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java b/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java index b303e8379..125dab837 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java +++ b/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.mindmap.IdeaShape; @@ -59,6 +58,7 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; abstract class WBSTextBlock extends AbstractTextBlock { @@ -78,7 +78,7 @@ abstract class WBSTextBlock extends AbstractTextBlock { getStyleUsed().applyStrokeAndLineColor(ug.apply(new UTranslate(p1)), skinParam.getIHtmlColorSet()).draw( line); } else { - final HtmlColor color = ColorParam.activityBorder.getDefaultValue(); + final HColor color = ColorParam.activityBorder.getDefaultValue(); ug.apply(new UTranslate(p1)).apply(new UChangeColor(color)).draw(line); } } diff --git a/src/net/sourceforge/plantuml/wire/Block.java b/src/net/sourceforge/plantuml/wire/Block.java index 32eb6c3cf..12032fb7e 100644 --- a/src/net/sourceforge/plantuml/wire/Block.java +++ b/src/net/sourceforge/plantuml/wire/Block.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.MinMax; @@ -59,6 +58,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Block extends AbstractTextBlock { @@ -125,7 +125,7 @@ public class Block extends AbstractTextBlock { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(new UChangeColor(HColorUtils.BLACK)); if (children.size() == 0) { final TextBlock label = display.create(new FontConfiguration(skinParam, FontParam.COMPONENT, null), HorizontalAlignment.CENTER, skinParam); diff --git a/src/net/sourceforge/plantuml/wire/WireDiagram.java b/src/net/sourceforge/plantuml/wire/WireDiagram.java index 1002bc4ee..e71018f5d 100644 --- a/src/net/sourceforge/plantuml/wire/WireDiagram.java +++ b/src/net/sourceforge/plantuml/wire/WireDiagram.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -58,6 +57,7 @@ import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class WireDiagram extends UmlDiagram { @@ -112,7 +112,7 @@ public class WireDiagram extends UmlDiagram { throw new UnsupportedOperationException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } };