logo
down
shadow

Rotating an image Delphi XE7


Rotating an image Delphi XE7

By : hunglq
Date : November 22 2020, 10:40 AM
fixed the issue. Will look into that further FireMonkey controls have RotationCenter and RotationAngle properties. Load your needle image into a TImage component, position it over the dashboard and set its RotationCenter, then you can adjust the RotationAngle when needed.
code :


Share : facebook icon twitter icon
Swapping a UIImageView's image while rotating and moving leaves traces of original image

Swapping a UIImageView's image while rotating and moving leaves traces of original image


By : user3291721
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Try swapping the image in the completion block. (currently nil)
edit: If they are substantially different, you can use a second UIImageView. Fade one out while you fade one in. You can either do this while they are translating, or wait for the "shrunken" original to arrive and fade it out while the "better" smaller version fades in.
Rotating an OCX control in Delphi 7?

Rotating an OCX control in Delphi 7?


By : Wojteo
Date : March 29 2020, 07:55 AM
I hope this helps . I can only answer the first of your questions. There is no way to rotate the control itself. If the control doesn't allow rotating the image, you will have to find another control.
How can I replace the bitmap image after rotating the original image stored any where in the mobile?

How can I replace the bitmap image after rotating the original image stored any where in the mobile?


By : Bhushan Mahajan
Date : March 29 2020, 07:55 AM
Does that help I have got answer of this question. Inspite of using above code I have used:
code :
OutputStream fOut = null;
                File file = new File(imagePath);
                try {
                    fOut = new FileOutputStream(file);
                    } catch (FileNotFoundException e) {

                    e.printStackTrace();
                }
                resizeBitmap.compress(Bitmap.CompressFormat.JPEG, 85, fOut);

            //---------------Used Media Scanner-----------
                sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri
                        .parse("file://" + Environment.getExternalStorageDirectory())));
delphi and opengl: light is rotating with the cube

delphi and opengl: light is rotating with the cube


By : Elias Becerra
Date : March 29 2020, 07:55 AM
Hope this helps i can spot a couple of things awry.
Firstly: your Normals are inconsistent. Change to
code :
FrontNormal: TGLvectorf3=(0,0,1);
BackNormal: TGLvectorf3 =(0,0,-1);
LeftNormal: TGLvectorf3 =(1,0,0);
RightNormal: TGLvectorf3=(-1,0,0);
UpNormal: TGLvectorf3   =(0,-1,0);
DownNormal: TGLvectorf3 =(0,1,0);
procedure TForm2.FormResize(Sender: TObject);
  var tmpBool:boolean;
begin
  glViewport(0,0,ClientWidth,ClientHeight);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity;
  gluPerspective(45.0,ClientWidth/ClientHeight,NearClipping,FarClipping);
  idleHandler(Sender, tmpBool);
end;
procedure TForm2.SetupGL;
begin
  glClearColor(0.3,0.4,0.7,0.0);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_SMOOTH);
  glDepthFunc(GL_LEQUAL);
  glEnable(GL_TEXTURE_2D);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity;
  gluLookAt(-2, 3, -3, 0,0,0, 0,1,0);
  uzglLightEnable;
  LightPos[0]:=0;
  LightPos[1]:=0;
  LightPos[2]:=1;
  LightPos[3]:=1;
end;
procedure TForm2.Render;
var i:integer;
begin
  glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);

  glMatrixMode(GL_MODELVIEW);
  glPushMatrix;
  glRotatef(XRot,1,0,0);
  uzglCube;

  if FTransformLights then
  begin
    glLightfv(GL_LIGHT0, GL_POSITION,@LightPos);
    glPopMatrix;
  end
  else
  begin
    glPopMatrix;
    glLightfv(GL_LIGHT0, GL_POSITION,@LightPos);
  end;

  SwapBuffers(dc);

  XRot:=XRot+1;
end;
unit MainUnit;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,     Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,dglOpenGL;

type
  TFMainForm = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    FTransformLights:Boolean;
    procedure SetupGL;
    procedure uzglLightEnable;
    procedure IdleHandler(Sender : TObject; var Done : Boolean);
  public
    procedure Render;
  end;

