msokalski

Registered: 27/06/12
Posts: 16
|
| Posted 18/07/12 at 04:49 PM | Reply with quote #1 |
|
Hi, I'm trying to slide full display width image (128px) across display from left to right. When it is clipped by left edge of display it works fine, but when it is supposed to be clipped by right edge the image is corrupted.
It happens probably because Goldelox registers are signed bytes, so setting right clipping edge to let say 127+20 in fact is -109. I was almost sure that goldelox internally will check if X2>X1 and it will treat X2 in unwrapped way, but I was wrong.
Could you help me to solve the problem in another way? Please note that I use RAW uSD blitting instead of gci thing.
Here's a code:
media_SetAdd(hi,lo);
// slide varies from -127 to 127
if (slide<=0) // ok gfx_ClipWindow(slide,y,slide+127,127); gfx_FocusWindow(); else // corrupted image gfx_ClipWindow(slide,y,slide+127,127); gfx_FocusWindow(); endif
disp_BlitPixelsFromMedia(rows<<7);
Thanks for your help in advance. Marcin
|
| Loading... | |
ESPsupport
Moderator
Registered: 27/01/09
Posts: 4,254
|
| Posted 18/07/12 at 05:39 PM | Reply with quote #2 |
|
disp_BlitPixelsFromMedia just puts data from the card to the display, it cannot clip anything, it is 'raw'
Try using media_Image, media_video, or media_VideoFrame to make clipping work. |
| Loading... | |
msokalski

Registered: 27/06/12
Posts: 16
|
| Posted 18/07/12 at 06:49 PM | Reply with quote #3 |
|
Thanks, good to know that clipping won't work with disp_BlitXXX. Because my images on uSD are not prefixed with width,height,bits,delay,... header, is there any way to use media_XXX functions with it by pokeing some registers with required width & height or I really have to insert such headers into SD?
Marcin. |
| Loading... | |
ESPsupport
Moderator
Registered: 27/01/09
Posts: 4,254
|
| Posted 18/07/12 at 08:23 PM | Reply with quote #4 |
|
| In that case you need to use a combination of disp_SkipPixelsFromMedia and disp_BlitPixelsFromMedia |
| Loading... | |
msokalski

Registered: 27/06/12
Posts: 16
|
| Posted 18/07/12 at 08:47 PM | Reply with quote #5 |
|
Yes, I'd llike to, but couldn't find any sample making use of this. Do I need to call skip for each row being blitted? Sounds slow to me. Is media_VideoFrame with clipping enabled working in that way?
Maricin.
|
| Loading... | |
ESPsupport
Moderator
Registered: 27/01/09
Posts: 4,254
|
| Posted 18/07/12 at 08:55 PM | Reply with quote #6 |
|
Yes and yes. Try it and see.
Obviously if you could efficiently call it (i.e. 1 skip per row rather than 2 it will be a bit faster, but see how it goes) |
| Loading... | |
msokalski

Registered: 27/06/12
Posts: 16
|
| Posted 18/07/12 at 11:01 PM | Reply with quote #7 |
|
Seams I'm not able to run any out of 2 methods.
1. I've inserted gci video header to sd but nutting is rendered. (text is not overdrawn). What can be wrong then?
code:
txt_BGcolour(0x0000); txt_FGcolour(0xffff); txt_MoveCursor(0,0); media_SetAdd(0x012D,0xC5F8); print(media_ReadWord(),"\n"); print(media_ReadWord(),"\n"); print(media_ReadWord(),"\n"); print(media_ReadWord(),"\n");
media_SetAdd(0x012D,0xC5F8); media_VideoFrame(0,0,0);
Txt output is: 128,114,4097,1 - from what is in FAQ it should be correct.
2. I failed to make use of disp_SkipPixelsFromMedia, it doesn't advance current media nor gram pointers, could you post a small sample using it?
Marcin. |
| Loading... | |
msokalski

Registered: 27/06/12
Posts: 16
|
| Posted 19/07/12 at 03:19 AM | Reply with quote #8 |
|
Got it! I just figured out that video header should begin on sector boundary, then media_VideoFrame() works fine.
Performance of media_VideoFrame() with clipping enabled is about 2 times slower than 'raw' disp_BlitPixelsFromMedia(). Much slower but still feasible.
Final thought: Its quite weird that I can use disp_BlitPixelsFromMedia() when image is being clipped by left display edge, but if it is going more than 2 pixels out of right edge I have to use clipping and media_VideoFrame.
Can I expect any future pmmc release would solve right edge clipping with disp_BlitPixelsFromMedia() in order to get some speed up?
Thanks for your help.
|
| Loading... | |
ESPsupport
Moderator
Registered: 27/01/09
Posts: 4,254
|
| Posted 19/07/12 at 08:03 AM | Reply with quote #9 |
|
| The left edge clipping is being done 'by accident' by the hardware controller in the glass. It is more lucky than by design. We have no control over that part of the display |
| Loading... | |
msokalski

Registered: 27/06/12
Posts: 16
|
| Posted 25/07/12 at 07:23 PM | Reply with quote #10 |
|
| I'm going to switch from uLCD144 to uOLED128, can I expect that at least left clipping will be done in glass too? |
| Loading... | |
ESPsupport
Moderator
Registered: 27/01/09
Posts: 4,254
|
| Posted 25/07/12 at 07:53 PM | Reply with quote #11 |
|
| Don't know, you'll hve to try it |
| Loading... | |