Positioning of moving image

I have a field that extends BitmapField (called AnimatedGIFField) and an AnimatorThread (which extends from Thread) who does the work of a loop through the images GIF, image current and crippling incrementing field, which calls the method object to draw the following picture (resulting in animation).  The animation code works very well, but my problem is in the method object of the AnimatedGIFField class.  I call "graphics.drawImage ()" and I can't get the stations suitable for x and y (the first two args to drawImage()).  Positioning of the AnimatedGIFField works and is made by substituting 'getPreferredWidth()' and 'getPreferredHeight().  The corresponding code is here:

public class AnimatedGIFField extends BitmapField {

    /**
      The current frame in the animation sequence; the AnimatorThread
      increments this so paint() knows which frame to draw.
    */
    private int currentFrame;

    public AnimatedGIFField(GIFEncodedImage image, long style) {
        super(image.getBitmap(), style);
        this.image = image;
        this.preferredWidth  = this.image.getWidth();
        this.preferredHeight = -(this.image.getHeight() * 4);
    }

    protected void paint(Graphics graphics) {
        // Calling super draws the first background frame.
        super.paint(graphics);

        // Don't redraw if this is the first frame.
        if (this.currentFrame != 0) {
            // Draw the animation frame.

            /* getFrameLeft() and getFrameTop() both return the top left-most position (0, 0). */
            /* graphics.drawImage(this.image.getFrameLeft(this.currentFrame), */
            /*                    this.image.getFrameTop(this.currentFrame), */
            /*                    this.image.getFrameWidth(this.currentFrame), */
            /*                    this.image.getFrameHeight(this.currentFrame), */
            /*                    this.image, this.currentFrame, 0, 0); */

            /*
              Currently trying some hackish nonsense like this to position the frame, although
              it probably won't scale properly across different devices/screen sizes.
            */
            int x = (this.getManager().getWidth() / 2) - 45;
            int y = (this.getManager().getHeight() / 2) + 83;

            graphics.drawImage(x, y,
                               this.image.getFrameWidth(this.currentFrame),
                               this.image.getFrameHeight(this.currentFrame),
                               this.image, this.currentFrame, 0, 0);
        }
    }
}

Unfortunately, what you are trying to reach is not very clear. Where exactly you want to position your image? You want all managers to paint in the same place (I assume you are)?

On the default width / height favorite:

  • You have a very strange calculation for this.preferredHeight.
  • You don't show your getPreferredWidth/getPreferredHeight methods.
  • Even if you have some perfect getPreferredWidth / getPreferredHeight methods, they are irrelevant for your field positioning and size. It's ironic but true.

Anyway, here is an approach to work more:

1. as you extend a BitmapField, you need to define your size, the default width and height preferred - it will automatically solve of the superclass.

2 x and compared to the internal coordinates of the field, you have to put two zeros here (literally, drawImage (0, 0,...))

3. instead of the substitution of object, you can easily call setBitmap (image.getBitmap (currentFrame)) and it will work only (setBitmap modifies the bitmap and invalid field).

4. If you use setBitmap, you need not to extend BitmapField - use the native one and do all the manipulation of the image in the animation thread.

Tags: BlackBerry Developers

