libera/#clim - IRC Chatlog
Search
11:46:54
metsomedog
jackdaniel: if I have a huge tileset .png file with 12x12 sprites, is there some simple way to load some sprites from that file as "patterns"?
11:52:03
jackdaniel
short of copying these sprites I can't think of anything in CLIM that'd help you with that
11:53:30
jackdaniel
but sadly common lisp standard does not specify such a specimen (although ecl will have in the next release)
11:53:41
metsomedog
So I should export them to separate files using another application? I would think you could say "load this subset of pixels from the image into a variable" sort of thing?
11:53:56
Brucio-61
there is a (i think unexported) way of making patterns from arrays of pixel data, though. so if you can load the whole tileset as an array and make "slices" yourself, you should be able to make the patterns in question
11:54:20
jackdaniel
metsomedog: I mean that you could copy slices of the big array into smaller arrays
11:54:59
metsomedog
make-pattern-from-bitmap-file on the top-level png file and then slice afterwards?
11:55:39
jackdaniel
yeah. that wouldn't be like super portable (because you'll need to access the underlying pattern array)
11:58:54
metsomedog
so that would be the array from %rgba-pattern I guess, where each index corresponds to 1 pixel?
12:00:16
jackdaniel
CLIM is a specification, McCLIM is an implementation (like for example common lisp and sbcl), backend is local to the implementation
12:01:56
jackdaniel
but unless I'm horribly mistaken commercial vendors keep clim around to support existing clients, they are not doing anything new with it
12:02:30
metsomedog
as far as I can see mcclim is the only one being actively developed and extended
12:03:32
Brucio-61
another open source CLIM implementation is being developed by gilberth. it is unpublished as of now
12:04:21
jackdaniel
metsomedog: you may use the function clime:pattern-array to acces the array of the pattern
12:04:36
Brucio-61
once released, but you are right, that makes it not open source at this time, i guess
12:06:06
jackdaniel
perhaps we should change clim:make-pattern to create an image pattern when the argument DESIGNS is NIL
18:35:21
metsomedog
jackdaniel: Managed to draw 12x12 sprites from a png spritesheet now using the technique you suggested. However the sprites are very small - can you recommend a simple way to "zoom them" into e.g. 60x60?
18:40:03
jackdaniel
so (setf *bigger-sprite* (transform-region (make-scaling-transformation 5 5) *small-sprite*) should do the job
18:41:41
jackdaniel
xrender should nicely optimize rendering, but in case it isn't (i.e because I have not merged the change:) you may call climi::%collapse-pattern on the result - that will create yet another pattern -- but that's internal interface so don't count that it will always stay in place
18:42:02
jackdaniel
also collapsing patterns have other unpleasent effects - especially when patterns are translucent
18:44:50
metsomedog
(since I need to load 12x12 pixels from some arbitrary position in the sprite sheet, and also the creator decided 1 pixel space between each sprite was a great idea)
18:48:15
jackdaniel
personally I'd rather see an extension where we can displace one pattern onto another