Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_putimage (Solved)
#1
Code: (Select All)
Palette 5, 63: Color 0, 5: Cls
t.mr = 40: t.ml = 10: t.InputRow = 10
MenuT = 7: MenuR = 30: MenuB = 15: MenuL = 18: mheight = 9: mwidth = 12
cp1 = 0
cp2 = 1

GoSub MakeInputField

Locate MenuT, MenuL
Color cp1, cp2
Print Chr$(218) + String$(mwidth - 2, 196) + Chr$(191)
For i = 1 To mheight - 2
    Color cp1, cp2: Locate , MenuL
    Print Chr$(179); Space$(mwidth - 2) + Chr$(179)
Next
Color cp1, cp2: Locate , MenuL
Print Chr$(192) + String$(mwidth - 2, 196) + Chr$(217);

Do
    _Limit 10
    _PutImage (t.ml * t.fw, t.InputRow * t.fh), lin2
    _Display
Loop Until Len(InKey$)
End

MakeInputField:
j = t.mr - t.ml + 2: t.fw = _FontWidth: t.fh = _FontHeight
CRed = 190: CGrn = 190: CBlu = 190
t1 = _NewImage((j + 1) * t.fw, 2 * t.fh, 32)
_Dest t1
Line (0, t.fh * 0)-(j * t.fw, t.fh * 1), _RGB32(190, 190, 190, 128), BF
Line (0, t.fh * 0)-(j * t.fw, t.fh * 1), _RGB32(0, 0, 0), B
lin2 = _CopyImage(t1, 33)
_FreeImage t1
_Dest 0
Return

The horizontal input field (rectangle) is a hardware image, which goes over the top of the blue box. What I want _putimage to do, in two statements, is eliminate the part going through the blue box. So the first _putimage statement would place the left portion of the input field from the same start position to the left margin of the blue box, and then a second _putimage statement would put the rest of the image from the right side of the box to the same finishing position. This would make it look like the blue box is over the input field.

Ah, I got it!

Code: (Select All)
Palette 5, 63: Color 0, 5: Cls
t.mr = 40: t.ml = 10: t.InputRow = 10: t.InputRow2 = 13
MenuT = 7: MenuR = 30: MenuB = 15: MenuL = 18: mheight = 9: mwidth = 12
cp1 = 0 ' Available menu item.
cp2 = 1 ' Popup background. (Same as mki.skin_bkg)
cp4 = 7 ' Shadow.

GoSub MakeInputField

Locate MenuT, MenuL
Color cp1, cp2
Print Chr$(218) + String$(mwidth - 2, 196) + Chr$(191)
For i = 1 To mheight - 2
    Color cp1, cp2: Locate , MenuL
    Print Chr$(179); Space$(mwidth - 2) + Chr$(179)
Next
Color cp1, cp2: Locate , MenuL
Print Chr$(192) + String$(mwidth - 2, 196) + Chr$(217);

Do
    _Limit 10
    _PutImage (t.ml * t.fw, t.InputRow * t.fh), lin2
    _PutImage (t.ml * t.fw, t.InputRow2 * t.fh), lin2, , (0, 0)-((((MenuL - 1) - t.ml)) * t.fw, t.fh)
    sx1 = (mwidth + MenuL - t.ml - 1) * t.fw: sx2 = (t.mr - t.ml + 2) * t.fw: sy1 = 0: sy2 = t.fh
    _PutImage ((MenuL + mwidth - 1) * t.fw, t.InputRow2 * t.fh), lin2, , (sx1, sy1)-(sx2, sy2)
    _Display
Loop Until Len(InKey$)
End

MakeInputField:
j = t.mr - t.ml + 2: t.fw = _FontWidth: t.fh = _FontHeight
CRed = 190: CGrn = 190: CBlu = 190
t1 = _NewImage((j + 1) * t.fw, 2 * t.fh, 32)
_Dest t1
Line (0, t.fh * 0)-(j * t.fw, t.fh * 1), _RGB32(190, 190, 190, 128), BF
Line (0, t.fh * 0)-(j * t.fw, t.fh * 1), _RGB32(0, 0, 0), B
lin2 = _CopyImage(t1, 33)
_FreeImage t1
_Dest 0
Return

And all it took was a big bowl of ice cream.

Pete
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  _Putimage Question. Pete 11 671 01-04-2026, 09:33 PM
Last Post: Pete
Tongue Ubuntu 18.0.4 C++ Compilation Failed SOLVED (sorta) Shed_Grill 6 870 07-14-2025, 12:32 AM
Last Post: Shed_Grill
  _Putimage problem. Pete 11 1,268 04-08-2025, 01:45 AM
Last Post: Pete
  After using the font, the IDE is ripe for reinstallation SOLVED! Petr 8 1,369 12-12-2024, 04:45 PM
Last Post: Petr
  [Solved] How come CLS clears more than the _DEST image here? Dav 2 743 10-07-2024, 12:14 AM
Last Post: Dav

Forum Jump:


Users browsing this thread: 1 Guest(s)