|
請問大家layout logo是怎麽做得,感覺BMP 單色位轉成layout效果不好,如果采用這個方法要每個字母做成一個cell,然後還要load一個可以自動縮放的script,而且轉成單色位圖片會有很嚴重的毛邊,轉出來會很難看,所以是怎麽做比較好
7 O/ o, q. ?' U* k( T6 ~" a" ~, _
" u/ n. ?5 [- l以下是skill
# [* x* S, y( @3 x9 `3 p2 slet((win cv bmpfile bmpSize WORD Wnum number Grid Layer row column max_column
: [7 a6 |& _& q) \4 {+ @ i dot x y signature offset width height pixel ImageSize )/ d2 x+ G8 Z( N$ g0 g, r
0 P6 p# i' L) g% M* U# W/ X
win = hiGetCurrentWindow()
6 s Z3 i! x* ^) d: p; J3 v% } cv = getEditRep(win)4 K5 f# {1 L) K6 F9 |
# ]; D0 d, [: V7 s. w
bmpfile = "~/number_mini.bmp" ;;; Input BMP File+ k6 v% S; q% p+ `4 ~! }
Layer = list("TTOPME" "drawing") ;;; Output Layer
( _9 X6 g0 U& T+ o' G1 N2 X: z Grid = 1 ;;; Rectangle Size) h! O% Q. i* i/ i" Q9 @: A
column = 0) t; o! v, [. L! J1 |7 ~
! _8 g# l B9 w* ?7 |5 iprocedure(MessageForm(text)$ R. ^- g2 {# P& J }1 {0 @2 r
prog( ()
: s* W! S# w" v# j$ Z hiDisplayAppDBox(0 S/ \! K4 N5 A, Z
?name 'JWDBox_Message& [8 v. G: G, ]' z/ \8 f
?dboxBanner "Message!!": x5 \9 O0 r3 v1 g2 S
?buttonLayout 'Close/ ~7 H9 V! n3 V2 ~3 f
?dboxText text5 u' O: G- y- r# u: }3 [, T
)( q( {4 n; Z4 K. \4 s+ _
);prog& d8 a6 J# p/ ~! m6 Y) t
);procedure" J' C! R* k; L6 ]) V$ m
8 P Q" K5 I6 U) k( e5 a
;Read BMP file. f7 Y, j2 L( A- B0 i4 D( m
if(InFile = infile(bmpfile) then
. U7 ^7 ]% K; _* l& L bmpSize = fileLength(bmpfile)
, ?1 `6 r( }( Y' n$ D& `- u declare(WORD[bmpSize])5 M! N! @7 @) _4 S X! m- W
for(Wnum 0 bmpSize-1 WORD[Wnum] = charToInt(getc(InFile)) )9 d& B; e3 i: J! v! a
close(InFile)/ I2 q; [: p, ?8 m0 M2 V/ u$ O
else+ d( {& }! u0 Z- L/ J
MessageForm("Input file does not exist!") M' }" b/ O) L9 {% V
return()% O* y* }- Z: h1 x. _+ N
)
* R# R8 Q8 U% F k
: x( W: x6 H& I: S0 A7 u$ f+ w sprintf(signature "%02x%02x" WORD[0] WORD[1])$ c* b; m* l1 h) A* E! f
offset = (WORD[0x0d]<<24) + (WORD[0x0c]<<16) + (WORD[0x0b]<<8) + WORD[0x0a]
/ q- ]- z& ^4 d1 @: a% C% E! v width = (WORD[0x15]<<24) + (WORD[0x14]<<16) + (WORD[0x13]<<8) + WORD[0x12]8 D" }. k: H2 ?5 [% _" H4 n/ |+ v
height = (WORD[0x19]<<24) + (WORD[0x18]<<16) + (WORD[0x17]<<8) + WORD[0x16]& P/ z2 a* W/ t
pixel = (WORD[0x1d]<<8) + WORD[0x1c]( U, r9 ^% L( Z3 W4 Q' r5 H
ImageSize = (WORD[0x25]<<24) + (WORD[0x24]<<16) + (WORD[0x23]<<8) + WORD[0x22]7 q' `6 k1 ?% d/ T$ F
4 v, N2 [: q: G" d2 p. C
printf("--- BMP2LAY Start --- %L\n" getCurrentTime())
% g/ Z( j) O2 ?# [ printf("offset : 0x%x \n" offset)+ H7 x5 q( r" w. c! q1 a
printf("width : 0x%x \n" width)" ~3 H! \$ ] n! r4 L+ z. k t& f
printf("height : 0x%x \n" height)
7 d6 D) K! ^0 K n7 ]1 ] printf("ImgSize : 0x%x \n" ImageSize)3 D* p3 V+ R) H$ K/ W+ u
* k1 N/ `5 u0 ?/ ~5 {! z
;check bmp file' k. B1 j8 b! r4 a( o a
if(!equal(signature "424d") then. `( Q0 n' s' p$ E& _' ^( G
MessageForm("*ERROR* Standard Input is not a BMP file")
% l/ w8 ~' s; W+ f" S4 ]- H, Q9 d return()
) `7 H; v# \) [; b" d6 A ); F; ?; b3 i- Y6 O( W; O' ]
( C% N5 \0 o" d/ e( p7 l# N/ v;check mono bmp file* e' J2 ?& f7 d8 z2 P* \! l
if(!equal(pixel 0x01) then" A. m0 h/ w: [3 h) y0 c
MessageForm("*ERROR* only supports mono bmp files")
4 d6 j' C9 g/ i$ [9 t return()1 R9 E8 |) S" I9 x
)1 t( W) G' l. k( B
( _5 s, b: I9 G; }+ j* ~;BMP2LAY' v, P0 l4 [2 X% P# D
max_column = ImageSize/height<<3
) z& `8 C1 w# L number = offset+ImageSize-19 w) G. z% c' ]/ i3 h* _
) A- |8 t+ y8 B
for(Wnum offset number
7 ~3 r% g: L5 P- R row = fix((Wnum-offset)/(max_column>>3))% h+ c: d: s# ?/ d" r
y = Grid*row
6 B3 H- ? M* a& {$ K; C: U
3 t1 f; Y- A4 J* B) t1 [* p) c for(i 0 7" s$ O7 U3 |" R, R
dot = bitfield1(WORD[Wnum] 7-i) ; bit<7> ~ bit<0> k) G. I# _! R6 S8 p( p. ^1 P
x = Grid*column
: s% J5 i3 `. N5 ^ if(zerop(dot) && column<width then/ |) N1 G1 @- t
geSelectObject(dbCreateRect(cv Layer list(x:y x+Grid:y+Grid)))$ P: H4 U- ^2 |
)' D1 k( t# `9 T! J/ j
column++# S9 B2 @& M7 S; }! O
);for1 L- d' ?- I# D8 i$ i; N7 _
if(equal(column max_column) column=0): t) D5 ^5 ?7 a
Wnum++2 t% S6 E7 E& k0 G* m
);for5 t* J3 T" [# X7 r. M1 |7 w
4 K$ E6 T! B) t8 c- [ hiZoomIn(win list(-10:-10 x+10:y+10))/ _* E# n2 {$ l# x% k& u0 G4 c
printf("--- BMP2LAY End ----- %L\nt\n" getCurrentTime())
9 m" {, b6 i, }7 X/ u8 J);let
+ M/ g1 _5 \# x2 ~% Y! h8 B. s2 ~! ]6 B% W/ q( P
|
|