Announcement

Collapse
No announcement yet.

Image clipping on uLCD-32PT 4DGL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • oztastr
    replied


    http://hotfile.com/dl/110691394/b6bb6ee/menu_example.png.html

    Leave a comment:


  • oztastr
    replied


    #platform "uLCD-32PT_GFX2"
    #constant LEFT 30#constant TOP 150#constant TEXTWIDTH 2#constant TEXTHEIGHT 2
    #inherit "4DGL_16bitColours.fnc"#inherit "FONT4.fnt"

    #MODE RUNFLASH
    func buton ()
    //gfx_Cls();
    touch_Set(TOUCH_ENABLE);

    gfx_Button(UP, 40, 10, BLUE, RED, FONT4, 3, 3, " >> ");
    touch_DetectRegion(40, 10, gfx_Get(RIGHT_POS),gfx_Get(BOTTOM_POS));
    while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);
    gfx_Button(DOWN, 40, 10, RED, WHITE, FONT4, 3, 3, " >> ");while(touch_Get(TOUCH_STATUS) != TOUCH_RELEASED);


    endfunc


    func buton2()//x_Cls();
    touch_Set(TOUCH_ENABLE);

    gfx_Button(UP, 40, 250, BLUE, RED, FONT4, 3, 3, " >> ");
    touch_DetectRegion(40, 250, gfx_Get(RIGHT_POS),gfx_Get(BOTTOM_POS));
    while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);
    gfx_Button(DOWN, 40, 250, RED, WHITE, FONT4, 3, 3, " >> ");while(touch_Get(TOUCH_STATUS) != TOUCH_RELEASED);
    -span" size="1">endfunc

    func main()buton();buton2();
    txt_FontID(FONT1);txt_Set(TEXT_OPACITY, OPAQUE);txt_Set(TEXT_WIDTH,2);txt_Set(TEXT_HEIGHT,2);txt_MoveCursor(10,1);



    putstr("OZTAS ");pause(500);




    endfunc

    [hr]thank you for help
    I tryed some code for cafe menu but when push the button other one is push all the time and it's passive button. also I want to make when push the button change food pictures or some words and send seri port same time

    Leave a comment:


  • meldavia
    replied


    hiI have a uLCD-32PT with touch ,I want to make a small cafe menu, with a PC serial port can send the selected menu. help me please!..
    Crossed messages here oztastr, but please have a look at the code base, you should be able to make use of:-

    http://www.4dsystems.com.au/code/index.php?node=77&id=96
    (this opens a file, prints a selection in a button 'look alike' format)

    and

    http://www.4dsystems.com.au/code/index.php?node=75&id=75
    (this shows you how to send bytes to/from a host)

    Leave a comment:


  • ESPsupport
    replied


    Obviously, the original issue for this post still stands, though.
    Was that the clipping issue?

    If so, are you sure, thought it was fixed?

    Leave a comment:


  • oztastr
    replied


    hiI have a uLCD-32PT with touch ,I want to make a small cafe menu, with a PC serial port can send the selected menu. help me please!..

    Leave a comment:


  • chopperwalker
    replied


    Thank you, this version (2.9.0.13) has no issues displaying the animated GIFs and is much faster to load on a SD card than the older version that I was using. Obviously, the original issue for this post still stands, though.

    Leave a comment:


  • 4dTechSupport
    replied


    4D Workshop3 IDE has the latest Graphics Composer.

    Try following link. It has the same Graphics Composer that is included in 4D Workshop3 IDE plus the updated Graphics Composer User Guide.
    Graphics Composer Software

    I hope it will help.
    -Bilal

    Leave a comment:


  • chopperwalker
    replied


    What is the latest? because 2.1.3.0 is the one posted on 32PT product download page. I have tried the GC 3 (2.9.0.9) in the workshop menu, but I haven't managed to get things to display properly (red artifacts and placement issues with animated GIFs). I am sure that it could be due to my inexperience with the language.

    Leave a comment:


  • meldavia
    replied


    ah, not sure if its fully your problem, but you have a fairly old graphics composer.
    I suggest you download the latest one which is much better and fixed a lot of issues.

    Leave a comment:


  • chopperwalker
    replied


    GC 2.1.3.0 and PmmC uLCD-32PTGFX-R22.pmmc. The original full screen image was 320x240. The 640x320 image that I tried loaded into GC would set the location box width and height to 320x240, respectively. With cropping (box) selected or not (i didn't select it), it had width and height set to 640x320.

    GC has proved friendly to use; however, when I first started using it I struggled to load an animated GIF. The issue was that I had to choose a Movie and not an Image, otherwise the program would fail. Buttons and images in the program would load as a red "x" image and an "unhandled exception" error would occur. Just a heads-up.

    Thank you for the support.

    Leave a comment:


  • meldavia
    replied


    Hi chopperwalker,
    We are currently reviewing PmmC for Picaso for the next release, and have noted what you have mentioned and will base some testing on your examples.
    We post the findings and fixes towards the end of the week.

    What version of Graphics Composer are you using, the latest one did resolve some cropping issues? (and is much friendlier to use)

    Leave a comment:


  • chopperwalker
    replied


    I would appreciate any bit of feedback.

    I tried the same code with a 640x240 not knowing that GC would crop it to 320x240 despite not choosing to crop it. The difference was that the image showed up on startup with the above clipping code in place. Yet, it would still not move offscreen compeltely.

    Leave a comment:


  • chopperwalker
    replied


    I have been trying this code just after the clear screen function, but the image never appears.
    gfx_ClipWindow(0,0,320,240);
    gfx_Set(CLIPPING,ON);
    Like I said though, the image will scroll off screen left to -180px then it freezes the image in place. I noticed this behavior on another program I wrote that had three evenly spaced 100px images scroll on screen. Instead of them all scrolling together, I had to start them each at just off screen and scroll them individually until they were evenly spaced. I don't have that luxury with this setup, I need to use a full screen animated gif since transparent images aren't supported (right?).

    Leave a comment:


  • chopperwalker
    replied


    The code above drags the image back and forth fine until I reach -180 px where the image locks position, but the black box still moves. If I release and the first if condition is true, the image does not move.

    The ELSE statement under TOUCH_RELEASE was not updated, here it is:
    [quote] else // Slide image back to original position if not dragged far enough
    for(n:=horz;n

    Leave a comment:


  • chopperwalker
    replied
    The main function simply mounts the drive, sets orientation, and calls the following function. The idea is to be able to switch screens much like a smart phone. I have tried using the clipping functions, but if I declare it ON at the beginning of the following function the GIF doesn't even appear. right now this function will work until var horz reaches about -180px or where the image is -180px off screen. It will not work to right (not just because of the following coding, I gave up and just coded left movement).

    func lock()
    gfx_BGcolour(WHITE);
    gfx_Cls();

    setbaud(BAUD_2400);

    Ihndle := file_LoadImageControl("home_scr.dat", "home_scr.gci",1);
    img_SetPosition(Ihndle, lock_screen_gif, 0, 0); // set its position
    sys_SetTimerEvent(TIMER1,run_screen); // and we'll hook its event to timer 2
    sys_SetTimer(TIMER1,1);

    img_SetPosition(Ihndle, home_screen_bmp, 0, 0);

    com_Init(buffer,13,'\r\n');

    touch_Set(TOUCH_ENABLE); // enable the touch screen

    // now just stay in a loop
    repeat

    state := touch_Get(TOUCH_STATUS); // get touchscreen status
    x := touch_Get(TOUCH_GETX);

    if(state == TOUCH_PRESSED) // if there's a press
    xi := x;
    endif

    if(state == TOUCH_RELEASED) // if there's a release
    xf := x;
    horz := xf-xi; // calculate distance draged from touch point
    txt_MoveCursor(0,0);
    if (horz<=-160) // Slide image off screen if dragged more than 160px
    for(n:=horz;n>=-320;n:=n-10)
    img_SetPosition(Ihndle, lock_screen_gif, n, 0);
    img_Show(Ihndle, lock_screen_gif);
    next

    print("Power");
    else if (horz>=-10) // Hold for significant movement
    img_SetPosition(Ihndle, lock_screen_gif, 0, 0);
    sys_SetTimer(TIMER1,1);
    else // Slide image back to original position if not dragged far enough
    horz := 320+horz;
    for(n:=horz;n<=320;n:=n+10)
    img_SetPosition(Ihndle, lock_screen_gif, n, 0);
    img_Show(Ihndle, lock_screen_gif);
    next
    sys_SetTimer(TIMER1,1);
    endif

    endif

    if(state == TOUCH_MOVING) // if there's movement
    horz := x-xi; // calculate distance draged from touch point
    if (horz<=-10)
    sys_SetTimer(TIMER1,0); // pause animated gif
    img_SetPosition(Ihndle, lock_screen_gif, horz, 0); // set its position
    img_Show(Ihndle, lock_screen_gif);
    gfx_RectangleFilled(320+horz,0,320,240,BLACK); // draw box to hide image movement artifacts
    txt_MoveCursor(1,1);
    print(horz); // debug place value
    else
    endif
    endif
    forever

    Leave a comment:

Working...
X