Similar Questions

  • Some images do not appear after moving images from one folder to another

    Lost photo should find I was moving images from one folder to another.  He said that I had this picture in the folder.  Then he asked if I wanted to replace the existing image.  I said yes.  Now I miss several photos and cannot find anywhere - but some went through.  I need these photos in return.  Any ideas on how to get back them?  Thank you

    I was moving images from one folder to another.  He said that I had this picture in the folder.  Then he asked if I wanted to replace the existing image.  I said yes.  Now I miss several photos and cannot find anywhere - but some went through.  I need these photos in return.  Any ideas on how to get back them?  Thank you

    ======================================
    The dialog box asking if you want to "replace the existing image.
    occurs when the target folder contains a file with the same
    name that you are moving.

    Unfortunately... when a file is overwritten (replaced) with another
    file of the same name... the original is unrecoverable.

    There is a slight possibility... If the photos had been altered in
    Windows Live Photo Gallery... the unreleased original versions which
    could be cancelled in may still be in the following folder:

    C:\Users\\Appdata\Local\Microsoft\Windows Gallery\Original photos.

    Good luck...

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • wallpaper will change the position of the image

    HP Pavilion dv7t 2200 - I put one of my pictures as wallpaper, but the position of the image is stuck on "limousine."  I try to choose other positions of the photo and clicking "save changes", but nothing happens - always stays on "stretch".

    Does anyone have a solution for this?

    Well you didn't say what OS your running, but if windows 7, use this link http://h10025.www1.hp.com/ewfrf/wc/softwareList?os=4063&lc=en&dlc=en&cc=us&lang=en&product=3999449 and at the bottom, install the screen background picture position enabler

  • The positioning of the image Windows 7 Home premium 64-bit background will not change

    So I can change my background very well, but the position of the image, I can't. Position as in, tile, stretch, Center, filling and adjustment. I think he's stuck on stretch. I read a bit about it on the forums and some people were saying to install a "facilitator of photo wallpaper". I tried to install this and it did not work. I am not finding other solutions, so I don't know what to do =)

    Good question. Not sure, but it seems to have something to do with the aspect ratio.
    For example -.
    I have pictures on the internet that measure, 2220 x 1476, 960 x 540, 954 x 534, and 700 x 467 pixels.
    and options of wallpaper does not allow for anything other than full screen on any of them.
    The same is true if I convert photos in 1920 X 1080 (the native resolution of my screen).

    However if you use a photo with a resolution that measures say, 800 x 600, 2048 x 1536,.
    (the res native to my camera), it will appear with the different options available in the
    Customize the wallpaper option.

    If I use Photoshop (or similar) to change the size of say, 954 x 534 at 800 x 600 or 1280 x 1024.
    the options are available.

  • Position of the image in the Bootstrap model "carousel."

    I thought I would take a shot to boot. There is a starter template in Dreamweaver that does more or less what I want. But I have a problem of tiny design that I can not really the solution. Maybe can someone help?

    I use the included slide show 'Carousel', but I don't think that the proportions of the image should be the same regardless of the size of the viewport. With a large window, I don't want the image in full height, I want not cropped. That's why I added a 'max-height' to the box containing the image. It works very well and the height of the image does never exceed my max value.

    But: the position of the image in the box limited height is not centered vertically. The image is cropped just at the bottom of the box, while I love to crop the top and bottom. I tried many ways to center the image but failed. Normally this wouldn't be a problem for me, but since I am changing the design to someone else, there seems to be something that I don't get.

    This is a simple example of site showing my problem: http://www.linnsideout.se/imgtest/

    That's what I want to with large windows:

    header-1a.jpg

    And that's what I get:

    header-1b.jpg

    Everybody out there is able to tell me the css tricks necessary to center the image vertically at the start of the crop box?

    The way you have the sample is the way it should work. It's because you used the fluid container. If you use just the containing class, you would have cut offs for each device. In this case, you can use the image just for this device.

    Take a look at the use of srcset to load the images. Take a look at the sensitive Images: If you are simply changing resolution, use srcset. | CSS-Tricks

  • Make very small adjustments of position of the image without using a mouse

    First Elements 14.  I want to set the position of a background image used in a title of movement.  I am able to select the background image.  However, the only way to move/adjust the position of the image is to use the mouse.  With the help of the mouse gives me enough "micro movement."  The mouse's movements that are too large.  How to use the keyboard to make the mirco-fine adjustments to the position of the image?

    Thank you.

    Is - this context in the title of the Motion itself? If so, micro adjustments can be difficult.

    However, if you set the background of the title of transparent movement and put the background on the video track below, you can make very specific changes to the background by going to apply effects/Motion and Position adjustment digitally.

  • Animation of the PNG files for move of moving images?

    Hi, I have a small project right now and want to go a little overboard with the PNG animation files.

    So I have a moving image, I'm standing on a skateboard and shoot down the floor see photo:

    Screen Shot 2015-04-19 at 12.06.50.png

    And the picture is rolling forward for about 10 seconds, and I want to animate a work of artists around the Board. See photo (photoshop gross just to show you)

    Screen Shot 2015-04-19 at 12.12.42.png

    So that the work is in PNG format and I want to animate it such that the Council continues to roll, by animate, I mean simply move or "jiggy" it, is difficult to explain.

    What are my options?  I thought maybe After Effects, but I'm not even too hard on this one here.

    Any help appreciated.

    so maybe it's time to yourself in after effects a little

    Try this, if you want to learn a bit of sequels:

    (it takes about 5 minutes)

    (so much worse that this screenshot is in German, you will find your way around)

    1 duplicate the video clip of skateboarding in your tieline on a video on track (Alt + drag) [just to keep a copy of it below, if you might need it]

    2. right-click the new clip in the timeline panel and choose "replace with After Effects Composition.

    After effects opens (if not already open) and you get a new composition based on your first - chronology.
    Import your artwork, make sure that it is big enough so you can turn without seeing its edges...
    -Drag in the composition above the clip.

    3 right-click in the left part of your composition window, and then choose "new solid" to do a matte.

    4 turn off the visibility of the layer ("eye-icon")

    4B. take the tool pen (P) and draw a mask around skateboarding. (= add mask mode)

    5. set the work track matte layers to ' Alpha 'name of your matte.

    6. with the "pan behind"-tool (shortcut: y) [work layer must be selected] move the anchor point to where you want as the center of rotation to be.

    7. with the layer of the work still selected, press R to display the parameters of rotation.

    8 alt-click on the stopwatch for the rotation animation

    9 type time * 36 in the expression window. (the number will be the degree of rotation per second, so 36 you will get a full evolution by ten seconds. change this value, according to the needs: plus = faster.)

    10. keep

    11 Preview ram (zero on the numeric keypad) and see if you like what you've done...

    12 economy

    13. head back to creation and happy editing.

    ... 14 after effects CC tutorials | Learn how to use after effects CC

    15: learn After Effects, get help and support. Adobe After Affects CC

    16. after effects basic training

  • OBIEE 11 g title view position of the Image

    Hi all

    Is it possible to change the position of the image title vision in OBIEE 11 g. By default the image is coming up on the left side... In my report, I want to display on the right side...

    Guys please help...

    Concerning

    To achieve this, you will need a custom skin (you can change the original file, but I wouldn't have to do this!).

    The control file rendered with regard to the display of the title of the GUI is in the msgdb. This is the/messages/standardviewtemplates.xml. New: Please follow the process to create a custom look and put her updated the standardviewtemplates.xml.

    Changes must be made here:

    Standard:

    
      
        
            
                
                
                

    After the changes:

    
      
        

    Basically you swap the order of the Logo-> title-> title-> help-> Logo helps. This way, you know what is happening in the doce above and do title-> Logo--> help if you want.

    These changes are application-level everywhere where the custom skin is used (or just applciation-wide full stop if you change the original file).

  • How to control the position of an image of hero slideshow lightbox

    How can I control the position of a hero image in a lightbox slideshow?  Everything I've tried has no effect.  I hope I'm wrong, but t that appears when the lightbox option is selected, that there is no control on the position or the image of hero on the Web page.  I my case, I want to push it higher on the page to make room for a great legend.

    Lightbox will appear the image in the Center on the page, if you want to change the position, you must apply some javascript from your end, there is no direct way to Muse to do.

    Thank you

    Sanjit

  • A div is not correctly positioned on an image.

    a page only for the moment.

    http://tdws.azurewebsites.NET/samples/commscaf/

    The problem I have is that the box with the red border is supposed to rest on the top of the image instead of resting in the border.

    I got to the border there to develop according to the browser.   (a background image comes here eventually.)

    sample.jpg

    I have absolute and relative positioning together but do not know how to anchor this box in position over the image.

    Thanks in advance for any comments.

    PS - I put the css code in the document that people can see the code I have.

    #banner {}

    Width: 960px;

    min-height: 300px;

    position: relative; / * to control the absolute positioned child elements * /.

    }

    / * adjust the values of top, left as Req'd * /.

    {#bannerBlock}

    position: absolute;

    top: 150px;

    left: 250px;

    border: crete thick #F00;

    border-radius: 16px;

    background-color: #CCC;

    padding: 5px;

    Width: 300px;

    z-index: 100;

    }

    Nancy O.

  • Difficulty of positioning of the images using widgets

    First, I will start by saying that I really, really, really want to love this program and work with it regularly. I've been an evangelist for her and love the whole proposition that a design for the Internet much less expensive and much more intuitive. So thanks, Adobe for doing things in the right direction.

    That said, I think Muse is always incredibly full of bugs, and working with her is far from being as smooth as it should be now that users are required to pay a monthly fee. I'm still on the fence about whether to take the plunge at the end of the 30 day trial. (Resolution of this case will go a long way to convince me.)

    Widgets have proven one of the tools more difficult to manage in the arsenal of the Muse, which is what brings me here tonight. The problem I have is the scaling and positioning of the images using the slide show - and have it stay like that.

    I am able to move the image of Heroes (largest) then it is placed and scaled properly, but I can only do this with a single image at a time. As soon as I'll do to evolve a second hero image to match the first one returns to the default size and the introduction and the second is correct.

    As shown in the first selection of the screen, the image of hero on the right is sized correctly to align with the top and bottom of the thumbnail grid.

    Screen Shot 2012-06-20 at 12.16.42 AM.png

    But it will happen only this trick once. All other images of Heroes change size, move to the Center or the float everywhere where they wish, as shown below.

    Screen Shot 2012-06-20 at 12.16.27 AM.png

    It is a model that is extremely frustrating, and if cannot be resolved, I'll have to give up Muse as the solution to this design problem.

    Help, please! (Thank you.)



    OK, I finally diagnosed the problem, the solution was not very intuitive. In fact, I realized only the answer when I went on the site for export as HTML.

    Because the images of Heroes was put across the slightly larger that the suggested size, I discovered that if you go to the assets Panel and right click on the title of the image (which has a small plus sign next to it to indicate the difference in size), it invites you to "import more large size of the image" (maybe this isn't the precise language (, but it is an option that sounds almost exactly like that).

    Once you do this for each image, they are no longer returned to the small size or random placement. They're going where they are supposed to and they seem to stay there.

    So I'm happy to announce, case closed.

  • Fetch the position of the image in a particular page...

    Dear all,

    I need to get the position of the image of a page of a pdf document (i.e. the top Postion, position of the position of the left, the position of the right).

    Please guide me through

    The respect of

    Amith Sai

    I think it's PDEElementGetBBox().  Of course, you will need to make many calls to find all images on each page...

    Again, there are samples in the SDK, you should look!

  • label receive the position of an image

    Staff attend a very concrete example

    I have a label and an image

    the image has the coordinates X and Y,

    I would like to label received the X position of the image

    because there was an id for the image, and gets it to label the X coordinate of the coordinated image X = "(id.??}", propriété que j'utilise dans ce cas?) "


    and if I wanted to add the coordinate received another value for example x = "(ID? (+ 2)"work?

    This causes the labels x position to stay as the images as its limit to it.  Event if you a feature of dragging the image and move the label will follow.  Maybe I'm not understanding what you're trying to do.

    Can you be a little more descriptive?

  • Create a DVD combining Jpeg photos and moving images MP4

    With a camera Sony DSC H 70, we took still photos, panoramic shots and and animated images that are in the MP 4 format.

    With PMB, we can see the images in motion like a reading of films.

    How can we create a DVD that reads in fashion Pan panning and moving like a movie images.

    With a camera Sony DSC H 70, we took still photos, panoramic shots and and animated images that are in the MP 4 format.

    With PMB, we can see the images in motion like a reading of films.

    How can we create a DVD that reads in fashion Pan panning and moving like a movie images.

    ==========================================

    You can do the Panning... with Photo Story 3.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    PhotoStory 3 for Windows
    http://www.Microsoft.com/download/en/details.aspx?ID=11132
    (works on XP, Vista and?) Win7?)

    This is not a full tutorial, but should be enough to help you started...

    First be sure that the photo is less than 7200 x 7200 pixels pixels.

    Import a panoramic photo in Photo Story 3 and move on
    the screen "tell your photos and customize the animation."
    (do not remove the black borders)

    On the left, click Custom animation...

    Check the box on the screen to customize the animation...... "specify
    Start and end Position of the movement "." Resize and reposition the
    Start management Position and final Position you prefer and
    on the left, click the Preview button to see the result.

    Also you can import multiple instances of a photo and
    Pan from point A to point B in the first instance,... then point B
    point c on the second instance and so on.

    When the effects of movement are completed you can add music if
    you want and go to the screen "Save Your Story."

    You can left click on the 'Settings' button for several choices of
    resolution... the profile of 1024 x 768 is perhaps a good choice.

    Also... Choose a backup location and a name for your video.

    To save the project as a. WMV video file... click Next
    last time.

    Then you can import that video as well as other photos and
    video clips in DVD Maker to create your DVD. If you have
    problems with the video clips you may need to convert to MP4
    paste them into WMV format before importing in creation of DVD.

  • moving images

    Why my images are moving when I go to preview? In addition, some of my information does not appear when I click on preview as well. Parts of my footer is happening everywhere on my other pages as well.

    Standard answer: lack of structure in your page. Stuff tends to move when you do not use grouping and widgets and just throw everything on the page with absolute positioning, which then of course breaks when displaying things in browsers with different sizes, because the elements do not meet another. Things like breakpoints and how Muse (mal-) deals with the different formatting rules are also included in here, but basically, you will probably need to start over and have a plan to include considerations about the actual structure and not just the visual aspect.

    Mylenium

  • Maybe you are looking for