Giter VIP home page Giter VIP logo

pebble-fctx's People

Contributors

jrmobley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pebble-fctx's Issues

fctx_draw_commands starts failing sometimes

I have a piece of code that gets called on the minute, determines a resource ID, gets the path via fpath_create_from_resource then draws it using fctx_draw_commands.

sometimes the drawing part falls apart, even if the resource ID never changes.

Here's the piece of code

uint32_t weather_icon_resourceid = weather_icons_day[1].resourceid;

if (w_daynight == 1) {
fctx_set_offset(&fctx, FPointI(122+weather_icons_day[w_icon].offsetx-(temp_offset/30), weather_icons_day[w_icon].offsety));
weather_icon_resourceid = weather_icons_day[w_icon].resourceid;
} else {
fctx_set_offset(&fctx, FPointI(122+weather_icons_night[w_icon].offsetx-(temp_offset/30), weather_icons_night[w_icon].offsety));
weather_icon_resourceid = weather_icons_night[w_icon].resourceid;
}

fctx_set_scale(&fctx, FPointI(180,180), FPointI(168,168));
APP_LOG(APP_LOG_LEVEL_INFO, "weather icon resource id is %lu", weather_icon_resourceid);
weather_icon_path = fpath_create_from_resource(weather_icon_resourceid);
fctx_draw_commands(&fctx, FPointZero, weather_icon_path->data, weather_icon_path->size);

and here are two logs

[22:42:01] main.c:237> Redrawing screen
[22:42:01] main.c:339> weather icon resource id is 9
[22:42:01] main.c:388> Steps: 0
[22:43:01] main.c:237> Redrawing screen
[22:43:01] main.c:339> weather icon resource id is 9
[22:43:01] main.c:388> Steps: 0
[22:44:01] main.c:237> Redrawing screen
[22:44:01] main.c:339> weather icon resource id is 9
[22:44:01] main.c:388> Steps: 0
[22:45:01] main.c:237> Redrawing screen
[22:45:01] main.c:339> weather icon resource id is 9
[22:45:01] fctx.c:887> invalid draw command "
[22:45:01] main.c:388> Steps: 0
[22:46:01] main.c:237> Redrawing screen
[22:46:01] main.c:339> weather icon resource id is 9
[22:46:01] fctx.c:887> invalid draw command "
[22:46:01] main.c:388> Steps: 0
[22:47:01] main.c:237> Redrawing screen
[22:47:01] main.c:339> weather icon resource id is 9
[22:47:01] fctx.c:887> invalid draw command "
[22:47:01] main.c:388> Steps: 0
[22:48:01] main.c:237> Redrawing screen
[22:48:01] main.c:339> weather icon resource id is 9
[22:48:01] fctx.c:887> invalid draw command "
[22:48:01] main.c:388> Steps: 0
(once it starts happening this one will go on and on failing and not draw any icon, in the basalt emulator)

[22:47:04] main.c:237> Redrawing screen
[22:47:04] main.c:339> weather icon resource id is 9
[22:47:04] main.c:388> Steps: 21
[22:48:03] main.c:237> Redrawing screen
[22:48:03] main.c:339> weather icon resource id is 9
[22:48:03] main.c:388> Steps: 21
[22:49:03] main.c:237> Redrawing screen
[22:49:03] main.c:339> weather icon resource id is 9
[22:49:03] ault_handling.c:74> App fault! {b4d23fe5-030c-4a72-99e6-a18e84554cf4} PC: 0x1418 LR: 0x806b021
Program Counter (PC) : 0x1418 /Users/peter/pebble/PJ-Business/watchface/build/../src/main.c:341
Link Register (LR) : 0x806b021 ???
(this one sporadically happens and will restart the watchface, on actual basalt hardware with firmware 3.9.1)

both of these happen with SDK 3.9

the FPath has been defined at the top of main.c in this line

FPath *p_bt_icon, *p_tick_mark, *weather_icon_path;

attached is the fpath behind resource id 9
0910dn.fpath.zip

README help

It'd be nice if the readme said to add

#include <pebble-fctx/fctx.h>

assuming that's how you actually include it (I'm just learning about fctx now)

`pivot` transformation is not mentioned in the readme

There might be some other docs that I missed, but for the moment I assume the only docs are the readme.

The pivot transform is not mentioned in the readme. I got it to work for me with a bit of experimenting, but it would be great to have it explained together with the other transforms.

I would make a PR with the explanation myself, but I do not understand it well, especially in terms of ordering with respect to the other transforms.

Thanks for writing this library!

Improve memory handling for path drawing.

Find a way to eliminate the malloc call in fctx_draw_path. At least make it optional. Also provide an API for applying transforms independent of drawing. This would allow efficient re-use of transformed points in multiple plot calls.

Function to get the width of a string in pixels when drawn at a given size

It would be nice to have a function to get the width of a given string in pixels when it is drawn at a particular width, similar to graphics_text_layout_get_content_size from the Pebble SDK. Alternatively, fctx_draw_string could return that value.

Would you consider adding this functionality (or is it already there and I missed it)?

Drawing text won't work in Aplite

Is there some trick to getting text drawing to work in Aplite?

Drawing text in Basalt & Chalk seems to work fine, but every time I try to run the same code in Aplite, I get the following error message:

[ERROR] fctx.c:39: NULL fctx->flag_buffer

Any ideas?

letter-spacing increased

Letter-spacing has increased in the latest commit 9cd558f. Using the same svg font files, the newly generated ffont files used in the latest fctx produce significantly wider lines than ffont files from the same svg sources compiled for and used with the previous fctx release. There were no code changes in the watchface. I could observe this on centered and right justified lines, but have no left justified lines to confirm it also happens there.
Example screenshot before and after
fctx-letter-spacing

No text displayed

I compiled this replacing set_text_size with set_text_em_height and none of the text displayed

Also I added the below to the json
"dependencies": {
"pebble-fctx": "^1.5.0"
},
and changed the include to
#include <pebble-fctx/fctx.h>
#include <pebble-fctx/ffont.h>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.