Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 04 2019 13:41
    rikkimax edited #8
  • Apr 04 2019 13:41
    rikkimax opened #8
  • Nov 07 2018 11:34

    rikkimax on master

    Removing TIFF empty file (compare)

  • Nov 07 2018 11:33

    rikkimax on master

    BMP has far too many gotchas to… (compare)

  • Aug 14 2018 17:47

    rikkimax on v1.1.2

    (compare)

  • Aug 14 2018 17:46

    rikkimax on master

    Fix for dmd bug 19170 (compare)

  • Jun 09 2018 13:34

    rikkimax on master

    Wrong variable fix (compare)

  • Jun 05 2018 14:38

    rikkimax on v1.1.1

    (compare)

  • Jun 05 2018 14:38

    rikkimax on master

    Fixing deprecations (compare)

  • Jun 05 2018 14:28

    rikkimax on v1.1.0

    (compare)

  • Jun 05 2018 14:27

    rikkimax on master

    Upgrading dependencies (compare)

  • Apr 10 2018 13:52

    rikkimax on master

    Starting work on a bmp image lo… (compare)

  • Mar 11 2018 09:12

    rikkimax on v1.0.3

    (compare)

  • Mar 11 2018 09:11

    rikkimax on master

    Why isn't this in? (compare)

  • Mar 10 2018 12:12

    rikkimax on v1.0.2

    (compare)

  • Mar 09 2018 16:24

    rikkimax on master

    std.experimental.allocator -> s… Merge pull request #7 from WebF… (compare)

  • Mar 09 2018 16:24
    rikkimax closed #7
  • Mar 09 2018 16:21
    WebFreak001 opened #7
  • Feb 01 2018 13:07

    rikkimax on master

    A very simple rotation (compare)

  • Oct 15 2017 11:36

    rikkimax on v1.0.1

    (compare)

Richard Andrew Cattermole
@rikkimax
gah libjpeg
libjpeg.d is the port's name
Vadim Lopatin
@buggins
What if just borrow some native D implementation? E.g. in dlib it's native D
other implementations exist too (A.Bothe or some other guru)
please read from line 338
that should explain more or less why I'm hesitant to go with only D written one
unlike PNG JPEG is a real mess spec wise
Richard Andrew Cattermole
@rikkimax
I don't mind giving you a couple of snippets of what I'm currently working on
Unfortunately most if it is secret for dconf XD
module webdev.base.reflection.caches;
import std.range : InputRange;

package __gshared {
    AReflectedCache[string] caches;
}

/**
 * Get all cache names
 * 
 * Returns:
 *         The cache names
 */
string[] reflectedCacheNames() {
    return caches.keys;
}

/**
 * Get a specific cache
 * 
 * Params:
 *         name    =    Name of the cache to get
 * 
 * Returns:
 *         The cache or null if it does not exist
 */
AReflectedCache* getReflectedCache(string name) {
    if (name !in caches) return null;
    return caches[name].dup();
}

/**
 * Reflects upon a cache
 */
struct AReflectedCache {
    import webdev.base.traits : isACache;
    import webdev.base.reflection.model;

    private {
        string name_;
        string theModule_;

        AReflectedModelInstance* delegate(void*) fromInstance;
    }

    /**
     * Constructs a reflected cache object using the given cache
     * Should never be needed to be called directly in user code
     * 
     * Params:
     *        cache    =    The cache to reflect upon
     */    
    this(T)(T cache) if (isACache!T) {
        import std.traits : ReturnType;
        import std.range : ElementType;

        alias RTYPE = ReturnType!(T.get);
        alias ETYPE = ElementType!RTYPE;

        length = &cache.length;
        forceUpdate = &cache.forceUpdate;
        theModule_ = T.____theCacheModule;
        name_ = T.____theCacheName;
        fromInstance = cast()getReflectModel!ETYPE().fromInstance;

        class RangeGet : InputRange!(AReflectedModelInstance*) {
            private RTYPE theRange;

            this() {
                theRange = cache.get();
            }

            @property {
                AReflectedModelInstance* front() {
                    return fromInstance(&theRange.front()); }
                bool empty() {
                    return theRange.empty; }
            }

            AReflectedModelInstance* moveFront() {
                auto ret = front;
                popFront;
                return ret;
            }
            void popFront() {
                theRange.popFront; }

            int opApply(int delegate(AReflectedModelInstance*) dg) {
                int result = 0;

                while(!empty) {
                    result = dg(front());
                    popFront();
                    if (result)
                        break;
                }

                return result;
            }

            int opApply(int delegate(size_t, AReflectedModelInstance*) dg) {
                int result = 0;

                size_t i;
                while(!empty) {
                    result = dg(i, front());

                    popFront();
                    i++;

                    if (result)
                        break;
                }

                return result;
            }
        }

        get = () { return new RangeGet; };
        dup = () { return new AReflectedCache(cache); };
    }

    const {
        /**
         * The module the cache is in
         */
        string theModule() { return theModule_; }

        /**
         * The name of the cache
         */
        string theName() { return name_; }

        /**
         * The length of items in the cache
         * Very expensive. Do not call if you can help it.
         */
        size_t delegate() length;

        /**
         * Forces the cache to update itself
         */
        void delegate() forceUpdate;

        /**
         * Get an input range of elements from the cache
         * Uses a reflected model instance per item.
         */
        InputRange!(AReflectedModelInstance*) delegate() get;

        /**
         * Creates a new instances of this reflected cache using the same cache
         */
        AReflectedCache* delegate() dup;
    }
}
module webdev.base.models.pagetemplate;
import webdev.base.orm;
import webdev.base.udas;

