Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

搜索
1 2 3 4
查看: 9335|回復: 0
打印 上一主題 下一主題

[問題求助] 關於BMP轉logo

[複製鏈接]
跳轉到指定樓層
1#
發表於 2021-5-7 10:16:51 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
請問大家layout logo是怎麽做得,感覺BMP 單色位轉成layout效果不好,如果采用這個方法要每個字母做成一個cell,然後還要load一個可以自動縮放的script,而且轉成單色位圖片會有很嚴重的毛邊,轉出來會很難看,所以是怎麽做比較好
, ~( i9 x' u6 j0 v$ s) j% N
5 f9 c' l, r, G以下是skill( N) k% j* Y6 x6 V5 F
let((win cv bmpfile bmpSize WORD Wnum number Grid Layer row column max_column
6 j' ^3 o  R( \9 S& {/ d+ c        i dot x y signature offset width height pixel ImageSize )
, C* G7 P2 V4 B" K
  Z' w( n5 @9 U. h9 c        win = hiGetCurrentWindow()
4 Y0 S7 n% Z8 P$ C        cv = getEditRep(win)9 N9 O' V* [. ~

& f. J: ]8 r1 B        bmpfile = "~/number_mini.bmp"                        ;;; Input BMP File
4 i1 F# ], ^% O% F        Layer = list("TTOPME" "drawing")        ;;; Output Layer
4 U9 q" E* G6 d) k' l) e9 t: s        Grid = 1                                ;;; Rectangle Size
  f1 ^4 |0 e9 O+ @4 c  o        column = 0+ A  Z, S4 t* H. |4 A' j9 U) O5 p

1 g+ k* g( l4 l7 H' Eprocedure(MessageForm(text)7 B" `/ q  |' |! r9 S7 |' g* J
    prog( ()3 ]8 i5 z3 o: Z9 s0 W: Y
        hiDisplayAppDBox(
. Z; o# J" n; C: D                ?name 'JWDBox_Message
% y. a4 K2 ?/ w/ h* ]$ w8 Q7 \                ?dboxBanner "Message!!"7 T8 }6 h# N* m) k& T4 B! {/ Y
                ?buttonLayout 'Close
5 ?6 E& Q, ?4 `+ o4 k4 F                ?dboxText text# I' S: t2 X+ R7 a
        )0 R% j) a$ R% d5 G
    );prog
# T. b0 Z) T. P: a. W$ W);procedure. @5 ?0 q) O; e% i8 ]6 J- U

5 a) E* ?6 \/ L* u$ S2 U;Read BMP file
4 Y8 b( `' b6 F- X. ~- e" v        if(InFile = infile(bmpfile) then; S2 k$ O3 J  p/ g9 D
                bmpSize = fileLength(bmpfile). Q5 L+ G6 o# @* M
                declare(WORD[bmpSize])  X- F( ?  a' q! f0 r3 H6 Z- l
                for(Wnum 0 bmpSize-1        WORD[Wnum] = charToInt(getc(InFile)) )
- F( P: Y# J- `$ m                close(InFile)8 n- B7 v2 H  A& Y8 L* |. T; g
        else
9 f; G4 T' p) T* S1 w, ]( G                MessageForm("Input file does not exist!")
, z3 E( s+ j0 I, x                return()+ V: ^$ G6 l, y) t
        ), b& b2 [6 ?& R- A6 [

. {& J8 h5 I7 ^% q! D4 l' ]  |        sprintf(signature "%02x%02x" WORD[0] WORD[1])3 n4 Q7 T+ A6 c; v& x* a9 p
        offset = (WORD[0x0d]<<24) + (WORD[0x0c]<<16) + (WORD[0x0b]<<8) + WORD[0x0a] 3 C4 s9 P- e: q! r2 Y8 O
        width  = (WORD[0x15]<<24) + (WORD[0x14]<<16) + (WORD[0x13]<<8) + WORD[0x12]
5 M5 h0 j1 M* |" D* e% ?        height = (WORD[0x19]<<24) + (WORD[0x18]<<16) + (WORD[0x17]<<8) + WORD[0x16]
4 f3 U( K% {) }3 e3 [: j% {: H        pixel  = (WORD[0x1d]<<8) + WORD[0x1c]% }1 c( }& b: V  K
        ImageSize = (WORD[0x25]<<24) + (WORD[0x24]<<16) + (WORD[0x23]<<8) + WORD[0x22]
: j: Z5 W' l+ a+ K& y5 l7 j8 k+ b  p' |- B- Q' K  @
        printf("--- BMP2LAY Start --- %L\n" getCurrentTime())6 J( H- b% Y# c+ F
        printf("offset  : 0x%x \n" offset)
$ }+ \, Z0 S# X1 ~3 }6 E        printf("width   : 0x%x \n" width)
: L9 H6 L  u  a- G$ M* s8 K; h        printf("height  : 0x%x \n" height)9 b4 J2 @" j# n( x% J3 A$ p& |
        printf("ImgSize : 0x%x \n" ImageSize)
3 s- c0 s9 K0 r% @  D8 Y! U6 _3 @$ M# l! H  g
;check bmp file
1 k. E+ h- E7 ~! Y6 r. r% B2 \: i  V        if(!equal(signature "424d") then
3 @. [/ q7 \( c# T                MessageForm("*ERROR* Standard Input is not a BMP file")
( Z# Y8 Q7 ^7 a                return()
) F/ n0 e! {- I2 u) ~* Z        )/ Y! O4 v! M8 x1 Z1 Z% q
" _3 |0 |& O4 L. o3 g" Y
;check mono bmp file
. {/ R" G8 K' V9 @        if(!equal(pixel 0x01) then5 S& h6 r: U  p2 c6 Z
                MessageForm("*ERROR* only supports mono bmp files")
" {- ?) B8 r% ~) G! a                return()
5 Y* y" n, C6 t+ \7 e        )
* p  h" t2 g4 _* E; o. C+ C6 r  @+ G0 V# w" j, U/ k
;BMP2LAY
8 d* i7 ]' ]1 ^$ q/ b5 d% e* s; w1 m        max_column = ImageSize/height<<31 v# v' t9 c) J4 w  I# v' P# D
        number = offset+ImageSize-1: _1 D" |8 m& j2 ^3 I, A

: Q$ U( i) Y1 U# K* }' J. R        for(Wnum offset number( Y7 H% M  }: ^, _7 \
                row = fix((Wnum-offset)/(max_column>>3))( x- f* F. \# m0 u' ?
                y = Grid*row. I' t1 z: c0 h! ], q2 B7 g
8 H8 `2 A7 H" z, K! U6 B- Q3 J
                for(i 0 7
8 {* o( V1 h6 x0 L                        dot = bitfield1(WORD[Wnum] 7-i)                ; bit<7> ~ bit<0>5 D# X( k- r6 r$ O
                        x = Grid*column3 a( I" m% d, E) ^+ P( A5 _
                        if(zerop(dot) && column<width then3 B1 F* C1 h. t- ^
                                geSelectObject(dbCreateRect(cv Layer list(x:y x+Grid:y+Grid)))% f2 I, ?+ L3 A! p. M
                        )
% W' G: ~, @  w0 I& d                        column++: L4 v4 b8 [5 E
                );for/ C/ Q8 r) b4 w: K
                if(equal(column max_column)        column=0); U$ U+ I9 X; e  |, Y$ p) l
                Wnum++
! Y; _' @5 Y2 s. f7 V0 r9 ?6 }8 o        );for) B& W/ a# B* s
+ ^: l; R: D  R
        hiZoomIn(win list(-10:-10 x+10:y+10))
$ |. w; j9 Y) e; D# X        printf("--- BMP2LAY End ----- %L\nt\n" getCurrentTime())5 ]" f$ g, C6 ]! J. K
);let
% K& g- }# s5 X# R; O/ H  m
8 R0 E) |) \3 C6 F& P
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

首頁|手機版|Chip123 科技應用創新平台 |新契機國際商機整合股份有限公司

GMT+8, 2024-5-29 11:38 PM , Processed in 0.102513 second(s), 18 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表