FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   Centering an object
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Centering an object  (Read 875 times)
Nekochan =^.^=

Email
Centering an object
« on: Sep 6th, 2003, 2:38am »

I know there's a formula or something for this, but how does one center a picture in the space? You know, so the middle of the picture is in the middle of the applet?
 

oto no nai mahiru
kaze ha tada akarui
sukoshi nemutasou ni hanabira ga yureta
nani ge nai kono omoi
nee, hito ha donna kotoba de yondeiru no
Bijeoma

myloveiloved
Re: Centering an object
« Reply #1 on: Sep 6th, 2003, 4:34am »

size(200, 200);
BImage a;  
a = loadImage("myImage.jpg");  
image(a, width/2-a.width/2, height/2-a.height/2);
 
i think that should work w/ all sized images... i havent tested it.
 
bryan
 
Nekochan =^.^=

Email
Re: Centering an object
« Reply #2 on: Sep 6th, 2003, 7:20pm »

It works great. Thanks a lot. Now I just eed to resize the images (don't worry, I know how to do that) and it'll be all set. Awesome!
 

oto no nai mahiru
kaze ha tada akarui
sukoshi nemutasou ni hanabira ga yureta
nani ge nai kono omoi
nee, hito ha donna kotoba de yondeiru no
Pages: 1 

« Previous topic | Next topic »