diff options
| author | Brianna Rainey | 2026-01-28 17:49:58 -0500 |
|---|---|---|
| committer | GitHub | 2026-01-28 17:49:58 -0500 |
| commit | f66eb99465c61232a7f649e66bee59504bb0e52c (patch) | |
| tree | 40d4f2e4e7cea033e4a68da025c7d91295e71cfb /src/avp/components/image.py | |
| parent | 864898419e810055b51e3a32fccb00a62aab9a6b (diff) | |
v2.2.1 - fix #74, fix #92, add optional 64th bar to Classic Visualizer, improve Conway default (#93)
* update gitignore
ignore profiling and coverage data
* F1 opens help window, create appName variable, move undostack class
* fix kaleidoscope effect, increase default Y values by +4
the increased y values allow the cells to continue animating for more than 60 minutes instead of 30 (at default 60f/t)
* update version number
* add minimumWidth to undo history window
* Classic Visualizer: option to include 64th bar
* Waveform component: fix #74 - new animation speed option
* move shared visualizer code into toolkit
* Waveform component: compress audio by default
* Waveform component: fix 100% animation speed
* new components receive random color
* update to Qt 6
* fix pushbutton stylesheet
* fix #92: replace ok/cancel with save/discard/cancel
* remove obsolete PaintColor subclass
* mv common shadow code into addShadow func
* add 3rd option of ok/cancel back to showMessage
the 3 options are:
- ok
- ok/cancel
- save/discard/cancel
* Image component: add shadow option
* small test of rgbFromString
* fix color tuple string
* test another way to get comp names from CLI
* rename component tests, add some more
* Image component: scale shadow based on resolution
* catch AttributeError if previewRender returns None
* Text component: fix blur radius only able to increase
the relativeWidgets system causes QDoubleSpinbox to only allow increases, because it really only works with integeres, so I changed the blur radius into a normal QSpinBox. I noted where the problem exists within component.py for future reference. This commit also removes an unneeded VerticalLayout from the ui file
* remove unnecessary QVBoxLayout
* paste shadow at x,y instead of using offset method
* fix tests due to shadow change
* don't print warning in connectWidget due to QFontComboBox
Diffstat (limited to 'src/avp/components/image.py')
| -rw-r--r-- | src/avp/components/image.py | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/avp/components/image.py b/src/avp/components/image.py index bada15f..e012cec 100644 --- a/src/avp/components/image.py +++ b/src/avp/components/image.py @@ -4,13 +4,13 @@ import os from copy import copy from ..component import Component -from ..toolkit.frame import BlankFrame -from .original import Component as Visualizer +from ..toolkit.frame import BlankFrame, addShadow +from ..toolkit.visualizer import createSpectrumArray class Component(Component): name = "Image" - version = "2.0.0" + version = "2.1.0" def widget(self, *args): super().widget(*args) @@ -35,6 +35,7 @@ class Component(Component): "mirror": self.page.checkBox_mirror, "respondToAudio": self.page.checkBox_respondToAudio, "sensitivity": self.page.spinBox_sensitivity, + "shadow": self.page.checkBox_shadow, }, presetNames={ "imagePath": "image", @@ -75,31 +76,16 @@ class Component(Component): # Trigger creation of new base image self.existingImage = None - smoothConstantDown = 0.08 + 0 - smoothConstantUp = 0.8 - 0 - self.lastSpectrum = None - self.spectrumArray = {} - - for i in range(0, len(self.completeAudioArray), self.sampleSize): - if self.canceled: - break - self.lastSpectrum = Visualizer.transformData( - i, - self.completeAudioArray, - self.sampleSize, - smoothConstantDown, - smoothConstantUp, - self.lastSpectrum, - self.sensitivity, - ) - self.spectrumArray[i] = copy(self.lastSpectrum) - - progress = int(100 * (i / len(self.completeAudioArray))) - if progress >= 100: - progress = 100 - pStr = "Analyzing audio: " + str(progress) + "%" - self.progressBarSetText.emit(pStr) - self.progressBarUpdate.emit(int(progress)) + self.spectrumArray = createSpectrumArray( + self, + self.completeAudioArray, + self.sampleSize, + 0.08, + 0.8, + self.sensitivity, + self.progressBarUpdate, + self.progressBarSetText, + ) def frameRender(self, frameNo): return self.drawFrame( @@ -139,9 +125,16 @@ class Component(Component): self.existingImage = image # Respond to audio + resolutionFactor = height / 1080 + shadX = int(resolutionFactor * 1) + shadY = int(resolutionFactor * -1) + shadBlur = resolutionFactor * 3.50 scale = 0 if dynamicScale is not None: scale = dynamicScale[36 * 4] / 4 + shadX += int((scale / 4) * resolutionFactor) + shadY += int((scale / 2) * resolutionFactor) + shadBlur += (scale / 8) * resolutionFactor image = ImageOps.contain( image, ( @@ -161,6 +154,8 @@ class Component(Component): ) if self.rotate != 0: frame = frame.rotate(self.rotate) + if self.shadow: + frame = addShadow(frame, shadBlur, shadX, shadY) return frame |
