Jump to content

Search the Community

Showing results for tags 'bitmap'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 1 result

  1. Many years ago I tried to draw stereograms (like this: https://en.wikipedia.org/wiki/Autostereogram ). I used to use Lisp for drawing on AutoCAD’s screen, then I saved the resulted image. I remember at that time I was wondering if I could leave-out AutoCAD, to make AutoLisp to write the data directly into a bitmap file. It didn’t work, Lisp can’t write binary. But these days I returned to that (to writing files, not to stereograms). Lisp can’t write binary, but it can write ordinary text files. So after getting the file right, the rest is just a question of conversion. I downloaded a free hex editor (https://mh-nexus.de/en/hxd/). Now: I use Lisp from inside AutoCAD to write the text file. I open it with Notepad, copy/paste the data in the hex editor and from there I save the file with BMP extension. Here are two samples -converted to GIF with Irfanview (https://www.irfanview.com/) just for uploading in the Forum. And here is a Lisp: (defun c:bmp() (setq file (open "C:\\Users\\miklos.fuccaro\\Desktop\\MyBitmap.tXt" "W")) (setq null4 "00 00 00 00") ; file header: (write-line "42 4d" file) ;Magic Bytes (write-line null4 file) ;File size (write-line null4 file) ;Reserved 1+2 (write-line "36 00 00 00" file) ;Data offset ! ; Image header: (write-line "28 00 00 00" file) ;Heder size (write-line "ff 00 00 00" file) ;image width ! (write-line "ff 00 00 00" file) ;image height ! (write-line "01 00" file) ;Color Planes (write-line "10 00" file) ;Bits / Pixel ! (write-line null4 file) ;No compressions (write-line null4 file) ;Image size (write-line null4 file) ;X pix per m (write-line null4 file) ;Y pix / m (write-line null4 file) ;Colors (write-line null4 file) ;Important colors ; Pixel data: ;| ; saturn (setq col1 "08 08" col2 "1d 00" col3 "ff 1c" cx 115 cy 100 rDisc 50 rX 97 rY 14 i 0) (repeat 256 (setq i (1+ i) j 0) (repeat 256 (setq j (1+ j)) (setq dx (- cx j) dy (- cy i) dx (* dx dx) dy (* dy dy)) (setq onDisc (if (< (+ dx dy) (* rDisc rDisc)) 1 nil)) (setq ell (+ (/ (* (- i cy) (- i cy)) (* rY rY 1.0)) (/ (* (- j cX) (- j cX)) (* rX rX 1.0)))) (setq onEllipse (if (equal ell 1 0.4) 1 nil)) (setq str (if onDisc col2 col1)) (cond ((and onEllipse (= str col1)) (setq str col3)) ((and onEllipse (= str col2) (< i cy)) (setq str col3)) ) (write-line str file) ) ) |; ; tree (setq col1 "ff 2d" col2 "e0 03" col3 "00 1c" col4 "c0 09"r1 0.03 r2 0.65 i 256) (repeat 256 (setq i (1- i) j 0) (repeat 256 (setq str (if (< i 200) col1 col4)) (setq j (1+ j)) (setq str (if (< (abs (- j 90)) (* (rem i (+ 45 (/ i 7))) r2)) col2 str)) (setq str (if (< (abs (- j 90)) (* i r1)) col3 str)) (write-line str file) ) ) (close file) (princ "OK") (princ) )
×
×
  • Create New...