@ormTableName("PageTemplate")
struct PageTemplateModel {
    @ormId {
        /**
         * The name of the page template.
         */
        @ormPropertyHint(OrmPropertyTypes.String, 0)
        @ormDescription("The name of the template. Should include location information such as file path.")
        string name;

        /**
         * UTC+0 time of when this was last edited.
         */
        @ormPropertyHint(OrmPropertyTypes.Integer, 4)
        @ormDescription("When was this last changed. Do not change.")
        long lastEdited;
    }

    @ormOptional
    @ormPropertyHint(OrmPropertyTypes.Blob, 0)
    @ormDescription("Optionally the template itself")
    string value;

    //mixin OrmModel!PageTemplateModel;

    bool isValid() {
        return lastEdited > 0 && name !is null; // custom validation
    }
}
Vadim Lopatin
@buggins
are you writing ORM?
Richard Andrew Cattermole
@rikkimax
to replace dvorm yes
Vadim Lopatin
@buggins
Hi! I've created issue #3 to fix build under dmd2.0.67 rc1
..\de_image\source\png\devisualization\image\png\reader.d(139): Error: cannot cast expression data[index..index + 4u] of type ubyte[] to ubyte[4]
..\de_image\source\png\devisualization\image\png\reader.d(140): Error: cannot cast expression data[index + 4u..index + 8u] of type ubyte[] to char[4]
Richard Andrew Cattermole
@rikkimax
I unfortunately thought of a certain swear word when reading that. I'll get setup with 2.067 tomorrow and fix this
Vadim Lopatin
@buggins
btw, my fix is
ubyte[4] d1 = data[index .. index + 4];
chunkLength = bigEndianToNative!uint(d1);
chunkType = cast(char[4])d1;
Richard Andrew Cattermole
@rikkimax
Can you do a PR?
if not, it should be done in about 16 hours at most
It's just 2am here
Vadim Lopatin
@buggins
done
Richard Andrew Cattermole
@rikkimax
thanks, I'll confirm and tag tomorrow
Vadim Lopatin
@buggins
np
Richard Andrew Cattermole
@rikkimax
Tagged and confirmed
Vadim Lopatin
@buggins
thanks
Roman Chistokhodov
@FreeSlave
Hello. Do you need xpm support in de_image?
Richard Andrew Cattermole
@rikkimax
Currently there is no support.
So if you are willing to add it please do
Roman Chistokhodov
@FreeSlave
OK, I just don't want to build my own abstraction for image, since there're already D libraries for image loading and every defines its own interface.
Your library looks good since it allows to register other types.
Richard Andrew Cattermole
@rikkimax
It's one of the original purposes of it. We may not agree on implementations but atleast can we try to agree on interfaces.
I will be changing the interfaces in time. I'm just waiting on std.image.color inclusion.
Roman Chistokhodov
@FreeSlave
Hello again. So I looked at interface more closely and found it somewhat weird. Same for png implementation.
For example, you make shallow copy of pixel array in the copy constructor. Is it ok?
Roman Chistokhodov
@FreeSlave
The storing of pixels in structs looks confusing too. If your goal was to make computer graphics related module, then I believe, you should consider to expose raw rgba data too.
rgba property in png implementation makes heap allocation every time it's called. The whole ImagePixels range thing is weird, since all implementations would look almost the same way for all images anyway, since you require allPixels.
Richard Andrew Cattermole
@rikkimax
  1. Each image should own its pixel in memory. If it doesn't it could be modified "unsafely" as far as it knows.
  2. The original idea was that there would be other ones. Such as hsv. And it would change on the fly the type of color it was using. So that the internal representation didn't matter.
  3. allPixels yes is a little weird. It was more a convenience function for e.g. passing to c. Although I haven't really used it since it allocates.
Once std.image.color gets in, I'll be changing the interface to allow for it and removing my own definition
After all, the entire idea of Devisualization is to get standardisation of these components done. If it isn't part of Devisualization that has become standard, well then its going.
Roman Chistokhodov
@FreeSlave
  1. Yes, and it's not the case for shallow (vs deep) copy.
  2. allPixels store Color_RGBA, where every color component is 16-bit. How many C-interfaces use 16-bit components? How many formats use 16-bit components at all? (some photoshop's format do, as I know, but the most are 8-bit).
Richard Andrew Cattermole
@rikkimax
I agree 16-bit is too much most of the time. I made it like that so it could be usable (with some conversion) for almost all cases.
Until std.image.color is done, I'm not willing to change the interfaces anymore then has been done.
Roman Chistokhodov
@FreeSlave
Who's making std.image.color?
Richard Andrew Cattermole
@rikkimax
Manu
Roman Chistokhodov
@FreeSlave
Can't google any link to that. Where can I watch how it goes?
Richard Andrew Cattermole
@rikkimax
D-Programming-Language/phobos#2845
Roman Chistokhodov
@FreeSlave
ok, now I see, it's in another branch.
Anyway I made reading of xpm-files using your interface. I'm not pleased with it (even leaving aside color matter, there're many opportunities to add constness, for example), but since you're not going to change interface yet, I just have to wait.
Richard Andrew Cattermole
@rikkimax
One day Devisualization.Image will no longer be needed. Until then my job is to try and keep a stable and resonable api.
std.image.color is the next thing to change the api. After all it won't just change this. It changes almost all of the projects.
I don't need it to std.image.color to be pulled. I just need it to be accepted abstraction wise.
Once it's been accepted, I'll copy it over and use it.