GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aseprite/clip: Cross-platform C++ library to copy/paste clipboard content

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

214 Commits
214 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
examples
examples
 
 
tests
tests
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
clip-config.cmake.in
clip-config.cmake.in
 
 
clip.cpp
clip.cpp
 
 
clip.h
clip.h
 
 
clip_base.h
clip_base.h
 
 
clip_common.h
clip_common.h
 
 
clip_lock_impl.h
clip_lock_impl.h
 
 
clip_none.cpp
clip_none.cpp
 
 
clip_osx.h
clip_osx.h
 
 
clip_osx.mm
clip_osx.mm
 
 
clip_win.cpp
clip_win.cpp
 
 
clip_win.h
clip_win.h
 
 
clip_win_bmp.cpp
clip_win_bmp.cpp
 
 
clip_win_bmp.h
clip_win_bmp.h
 
 
clip_win_hglobal.h
clip_win_hglobal.h
 
 
clip_win_wic.cpp
clip_win_wic.cpp
 
 
clip_win_wic.h
clip_win_wic.h
 
 
clip_x11.cpp
clip_x11.cpp
 
 
clip_x11_png.h
clip_x11_png.h
 
 
image.cpp
image.cpp
 
 

Repository files navigation

Clip Library

Copyright (c) 2015-2026 David Capello

build MIT Licensed

Library to copy/retrieve content to/from the clipboard/pasteboard.

Features

Available features on Windows, macOS, and Linux (X11):

  • Copy/paste UTF-8 text.
  • Copy/paste user-defined data.
  • Copy/paste RGB/RGBA images. This library use non-premultiplied alpha RGB values.

Example

#include "clip.h"
#include <iostream>

int main() {
  clip::set_text("Hello World");

  std::string value;
  clip::get_text(value);
  std::cout << value << "\n";
}

User-defined clipboard formats

#include "clip.h"

int main() {
  clip::format my_format =
    clip::register_format("com.appname.FormatName");

  int value = 32;
  std::string str = "Alternative text for value 32";

  clip::lock l;
  l.clear();
  l.set_data(clip::text_format(), str.c_str(), str.size());
  l.set_data(my_format, (const char*)&value, sizeof(int));
}

Platform specific details

  • If two versions of your application (32-bit and 64-bit) can run at at the same time, remember to avoid storing data types that could change depending on the platform (e.g. size_t) in your custom format data.
  • Windows:
    • Limited number of clipboard formats on Windows
  • Linux:
    • To be able to copy/paste on Linux you need libx11-dev/libX11-devel package.
    • To copy/paste images you will need libpng-dev/libpng-devel package.

Compilation Flags

  • CLIP_ENABLE_IMAGE: Enables the support to copy/paste images.
  • CLIP_ENABLE_LIST_FORMATS (only for Windows): Enables the clip::lock::list_formats() API function and the list_clip_formats example.
  • CLIP_EXAMPLES: Compile examples.
  • CLIP_TESTS: Compile tests.
  • CLIP_INSTALL: Generate installation rules for CMake.
  • CLIP_X11_WITH_PNG (only for Linux/X11): Enables support to copy/paste images using the libpng library on Linux.

Who is using this library?

Check the wiki to know what projects are using the clip library.

About

Cross-platform C++ library to copy/paste clipboard content

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

31 stars

Watchers

3 watching

Forks

17 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.