Page 1 of 1

Meaning of image size (rvepImageWidth, rvepImageHeight)?

Posted: Wed Nov 02, 2005 12:04 pm
by Bulvaye
Hello,

After inserting pictures with TRichViewEdit.InsertPicture() I wish to set the picture's size to a predifined size. For this I call:

TRichViewEdit.SetItemExtraIntProperty(ItemNo, rvepImageWidth, SIZE)
and
TRichViewEdit.SetItemExtraIntProperty(ItemNo, rvepImageHeight, SIZE)


But what is the meaning of SIZE? What unit does SIZE have?


I wish to set the picture's size in cm - e.g. 7cm x 8cm. What values have I got to pass or is there another method to define a specific image size?

Thank you for any hints! :wink:

Posted: Wed Nov 02, 2005 8:47 pm
by Sergey Tkachenko
It's an image size in pixels.
More exactly, it is in screen pixels, because when printing the image size is recalculated according to the printer resolution.
So these values are exactly the same as <img width height> in HTML.

You can convert them to inches by dividing by Screen.PixelsPerInch value.
Usually it is 96, but can be changed (for example, in Large Fonts mode, it is 120).

There is a way to make image sizes independent from the screen resolution, I can explain if you need.

Posted: Thu Nov 03, 2005 1:20 am
by Bulvaye
Yes, i'm very interrested in how to set pictures to an screen device independent size.

Posted: Thu Nov 03, 2005 9:11 am
by Sergey Tkachenko
There is a way to use a specific resolution instead of the screen resolution.
There are two values:
1) TRVStyle.TextStyles.PixelsPerInch. By default it equals to 0 (meaning: using the screen resolution).
This value affects text displaying. For example, by setting it to 96 you will see how the document looks in the "Small Fonts" mode, to 120 - in "Large Fonts" mode.
2) The global variable RichViewPixelsPerInch : Integer = 0 (RVFuncs unit).
0 means: use the screen resolution.
This value is used when converting pixels to inches or millimeters (when printing or saving RTF files). It affects non-text items (images, tables).

I suggest you to assign both these variables to 96. After that, your documents will look the same on all computers, 1 inch = 96 pixels.