Meaning of image size (rvepImageWidth, rvepImageHeight)?

General TRichView support forum. Please post your questions here
Post Reply
Bulvaye
Posts: 10
Joined: Wed Oct 12, 2005 2:08 pm

Meaning of image size (rvepImageWidth, rvepImageHeight)?

Post 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:
Sergey Tkachenko
Site Admin
Posts: 17604
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Bulvaye
Posts: 10
Joined: Wed Oct 12, 2005 2:08 pm

Post by Bulvaye »

Yes, i'm very interrested in how to set pictures to an screen device independent size.
Sergey Tkachenko
Site Admin
Posts: 17604
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply