Git Product home page Git Product logo

Comments (13)

liamHowatt avatar liamHowatt commented on July 2, 2024

If I understand correctly, yes, that aspect is the same in version 9 compared to version 8.

https://docs.lvgl.io/master/overview/obj.html

Regarding lv_obj_set_style_transform_angle, that should work since it's mapped using an API mapping for v8->v9, but lv_obj_set_style_transform_rotation is the new function name.

from lvgl.

iSetebos avatar iSetebos commented on July 2, 2024

lv_img_set_angle and lv_obj_set_style_transform_angle not work.

from lvgl.

liamHowatt avatar liamHowatt commented on July 2, 2024

Do you get a compiler error or do they not work as intended at runtime?

from lvgl.

iSetebos avatar iSetebos commented on July 2, 2024

Compiles but does not work properly. More precisely, there is no image. At the same time, the stream in which lvgl loads the processor by 100%.

from lvgl.

liamHowatt avatar liamHowatt commented on July 2, 2024

Is it a binary image? See #6193. This is a known weakness of binary images.

https://docs.lvgl.io/master/widgets/image.html#transformations

The transformations require the whole image to be available. Therefore indexed images (LV_COLOR_FORMAT_I1/2/4/8_...), alpha only images cannot be transformed. In other words transformations work only on normal (A)RGB or A8 images stored as C array, or if a custom Image decoder returns the whole image.

from lvgl.

iSetebos avatar iSetebos commented on July 2, 2024

This is a png-decoded image in ARGB8888 format, which is located in the RAM array.

from lvgl.

liamHowatt avatar liamHowatt commented on July 2, 2024

Interesting. Could you please send some code to reproduce the issue?

from lvgl.

iSetebos avatar iSetebos commented on July 2, 2024

Load image:

void CreatePngImage(T_PNG_IMAGE *Img, const char *mem, uint16_t size, uint16_t w, uint16_t h)
{
  Img->img = fbg_loadPNGFromMemory(mem, size);
  Img->img->data[2] = 4;
 uint32_t x, y, index = 0, color;
	for (uint32_t i=0; i<((w*h)); i++)
		{
			color = Img->img->data[index]<<16;
			color |= Img->img->data[index+1]<<8;
			color |= Img->img->data[index+2];
			if (color == 0xFF00FF)
			{
				Img->img->data[index] = 0;
				Img->img->data[index+1] = 0;
				Img->img->data[index+2] = 0;
				Img->img->data[index+3] = 0;
			}
			index += 4;
		}
 
  uint32_t *img_buff32 = (uint32_t *)(Img->img)->data;
 
  // swap color R<->B
  unsigned char *img_buff = (unsigned char *)(Img->img)->data;
  unsigned char tmp;
  
  for (uint32_t i=0; i<((w*h)); i++)
  {
    tmp = *img_buff;
    *img_buff     = *(img_buff+2);
    *(img_buff+2) = tmp;
    img_buff += 4;
  }
  //
  //Img->dsc.header.always_zero = 0;
  Img->dsc.header.w = w;
  Img->dsc.header.h = h;
  Img->dsc.header.cf = LV_COLOR_FORMAT_ARGB8888; //LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED; 
  Img->dsc.data = (unsigned char *)(Img->img)->data;  
  Img->dsc.data_size = w * h * LV_COLOR_DEPTH / 8;
}

Image display:

lv_obj_t * imgArrow;
CreatePngImage(&IMG.Arrow,      &_imageArrow,     392,  43,  44);
imgArrow= lv_img_create(osdDirHome.Panel);  
lv_img_set_src(imgArrow, &IMG.Arrow.dsc);
lv_obj_set_size(imgArrow, 43, 44);
lv_obj_set_pos(imgArrow, 48/2-43/2, 48/2-44/2);
lv_img_set_angle(imgArrow, (180+osdDirHome.Angel*10)%360);

from lvgl.

kisvegabor avatar kisvegabor commented on July 2, 2024

lv_img_set_angle(imgArrow, (180+osdDirHome.Angel*10)%360);

The angle is in 0.1° unit, so it should be:

lv_img_set_angle(imgArrow, (1800+osdDirHome.Angel*10)%3600); //1800 and %3600

from lvgl.

iSetebos avatar iSetebos commented on July 2, 2024

lv_img_set_angle(imgArrow, (180+osdDirHome.Angel*10)%360);

The angle is in 0.1° unit, so it should be:

lv_img_set_angle(imgArrow, (1800+osdDirHome.Angel*10)%3600); //1800 and %3600

I agree. But that's not the problem.

from lvgl.

liamHowatt avatar liamHowatt commented on July 2, 2024

I can't seem to reproduce it. Does it work perfectly when you don't set the angle?

from lvgl.

iSetebos avatar iSetebos commented on July 2, 2024

If the angle is 0, then everything works, in other cases the program hangs.

from lvgl.

liamHowatt avatar liamHowatt commented on July 2, 2024

You mentioned the CPU goes to 100%. There's a chance an LV_ASSERT failed and the default behavior is to spin forever (while(1);). Do you have a way of getting a stacktrace or some other way of finding out where it's failing?

from lvgl.

Related Issues (20)

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.