Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Images — multiple — how to display a specific part?
#1
I want to use OnScreenDisplay to make use of some files containing many transparent (or not) images.

Some contain many toolbar icons in one row or have several rows and columns. Some folders contain files with the same name but different extensions (e.g. a .jpg and a transparent .png with similar images, which can be their shadow(?) or the form they take when you hover the curson above them or when you click on them etc)

Some of them have some text information in the same folder, like an .xml file.
e.g. for a set of characters in one image:

<?xml version="1.0" encoding="utf-8"?>
<Font family="a_Concepto" style="Bold" size="17" height="25">
<Char code=" " width="10" rect="0 0 0 0" offset="0 0" />
<Char code="!" width="8" rect="0 1 9 29" offset="-1 -2" />
<Char code="&quot;" width="8" rect="10 1 11 29" offset="-2 -2" />
<Char code="#" width="17" rect="22 1 21 29" offset="-2 -2" />

....

<Char code="0" width="17" rect="223 1 19 29" offset="-1 -2" />
<Char code="1" width="17" rect="243 1 16 29" offset="0 -2" />
<Char code="2" width="17" rect="260 1 19 29" offset="-1 -2" />
<Char code="3" width="17" rect="280 1 19 29" offset="-1 -2" />

....


<Char code=";" width="9" rect="431 1 9 29" offset="0 -2" />
<Char code="&lt;" width="18" rect="441 1 17 29" offset="1 -2" />
<Char code="=" width="18" rect="459 1 17 29" offset="0 -2" />
<Char code="&gt;" width="18" rect="477 1 17 29" offset="1 -2" />
<Char code="?" width="15" rect="0 31 17 29" offset="-1 -2" />
<Char code="@" width="22" rect="18 31 23 29" offset="-1 -2" />
<Char code="A" width="18" rect="42 31 20 29" offset="-1 -2" />
<Char code="B" width="18" rect="63 31 20 29" offset="-1 -2" />
<Char code="C" width="16" rect="84 31 19 29" offset="-1 -2" />

....

<Char code="™" width="19" rect="344 181 20 29" offset="-1 -2" />
<Char code="∙" width="9" rect="365 181 9 29" offset="0 -2" />
</Font>


I can display the whole set as one transparent image but how can I make use of the above information? I don't ask how to extract the data the .xml file contains' just where to put it in the OnScreenDisplay line.

In general, how can we choose which one to display and how can we use one of the tile images as a background pattern?
(If not "OnScreenDisplay", some other function which would allow us to display them inside a window, especially if this method is more suitable?)


Note: my screen has a 1024 x 576 resolution (but if you think it's necessary for testing I could temporarily change the settings so it could "display" in other resolutions such as 1024 x 768 or 1280 x 1024 — I don't remember if I have used other resolution numbers).
OS: Windows XP Home Edition SP2
Memory: 1024 MB (1016 MB system + 8 MB video)
Virtual Memory: 2.00 GB
CPU: 1.60 GHz
#2
Function dialog_display_image_parts
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dialog_display_image_parts" &dialog_display_image_parts)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040003 "*" "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,;load a bitmap file containing many 16x16 images horizontally, create a memory device context (DC), and select the loaded bitmap into the DC
,__MemBmp- t_mb
,t_mb.Attach(LoadPictureFile("$qm$\il_qm.bmp"))
,
,;also create a pattern brush for tiling (example 2)
,__GdiHandle- t_brush
,__MemBmp mb.Create(16 16 t_mb.dc 16*3 0) ;;take 4-th image from t_mb
,t_brush=CreatePatternBrush(mb.bm)
,
,case WM_PAINT
,PAINTSTRUCT p; BeginPaint hDlg &p
,
,;example 1: display 10 images from the memory DC in the dialog diagonally
,int i
,for i 0 160 16
,,BitBlt p.hDC i i 16 16 t_mb.dc i 0 SRCCOPY
,
,;example 2: display tiled image at the right side of the dialog
,RECT r; GetClientRect hDlg &r; r.left=r.right*0.7
,FillRect p.hDC &r t_brush
,
,EndPaint hDlg &p
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
For OnScreenDisplay would need to create a bitmap file.
#3
Thank you very much. I still haven't spent much time with it. I will probably have to get back at you.
OS: Windows XP Home Edition SP2
Memory: 1024 MB (1016 MB system + 8 MB video)
Virtual Memory: 2.00 GB
CPU: 1.60 GHz
#4
Can some one help me How to use OnScreenDisplay on specific window.??
#5
To show OSD in the center of the window?
#6
Yes, or posible in specific coordinate in window, not on screen.
#7
Macro Macro2542
Code:
Copy      Help
int w=win("Quick Macros" "QM_Editor")
int x y xx yy; GetWinXY w x y xx yy
OnScreenDisplay "top-left" 3 x y "" 0 0 1|16
OnScreenDisplay "center" 3 xx/2+x yy/2+y "" 0 0 1|16
OnScreenDisplay "bottom-right" 3 xx+x yy+y "" 0 0 1|16
#8
Ok.. Thanks a lot.


Forum Jump:


Users browsing this thread: 1 Guest(s)