EffectLayer

sdk

#7

@MathewReiss Yup will definitely take a look at those.

@Ron64 I updated library slightly to make plugging effects a bit easier (separate code file). Oh and I did implement “Mirror” effect. Combined with animation it created rolling effect :slight_smile: https://instagram.com/p/1BE-MWOwTZ/


#8

Using this approach in the library now: http://codecorner.galanter.net/2015/04/03/simplify-access-to-framebuffer-on-pebble-time/ it became much simple to plug in new effects. Implemented both Horizontal and Vertical mirror effects.


#9

I wonder if Pebble simply haven’t finished everything for OS 3? They have been adding features with just about every SDK release and might still be working on the inverter layer, possibly considering how exactly to implement it.

The most common use case for the inverter layer on the black and white Pebbles is to offer a quick way of implementing either white on black or black on white color schemes like my watchface does. I was thinking about adding just a few splashes of color to my weather watchface like color weather symbols and maybe color temperatures, but I would still like to be able to invert the black and white elements. So I think it would be most useful if the inverter layer had an option to invert just black and white and leave all other colors as is or specify a few select colors to invert while leaving everything else untouched.



#10

@Colin01 That would be pretty easy to implement in this library. I agree it doesn’t make much sense seeing color negatives. And I think you’re right about SDK 3 too, they keep adding stuff (like antialiasing recently) all the time.


#11

I think having the ability to specify an array of colors to replace and the colors to replace them with could be useful (as long as they’re careful to only process a pixel once), but - presumably - you can also simply have those colors as variables and redraw your layers. Graphics objects would either be known quantities that you could prepare the appropriate alternative for, or you wouldn’t want to be changing anyway.


#12

I wrote code for 90 degree rotation. Will update my github and make a pull request in a few hours. (It rotate biggest odd size square within layer size)


#13

Very cool!

EDIT: I merged your pull request, thanks! Very cool addition


#14

You are welcome. We can suggest to other developers: "You can add yourself whatever effect like".

couple of suggestion for the code:

  • You can add a pointer to your effect function, like some Pebble SDK functions. It can be used to pass a parameter or full set of data. In my addition, I could have made only one rotation effect and give it the direction as parameter. Other uses can be passing a color data for some effects.
  • You can use values 1,2,4,8,16... for supported effects, it will allow user to do "Or" of several effects in one call.
(These two suggestion collide with each other ;-)


#15

I like both ideas, now only to make them work together :slight_smile: Also I am trying to make the library Aplite compatible, proving a bit more challenging than I thought.


#16

@Ron64 I’ve updated the library to support Applite (https://twitter.com/YGalanter/status/584476282001428480) The only changes to “effect” functions - they call a function to set/get pixel at y,x coordinates.


#17


You did a very nice job on supporting Applite. When I asked about it, I was thinking on the watchface Taller by @markreed he can probably use the horizontal+vertical mirror effects as 180 degree rotation.

I committed a fix that allows to activate several effects together. If you don’t code effect for rotating 180 degrees, you can do just:

#define EFFECT_ROTATE_180 6


#18

Very nice implementation, I merged it too. Should prove very useful.


#19

@Ron64 playing with your 90° effect https://twitter.com/YGalanter/status/584887706699857920


#20

Nice usage.
BTW, you may want to change the topic here in the top as it’s not Basalt only anymore.


#21

@Ron64, I was thinking what if, to achieve multiple effects instead of passing a single ORed parameter, we’d pass an array of effect values? This way we can pass a second array with parameters for each effect. Code then loop thru effects, applying any non NULL parameters respectfully. This approach has additional bonus - you can apply same effect twice if needed.


#22

In reality I'm not sure how many effects a user will want together. Most effects don't need a parameter and user can even use two layers each with one-two effects, If he needs two effects that need parameters.

One new effect I think can be interesting is zoom. (parameter for x2, x4, x8)


#23

Oh yeah zoom sounds cool. Another useful one would be “move” where layer content is moved to (or by) X, Y coordinates, suppliers by parameters. Still need a reliable way to pass params


#24

You pass a pointer. In simple case you put a number into it. In advance case, you can pass a pointer to data structure.


#25

Figured as much, too bad it will be incompatible with multi-effect call. But I guess you’re right, it’s simple to just create another layer for additional effects


#26

We now have Blur thanks to Grégoire Sage


Who says Pebble doesn’t have font antialiasing?