|
請問大家layout logo是怎麽做得,感覺BMP 單色位轉成layout效果不好,如果采用這個方法要每個字母做成一個cell,然後還要load一個可以自動縮放的script,而且轉成單色位圖片會有很嚴重的毛邊,轉出來會很難看,所以是怎麽做比較好
; @3 P' {/ E4 ]$ ~2 u, ^1 U: K$ B7 |7 |- S/ k3 H( w( R& Z. U. L
以下是skill
9 d: I% `: g! W9 t3 @, z2 n6 s5 ~6 Elet((win cv bmpfile bmpSize WORD Wnum number Grid Layer row column max_column
5 t4 F1 J0 q# ^$ b+ J, G i dot x y signature offset width height pixel ImageSize ), K. U* y& ?/ N% ~' X" E
8 @3 s- `: _8 g; Q* H9 z# z win = hiGetCurrentWindow()0 |) _8 x4 Q3 ~4 e
cv = getEditRep(win)/ G' R6 @1 i( Z J# z/ ]* @
2 R! p+ i( J* L; f7 `
bmpfile = "~/number_mini.bmp" ;;; Input BMP File
4 G% k6 m( X& [/ S" W& f# j Layer = list("TTOPME" "drawing") ;;; Output Layer
( }+ S; B0 U0 `8 k7 ?; ? Grid = 1 ;;; Rectangle Size& g3 o/ `; ?" a( x
column = 0& V) G$ o, G6 A3 ]0 Y* E5 w, i
" \$ g0 B- k1 j, H0 m: L: m; \+ @
procedure(MessageForm(text)
* I" r. f' p7 {2 v/ g' ]7 D* I9 } prog( ()
8 ~* B* N. x- [2 H& N0 V8 R hiDisplayAppDBox(
# `' H0 |( ]. \ ?name 'JWDBox_Message9 b9 z: U/ k3 A& Y6 E
?dboxBanner "Message!!". ~$ }3 k" P$ Q8 e7 y
?buttonLayout 'Close! v2 C2 l1 k7 V! _% |
?dboxText text6 G+ G- A9 \$ a
)
7 l' G5 Z; g) X' Q, {7 D );prog
% t& O5 t+ h* h+ p);procedure
# b2 K# a4 ?7 E, L% ^$ ~. N( O* Q! I; f
;Read BMP file0 A- [* H9 n# i, d9 Q) [
if(InFile = infile(bmpfile) then/ m& v' j$ q5 h1 J) Q. U
bmpSize = fileLength(bmpfile)
6 Y. M, \, L$ F# ~! I declare(WORD[bmpSize])3 W1 Y- \7 p$ J
for(Wnum 0 bmpSize-1 WORD[Wnum] = charToInt(getc(InFile)) )9 G) Z+ O, [1 c& D' r
close(InFile)
( i0 D; O R6 H6 m3 B+ M+ O else9 y: M; J6 H9 F3 X( u* H' v
MessageForm("Input file does not exist!")
& a4 k4 G% r& | return()6 n( A n# ]7 }: A% K2 r- h2 Z
) Q. N; Y: |) b1 `1 S! C
( \ D. U7 g! b( W; z2 h
sprintf(signature "%02x%02x" WORD[0] WORD[1])
, y; v% U' }- X1 a/ y3 ]5 U( E offset = (WORD[0x0d]<<24) + (WORD[0x0c]<<16) + (WORD[0x0b]<<8) + WORD[0x0a] 1 n f! X( E- C' Y
width = (WORD[0x15]<<24) + (WORD[0x14]<<16) + (WORD[0x13]<<8) + WORD[0x12]& o* v) Z- I6 e/ O
height = (WORD[0x19]<<24) + (WORD[0x18]<<16) + (WORD[0x17]<<8) + WORD[0x16]/ v; _0 i% {; a( I
pixel = (WORD[0x1d]<<8) + WORD[0x1c]
' v+ p0 H/ e% K+ ~, F9 C ImageSize = (WORD[0x25]<<24) + (WORD[0x24]<<16) + (WORD[0x23]<<8) + WORD[0x22]* X4 v3 ?( t9 n% k/ O7 ^; \9 ]0 ^
7 z8 d2 U9 M, @ printf("--- BMP2LAY Start --- %L\n" getCurrentTime())
7 o1 j% w3 n+ x [# b V printf("offset : 0x%x \n" offset)
- |; h7 Q7 c! i8 ?" d- b# Q printf("width : 0x%x \n" width)
. r. m' u' v' Q printf("height : 0x%x \n" height)
" Y |- n- u& Y) w) P printf("ImgSize : 0x%x \n" ImageSize)1 G, M2 L4 g2 j: _
( {; H+ b5 d1 ^8 o2 L;check bmp file
/ k% C. X9 o& \1 G1 y! } if(!equal(signature "424d") then
* n& `' r; Y; U6 w( F MessageForm("*ERROR* Standard Input is not a BMP file")
7 `6 M# d: } Z4 G3 e6 y return()
- L+ l2 I T( X! J" ]9 n8 V )+ P$ Z- l8 P5 X: J3 [% ]
6 {& q. C! w: [$ O, w9 F
;check mono bmp file
5 n( K) n0 K& P" C* O$ H1 I1 T if(!equal(pixel 0x01) then
: X4 z$ c: a. ]. V MessageForm("*ERROR* only supports mono bmp files")
6 J3 ^1 k* x8 Y! U) @6 t# U return()5 c1 h0 h6 [ I. H, A
)& f+ U g! }, F* A) H, Y$ b- P1 ~- d) m
0 ] x$ @& `5 r
;BMP2LAY
3 `: E; o5 `% N max_column = ImageSize/height<<37 B3 t4 b/ L0 j/ A) y$ \
number = offset+ImageSize-1
8 b8 S6 ]( O! K) W
% D) n% \- a$ j& E for(Wnum offset number( j; \' p' v p: s' l& h
row = fix((Wnum-offset)/(max_column>>3))* n1 }% f. w- p4 J4 g* R! D
y = Grid*row
' b' m9 a! t# |; A* I
6 b* n6 e0 S- O7 ^ for(i 0 7/ A( B5 m# y! a1 ?5 C/ x2 H7 Q
dot = bitfield1(WORD[Wnum] 7-i) ; bit<7> ~ bit<0>
% K& Y5 _7 q! u6 G5 w" E0 { x = Grid*column- d) s4 `! x, s: }1 `; Q
if(zerop(dot) && column<width then
9 B/ z5 ?. B' G6 _* u% B geSelectObject(dbCreateRect(cv Layer list(x:y x+Grid:y+Grid)))3 o1 r, G9 R; I% B1 P( x
)
4 W# I) _) ~( I0 `( m column++7 O. X+ L% T: X% @5 x" B- ]% D
);for
( T6 m& l& m4 y, F" W# F if(equal(column max_column) column=0)
- e9 C1 m; [) X; H Wnum++
4 P; D. j1 h# i# k; Q );for& H x& @9 L6 g' m" j$ V
! G6 W. G p! [; H
hiZoomIn(win list(-10:-10 x+10:y+10))( n+ E; @: V& Y U
printf("--- BMP2LAY End ----- %L\nt\n" getCurrentTime())
8 G V. K, E2 h# B& S5 X. X `);let
2 d( T! v: t5 `! s q9 F
x* q3 J6 b( `$ V# N |
|