Just a quick question;
What is english term of:
In my dictionary it's: broad, vast, roomy, large, extent.Code:width * height
Seems not right.
Thanks in advance.
EDIT: It's width multiplied by height.
Printable View
Just a quick question;
What is english term of:
In my dictionary it's: broad, vast, roomy, large, extent.Code:width * height
Seems not right.
Thanks in advance.
EDIT: It's width multiplied by height.
Area (of a rectangle)?
It'll definitely be area of a rectangle.
Yeah, it's image.
So?Code:image.area = image.width * image.height
correct
Thank you very much! :D
Very weird tough in this context...
I thought it would be:Code:rgba_t *image = imageObject.getBits();
rgba_t *const imageEnd = image + imageObject.getArea();
while(image < imageEnd)
{
image++;
}
EDIT:Code:rgba_t *const imageEnd = image + imageObject.geSize();
Better?Code:rgba_t *const imageEnd = image + imageObject.geSize().getArea();
What is imageObject? It's kind of hard to speculate on how to call a method of an object without knowing its type. However, intuitively, there doesn't seem anything wrong with the first call... structurally they could all be wrong, though, for all I know.
Image object is...
Hell an instance of Image class which encapsulate image behaviours and properties, including low level image's raw data (linear array of bit -- getBits) which type unsigned char *, in this case it's RGBA color model image, so actually we need to cast it to rgba_t *.
And then to retrieve the end of image array we need to multiply width by height and is encapsulated in getArea method.
OK, stop!
We won't dig this example into deeper details. :D
Yeah, I assumed that much... however, I still couldn't suggest which of your examples is correct without seeing some class structures. If getArea is a method of class Image, then I'm sure the first example is fine. However, if getArea is, in fact, a method of another class that is returned by geSize, then the second example would be correct...
All in all... I don't really understand what you're asking. If these are your classes then why are you asking up how to call their methods?
Sorry for this misunderstanding..
I'm not asking how to call it but the name of method.
At #9, please look before the EDIT line.
Would it be getArea or getSize?
Since in low level term I think size would be more appropiate to describe width * height (that's size of array).
While in high level term, size contains both width and height, not width * height -- in this case what you guys tell me, area.
EDIT:
I got something to solve this naming method.
I think I will decoupling the Image class from ImageData class which have getSize method and Dimension which have getArea method. It's complex! Yeah!
Going with the way I have seen image files most often described, I think a normal english speaking programmer would assume this:
"size" would refer to the file size, eg in kB.
"area" would refer to width * height
"dimension" would refer to one of width or height (width is a dimension, height is a dimension).
So I don't know if having getArea as a sub-method of getSize is so appropriate...but not a big deal.
If this is an object you are yourself creating, it's up to you to define the semantics. As a suggestion though, getArea and getSize should be two different concepts.
- getArea should return the geometric area of the image in whatever units you deem necessary. Could be pixels, centimeters, inches.
- getSize should return the physical size of the image as it is occupied in memory.
Assuming these semantics are defined, then it becomes trivial for the class user to understand that they can use getArea() to read the location of the last pixel of the image.
I tend to agree with the above... and I apologize for not understanding what you were looking for earlier. It was, in fact, the code after the edit that threw me off.
In my opinion, getSize would intuitively return the size of the object in memory and getArea would return the pixel height by the pixel width... That said... if you were to determine a pointer to the end of the image, then you would use getSize because getArea should not be factoring color depth (as each pixel would likely be more than 8-bit).
In other words, if you were to have a 24-bit bitmap with the size of 100px by 100px... then I would expect a function called getSize to return 240000b (excluding the image header, of course) and getArea to return 10000px. ... and as Mario said, getArea would more than likely allow a parameter to specify the type of value you want returned.