PDA

View Full Version : framedef FGII



Insanity
May 15th, 2007, 19:38
I was looking at the graphics_frame.xml file because I want to add my own frame. Looking at the slottedmodifier definition, I see that it appears the left rect are offset from the middle rects. Assuming I am reading the definition correctly. I am not familiar with .xml much, wasn't sure if there was a purpose to this or not?



<framedef name="slottedmodifier">
<bitmap file="frames/slottedmodifier.png" />
<topleft rect="0,0,37,12" />
<top rect="37,0,160,12" />
<topright rect="212,0,12,12" />
<left rect="0,12,37,187" />
<middle rect="37,12,160,187" />
<right rect="212,12,12,187" />
<bottomleft rect="0,199,37,12" />
<bottom rect="37,199,160,12" />
<bottomright rect="212,199,12,12" />
</framedef>


Am I wrong, or is there a reason?
I wanted to define a custom frame and couldn't figure out why it would be defined this way.

Dachannien
May 15th, 2007, 20:10
The left rect starts at the left edge of the frame and is 37 pixels thick. Therefore, the middle rect has to start 37 pixels away from the edge. Both rects start 12 pixels down from the top and are the same height (187).

Insanity
May 15th, 2007, 20:22
D'oh...my apology. It is the right rects that I had a question on. thanks for the response though.

Dachannien
May 15th, 2007, 21:48
Ahh, I see :)

Okay, so the way it works, each rect takes from the specified portion of the bitmap image. In the case of the slottedmodifier frame, the middle rect has the repeating series of vertical lines. The left rect includes the first of these vertical lines, the left edge of the box, and the intervening space. The right rect only includes the right edge of the box.

In order to get it so that a particularly wide control that uses this frame would have the vertical lines repeating at the same interval, the middle rect cuts it off just to the right of one of these vertical lines. But when they drew the bitmap image, they (for whatever reason) included extra space between the last vertical line and the right corner/edge. The gap in the offsets between the middle and right rects is just this extra space being skipped, and they could have instead make the rects line up edge-to-edge while cropping out that space from the bitmap image.

Ram Tyr
May 15th, 2007, 22:10
Search is your friend.

This was done up very nicely, and I believe it remains accurate.

Crusader's Post referring to rectangles and pixels (https://forums.fantasygrounds.com/forums/showthread.php?p=21336&highlight=rectangle+pixel#post21336)

Later.