var
  FMainForm: TFMainForm;
  dc:hdc;
  hrc:hglrc;
  XRot,YRot,ZRot:Single;

  LightPos:TGLArrayf4;
  BlueArray:TGLArrayf4;
  GreenArray:TGLArrayf4;
  myTex: glUint;

  FrontNormal: TGLvectorf3=(0,0,1);
  BackNormal: TGLvectorf3 =(0,0,-1);
  LeftNormal: TGLvectorf3 =(1,0,0);
  RightNormal: TGLvectorf3=(-1,0,0);
  UpNormal: TGLvectorf3   =(0,-1,0);
  DownNormal: TGLvectorf3 =(0,1,0);

  FrontDownLeft :TGLvectorf3 = (-1,-1,-1);
  FrontDownRight:TGLvectorf3 = (1,-1,-1);
  FrontUpLeft   :TGLvectorf3 = (-1,1,-1);
  FrontUpRight  :TGLvectorf3 = (1,1,-1);

  BackDownLeft :TGLvectorf3 = (-1,-1,1);
  BackDownRight:TGLvectorf3 = (1,-1,1);
  BackUpLeft   :TGLvectorf3 = (-1,1,1);
  BackUpRight  :TGLvectorf3 = (1,1,1);


const
  NearClipping = 0.1;
  FarClipping  = 200;

  procedure uzglTriangle(x1,y1,z1,x2,y2,z2,x3,y3,z3:single);
  procedure uzglCube;

implementation

{$R *.dfm}



  procedure uzglTriangle(x1,y1,z1,x2,y2,z2,x3,y3,z3:single);
  begin
    glBegin(GL_TRIANGLES);
    glColor3f(0.3,0,0);glVertex3f(x1,y1,z1);
    glColor3f(0.25,1,0);glVertex3f(x2,y2,z2);
    glColor3f(0.7,0,1);glVertex3f(x3,y3,z3);
    glEnd;

  end;

  procedure uzglCube;
  begin
    glBegin(GL_QUADS);
      // Beginning of front
      glNormal3fv(@FrontNormal);
      glVertex3fv(@FrontDownLeft);
      glVertex3fv(@FrontDownRight);
      glVertex3fv(@FrontUpRight);
      glVertex3fv(@FrontUpLeft);
      // End of front
    glEnd;


    glBegin(GL_QUADS);
      // Beginning of left
      glNormal3fv(@LeftNormal);
      glVertex3fv(@FrontDownLeft);
      glVertex3fv(@FrontUpLeft);
      glVertex3fv(@BackUpLeft);
      glVertex3fv(@BackDownLeft);
      // End of left
    glEnd;

    glBegin(GL_QUADS);
      // Beginning of right
      glNormal3fv(@RightNormal);
      glVertex3fv(@FrontDownRight);
      glVertex3fv(@FrontUpRight);
      glVertex3fv(@BackUpRight);
      glVertex3fv(@BackDownRight);
      // End of right
    glEnd;

    glBegin(GL_QUADS);
      // Beginning of up
      glNormal3fv(@UpNormal);
      glVertex3fv(@FrontUpRight);
      glVertex3fv(@FrontUpLeft);
      glVertex3fv(@BackUpLeft);
      glVertex3fv(@BackUpRight);
      // End of up
    glEnd;

    glBegin(GL_QUADS);
      // Beginning of down
      glNormal3fv(@DownNormal);
      glVertex3fv(@FrontDownRight);
      glVertex3fv(@FrontDownLeft);
      glVertex3fv(@BackDownLeft);
      glVertex3fv(@BackDownRight);
      // End of down
    glEnd;

    glBegin(GL_QUADS);
      // Beginning of back
      glNormal3fv(@BackNormal);
      glVertex3fv(@BackDownLeft);
      glVertex3fv(@BackDownRight);
      glVertex3fv(@BackUpRight);
      glVertex3fv(@BackUpLeft);
      // End of back
    glEnd;
  end;

  procedure TFMainForm.SetupGL;
  begin
    glClearColor(0.3,0.4,0.7,0.0);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_SMOOTH);
    glDepthFunc(GL_LEQUAL);
    glEnable(GL_TEXTURE_2D);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity;
    gluLookAt(-2, 3, -3, 0,0,0, 0,1,0);
    uzglLightEnable;
    LightPos[0]:=0;
    LightPos[1]:=0;
    LightPos[2]:=1;
    LightPos[3]:=1;
  end;

  procedure TFMainForm.uzglLightEnable;
  begin
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_COLOR_MATERIAL);
  end;

  procedure TFMainForm.Render;
  begin
    glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW);
    glPushMatrix;
    glRotatef(XRot,1,0,0);
    uzglCube;

    if FTransformLights then
    begin
      glLightfv(GL_LIGHT0, GL_POSITION,@LightPos);
      glPopMatrix;
    end
    else
    begin
      glPopMatrix;
      glLightfv(GL_LIGHT0, GL_POSITION,@LightPos);
    end;

    SwapBuffers(dc);

    XRot:=XRot+1;
  end;

  procedure TFMainForm.IdleHandler(Sender : TObject; var Done : Boolean);
  begin
    Render;
    Sleep(25);
    Done:=false;
  end;

  procedure TFMainForm.FormCreate(Sender: TObject);
  begin
    dc:=GetDC(Handle);

    if not InitOpenGL then
                      begin
                      ShowMessage('????????... ????????????? ???????????');
                      Application.Terminate;
                      end;
    hrc:=CreateRenderingContext       (dc,
                                       [opDoubleBuffered],
                                       32,
                                       24,
                                       8,
                                       0,
                                       0,
                                       0);

    ActivateRenderingContext(dc,hrc);
    FTransformLights:=false;
    SetupGL;
    Application.OnIdle:=IdleHandler;

    FMainForm.OnResize(self);
  end;



  procedure TFMainForm.FormResize(Sender: TObject);
    var tmpBool:boolean;
  begin
    glViewport(0,0,ClientWidth,ClientHeight);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity;
    gluPerspective(45.0,ClientWidth/ClientHeight,NearClipping,FarClipping);


    idleHandler(Sender, tmpBool);
  end;


  procedure TFMainForm.FormDestroy(Sender: TObject);
  begin
    DeactivateRenderingContext;
    DestroyRenderingContext(hrc);
    ReleaseDC(Handle,dc);
  end;


  procedure TFMainForm.FormKeyPress(Sender: TObject; var Key: Char);
  begin

    case key of
    'q':LightPos[0]:=LightPos[0]+0.1;
    'a':LightPos[0]:=LightPos[0]-0.1;
    'w':LightPos[1]:=LightPos[1]+0.1;
    's':LightPos[1]:=LightPos[1]-0.1;
    'e':LightPos[2]:=LightPos[2]+0.1;
    'd':LightPos[2]:=LightPos[2]-0.1;
    'x':FTransformLights:=NOT FTransformLights;
    end;
  end;

end.
jQuery - Rotating an image on click and rotating back the next click

jQuery - Rotating an image on click and rotating back the next click


By : jadeja yogitaba
Date : March 29 2020, 07:55 AM
hope this fix your issue You missed the point of toggleClass a little. Your rotate class should have the rotated styles. when you call .css(), you're setting the css of the element directly, which is why only the first click seems to work - it sets those exact css styles each time. The rotate class doesn't exist, so toggling it doesn't change the appearance:
http://jsfiddle.net/6xFbF/
code :
$(".arrow").on("click", function () {
    $(this).toggleClass("rotate");
});
.rotate {
    -moz-transform: rotate(-90deg);
    -webkit-transform: rotate(-90deg);
    -ms-transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
}
Related Posts Related Posts :
  • IBtransaction and Firebird for a multi-user program
  • Clearing all DataSet Bookmarks
  • How is TClientDataSet sending SQL statements on ApplyUpdates
  • Which is current correct indy and open ssl versions to use with delphi2007
  • Delphi Xe2: WH_KEYBOARD won't return left-right virtual key codes
  • Collecting a list/table of version specific information for RAD Studio/Delphi/C++ Builder related development environmen
  • delphi 2009, interface already released
  • chained proxy in delphi
  • Use VCL Styles From Delphi XE7 to Delphi XE2
  • Understanding waitable timers
  • Delphi Created Images are not displayed
  • former worked code does not work
  • Formatsettings of client are changing when printing in Firemonkey
  • Why does Delphi XE7 IDE hangs and fails on out of memory exception?
  • How to build delphi projects for WIN64 when units inside it uses DesignEditors DesignIntf?
  • Cannot Destroy Dynamically created Menu Item in Delphi
  • How can I set a message unread?? with delphi 7 and imap from indy10
  • How can I save a TTreeview to Windows and keep its hierarchical structure?
  • Nullable scalar types and LiveBindings
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org