• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
image arithmetic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

image arithmetic


  • Subject: image arithmetic
  • From: Amy Gibbs <email@hidden>
  • Date: Wed, 10 Nov 2010 13:35:50 +0000

Hi,

I can't quite get my head around obj-c sometimes, so i was just wondering if anyone could point me in the right direction.

I've got a fairly simple coredata app that I code and use to keep track of some work stuff (I run my own business), and it automatically generates composite images for me. At the moment it's set to re-size the original images and fit them into a 3x4 grid, but if theres only a few images it looks very odd, so I want to change it so if there are less than 8 images it lays them out differently. In non code what I want to do is:


for NSMakeRect(0,0,x,y)

origin to stay at 0,0
calculate scale factor (sf) by dividing 225(required height) by the original height: sf = 225 / originalheight


x = requiredwidth / sf

y = originalheight

I can't work out how to get the original height and width of the image, and I think i'm getting confused with number formats, I've got the following at the moment but my width variable is coming out as null?

NSArray* kitImages = [kit valueForKeyPath:@"kitItems.kitItemProduct.productImage"];
int ki = [kitImages count];
NSLog(@"Number of images: %i",ki);
//calc image width
float width = 300 / ki;
NSLog(@"Width: %@",width);


I'd appreciate any help.

Many Thanks

Amy
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: image arithmetic
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Detecting reading a key in KVC
  • Next by Date: Re: image arithmetic
  • Previous by thread: Re: Detecting reading a key in KVC
  • Next by thread: Re: image arithmetic
  • Index(es):
    • Date
    • Thread