CommonFilters: Documentation adjustments

* State that we're using Cg shaders, ideal for clarification.
* Commented out Josh's monologue since it doesn't particularly contribute to the API page
* Added documentation to the setBloom function to help clarify.

Closes #1200

Co-authored-by: rdb <git@rdb.name>
This commit is contained in:
loonaticx 2022-01-01 15:20:57 +01:00 committed by rdb
parent 5caf0ff5d6
commit 500491e6c9

View File

@ -1,21 +1,21 @@
"""
Class CommonFilters implements certain common image
postprocessing filters. See the :ref:`common-image-filters` page for
more information about how to use these filters.
It is not ideal that these filters are all included in a single
monolithic module. Unfortunately, when you want to apply two filters
at the same time, you have to compose them into a single shader, and
the composition process isn't simply a question of concatenating them:
you have to somehow make them work together. I suspect that there
exists some fairly simple framework that would make this automatable.
However, until I write some more filters myself, I won't know what
that framework is. Until then, I'll settle for this
clunky approach. - Josh
These filters are written in the Cg shading language.
"""
# It is not ideal that these filters are all included in a single
# monolithic module. Unfortunately, when you want to apply two filters
# at the same time, you have to compose them into a single shader, and
# the composition process isn't simply a question of concatenating them:
# you have to somehow make them work together. I suspect that there
# exists some fairly simple framework that would make this automatable.
# However, until I write some more filters myself, I won't know what
# that framework is. Until then, I'll settle for this
# clunky approach. - Josh
from .FilterManager import FilterManager
from .filterBloomI import BLOOM_I
from .filterBloomX import BLOOM_X
@ -459,6 +459,11 @@ class CommonFilters:
return True
def setBloom(self, blend=(0.3,0.4,0.3,0.0), mintrigger=0.6, maxtrigger=1.0, desat=0.6, intensity=1.0, size="medium"):
"""
Applies the Bloom filter to the output.
size can either be "off", "small", "medium", or "large".
Setting size to "off" will remove the Bloom filter.
"""
if (size==0): size="off"
elif (size==1): size="small"
elif (size==2): size="medium"
@ -542,7 +547,7 @@ class CommonFilters:
return True
def setBlurSharpen(self, amount=0.0):
"""Enables the blur/sharpen filter. If the 'amount' parameter is 1.0, it will not have effect.
"""Enables the blur/sharpen filter. If the 'amount' parameter is 1.0, it will not have any effect.
A value of 0.0 means fully blurred, and a value higher than 1.0 sharpens the image."""
fullrebuild = (("BlurSharpen" in self.configuration) == False)
self.configuration["BlurSharpen"] = amount