Releases: swyddfa/arlunio
v0.4.0 - 2018-09-16
Out of the ashes of the previous version rises the biggest release to date!
Stylo has been rewritten from the ground up and should now be easier to use,
more modular and easier to extend!
None (or very little) of the original code remains and not everything has been
reimplemented yet so some of the features listed below may not be available in
this version. There is a lot more work to be done particularly in the tests and
docs departments however core functionality is now in place and it's been long
enough since the previous release.
I'm hoping that from now on releases will be smaller and more frequent as what
is now here is refined and tested to create a stable base from which Stylo can
be extended.
Added
Users
One of the main ideas behind the latest incarnation of stylo is the idea of
interfaces borrowed from Java. Where you have an object such as :code:Shape
and all shapes have certain behaviors in common represented by methods on an
interface. Then there are a number of implementations that provide the details
specific to each shape.
In stylo this is modelled by having a number of abstract classes that define
the interfaces that represent different parts of the stylo image creation
process. Then regular classes inherit from these to provide the details.
With that in mind this release provides the following "interfaces".
-
New
RealDomain
andRealDomainTransform
interfaces, these
model the mapping of a continuous mathematical domain
:math:D \subset \mathbb{R}^2
onto a discrete grid of pixels. -
New
Shape
interface this models the mapping of the grid of values
generated by a domain into a boolean numpy array representing which pixels
are a part of the shape. -
New
ColorSpace
system this currently doesn't do much but should allow
support for the use of different color representations. Current only 8-bit
RGB values are supported. -
New
ColorMap
interface, this represents the mapping of the boolean
numpy array generated by the :code:Shape
interface into a numpy array
containing the color values that will be eventually interpreted as an image. -
New
Image
interface. Implementations of this interface will implement
common image creation workflows as well as providing a unified way to preview
and save images to a file.
With the main interfaces introduced here is a (very) brief introduction to each
of the implementations provided in this release
RealDomain
RectangularDomain
Models a rectangular subset of the :mathxy
-plane
:math:[a, b] \times [c, d] \subset \mathbb{R}^2
SquareDomain
: Similar to above but in the cases where :math:c = a
and :math:d = b
UnitSquare
: Similar to above but the case where :math:a = 0
and
:math:b = 1
RealDomainTransform
HorizontalShear
: Given a domain this applies a horizontal shear to itRotation
: Given a domain this rotates it by a given angleTranslation
: Given a domain this applies a translation to itVerticalShear
: Given a domain this applies a vertical shear to it
Shape
Square
Rectangle
Circle
Ellipse
ColorSpace
RGB8
: 8-bit RGB valued colors
ColorMap
FillColor
: Given a background and a foreground color. Color all
False
pixels with the background color and color all the :code:True
pixels the foreground color.
Image
SimpleImage
: Currently the only image implementation, this implements
one of the simplest workflows that can result in an interesting image. Take
aDomain
, pass it to a :code:Shape
and then apply aColorMap
to the result.
Extenders/Contributors
From the beginning this new attempt at stylo
has been designed with
extensibility in mind so included in the library are also a number of utilities
aimed to help you develop your own tools that integrate well with the rest of
stylo.
Domains and DomainTransforms
While stylo
only currently ships with RealDomain
and
RealDomainTransform
interfaces it is developed in a way to allow the
addition of new "families" of domain. If you want to create your own stylo
provides the following functions:
define_domain
: This will write your base domain class (like the
RealDomain
) just give it a name and a list of parameters.define_domain_transform
: The will write theDomainTransform
base class for you.
In addition to defining new families stylo
provides a few helper
classes to help you write your own domains and transforms for the existing
RealDomain
family
PolarConversion
: If your domain is only "interesting" in cartesian
coordinates this helper class will automatically write the conversion to
polar coordinates for you.CartesianConversion
: If your domain is only "interesting" in polar
coordinates this helper class will automatically write the conversion to
cartesian coordinates for you.
stylo.testing
stylo
also comes with a testing package that provides a number of
utilities to help you ensure that any extensions you write will integrate well
with the rest of stylo
BaseRealDomainTest
: This is a class that you can base your test case
on for any domains in theRealDomain
family to ensure that they
function as expected.define_domain_test
: Similar to the :code:define_domain
and
define_domain_transform
functions this defines a base test class to
ensure that domains in your new family work as expected.BaseShapeTest
Basing your test case on this for any new shapes will
ensure that your shapes will function as expected by the rest ofstylo
define_benchmarked_example
: This is for those of you wishing to
contribute an example to the documentation, using this function with your
example code will ensure that your example is automatically included in the
documentation when it is next built.
stylo.testing.strategies
This module defines a number of hypothesis strategies for common data types in
stylo
. Using these (and hypothesis) in your test cases where possible
will ensure that your objects will work with the same kind of data as
stylo
itself.
Removed
Everything mentioned below.
v0.3.0 2017-12-09
Added
- New Domain class, it is responsible for generating the grids of numbers
passed to Drawables when they are mapped onto Images. It replaces most of the
old decorators. - Drawables are now classes! Any drawable is now a class that inherits from
Drawable, it brings back much of the old Puppet functionality with some
improvements. - More tests!
Changed
- ANDing Images (a & b) has been reimplemented so that it hopefully makes more
sense. The alpha value of b is used to scale the color values of a. - Along with the new Domain system mapping Drawables onto Images has been
reworked to hopefully make coordinate calculations faster
Removed
- stylo/coords.py has been deleted, this means the following functions and
decorators no longer exist- mk_domain - Domains are now a class
- cartesian (now built into the new Domain object)
- polar (now built into the new Domain object)
- extend_periocally (now the .repeat() method on the new Domain object)
- translate (now the .transform() method on the new Domain object)
- reflect (not yet implemented in the new system)
v0.2.3
v.0.2.3 2017-11-15
Added
- Image objects can now be added together, this is simply the sum of the color
values at each pixel - Image objects can now be subtracted, which is simply the difference of the
colour values at each pixel
Changed
- Renamed hex_to_rgb to hexcolor. It now also can cope with rgb and rgba
arguments, with the ability to promote rgb to rgba colors
v0.2.2
v0.2.1
v0.2.0
Initial release
v0.1.0 Initial release